13.07.2015 Views

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

23.2 Lend Me Your EAR: Enterprise Packaging and Deployment511Example 23.4 Sample jboss.xml filetest/M<strong>on</strong>eyejb/M<strong>on</strong>eyThe two tags define the mapping: You use the jndi-name in thelookup() method and it will (try to) find the EJB named with the ejb-nametag. The ejb-name tag is also used in the ejb-jar.xml file. This provides theassociati<strong>on</strong> between the two, and the mapping from the JNDI name to EJB isthereby defined.To summarize, if we want to build an EJB-JAR file, we will need to gatherall the class files in their appropriate classpath directory structures. Then wewill need to write two XML files and place them in the META-INF directoryal<strong>on</strong>g with the MANIFEST.MF file. The two XML files will define the EJB piecesand provide a name mapping for locating this bean. Then put all these piecestogether into a JAR file, and you have an EJB-JAR file.23.2.2 Using Our BeanWe have put a lot of pieces in place to get a bean that we can call from acrossthe enterprise. But what does that call look like? How might we make use ofthe bean?The first step is to make c<strong>on</strong>tact with the JNDI service and locate thehome interface for the bean. It looks like the secti<strong>on</strong> of code in Example 23.5.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!