EJB Deployment
- Create ejb-jar.xml deployment descriptor (*** possibly optional ****)
- Create any necessary vendor specific deployment descriptors
- Create Code
- Typically jar up deployment descriptors with EJB class files into a single "ejb-jar" file. Deploy by either
copying to standard "hot-deploy" directory or use deployment application
tool given by vendor
jar -cvf Whatever.jar *.class *.xml
OR
jar -cvf Whatever.jar * (where have class and xml descriptor files in directory)
- This creates the jar file Whatever.jar
- DO THIS from the directory containing class files.
Puzzle Related info:
- Location of App server intalled (J2ee home) = /opt/glassfish3/glassfish
- Location of Libraries of interest like j2ee.jar = /opt/glassfish3/glassfish/lib
- Location of J2EE tutorial files = http://puzzle.mcs.csueastbay.edu/docs/javaee-tutorial/doc/bnblr.html
- Examples directory: /opt/glassfishv3/glassfish/docs/javaee-tutorial/examples
- Probable location of hot deployment on puzzle: /opt/glassfish3/glassfish/domains/puzzle_dom1/autodeploy
- Glassfish: http://puzzle.mcs.csueastbay.edu:4848
Configuration file see following directory:
/opt/glassfish3/glassfish/config
Ear files and Directory structureYou are deploying an application called hello (hello.ear) that contains an EJB module (hello.jar). With directory-based deployment, the build scripts for your application create the source and deployment descriptors such that the built files always follow the directory structure.
|
||
Command Line Deployment (see documentation for your server)Here is an example from an older J2EE server, Assuming that the directory hello (the hello.ear file) resides in /home/user, type the following command line (all on one line) to deploy the application. % asadmin deploydir --user admin --password admin_password /home/user/hello
|
||
Web Interface Deployment, GlassfishGo to web interface for J2EE server like ours at http://puzzle.mcs.csueastbay.edu:4848 You will have to login and follow instructions contained in: J2EE tutorial w/ info on EJBs to use the GUI to deploy. Basically, you will have to point it to the EAR file discussed above another option may be to deploy as a directory.
|
||
Autodeploy directoryThere is a special directory on the J2EE Server that is used as an autodeploy directory. Basically you deposit your ear file in this directory and it will be automatically picked up for deployment. Application Server polls the autodeploy directory every X (e.g. 2) seconds and deploys any new, deployable units. To change those default values:
To undeploy a unit, simply delete it from the autodeploy directory. Example: Glassfish directory /opt/glassfish3/glassfish/domains/puzzle_dom1/autodeploy |
Deployment Descriptor: ejb-jar.xml
This may be OPTIONAL when you are using annotations in code (@XXX)
XML file that describes EJB type, security and transaction parameters
From EJB Basics example, this would be the XML deployment file (simple) you would use:
<?xml version="1.0"?> <!DOCTYPE ejb.jar PUBLIC <ejb-jar> |
Vendor Specific Deployment Descriptors:
Again may be optional ---check out container documentation
Each vendor can specify its own deployment descriptors. These files give important information about the pakcage name, JNDI name (for remote lookup), and security and persistence information.
NOT Standardized.
BEA Weblogic : weblogic-ejb-jar.xml
|
JBoss : jboss.xml
|