Java Reference
In-Depth Information
Finally, you require an EJB deployment descriptor for your EJB component. You create the file
ejb-jar.xml in the META-INF directory of your classpath and add the following contents to describe your
EJB component:
<ejb-jar>
<enterprise-beans>
<session>
<display-name>PostageService</display-name>
<ejb-name>PostageService</ejb-name>
<home>com.apress.springenterpriserecipes.post.PostageServiceHome</home>
<remote>com.apress.springenterpriserecipes.
post.PostageServiceRemote</remote>
<ejb-class>
com.apress.springenterpriserecipes.post.PostageServiceBean
</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Bean</transaction-type>
</session>
</enterprise-beans>
</ejb-jar>
Now your EJB component is finished, and you should pack your interfaces, classes, and deployment
descriptors in a JAR file. Then start up your EJB container and deploy this EJB component to it.
Note To start the OpenEJB container, you first set the OPENEJB_HOME environment variable to point to your
OpenEJB installation directory. Then execute the OpenEJB startup script (located in the bin directory) with the
parameter start (e.g., openejb start ). In another shell, to deploy an EJB component, you also execute the
OpenEJB startup script, but this time you pass deploy and the location of your EJB JAR file as parameters. (e.g.,
openejb deploy PostService.jar ).
For OpenEJB, the default JNDI name for a remote home interface of an EJB 2.x component is the
EJB name with RemoteHome as its suffix ( PostageServiceRemoteHome in this case). If the deployment is
successful, you should see the following output:
Application deployed successfully at "c:\PostageService.jar"
App(id= C:\openejb-3.1.1\apps\ PostageService.jar)
EjbJar(id=PostageService.jar, path= C:\openejb-3.1.1\apps\ PostageService.jar)
Ejb(ejb-name=PostageService, id=PostageService)
Jndi(name=PostageServiceRemoteHome)
Jndi(name=PostageServiceLocal)
Search WWH ::




Custom Search