A sample application-client.xml (Java EE 5)

Application client is another type of Java EE module, the least utilized one. It attempts to wrap up Java SE application, deploy it to application server, and make use of deployed EJB, platform services and resources.

The following application-client.xml declares an env-entry, ejb-ref and resource-ref.

<?xml version="1.0" encoding="UTF-8"?>
<application-client xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="5"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application-client_5.xsd">

<display-name>A sample application client</display-name>

<description>admin email</description>



The env-entry can be looked up with name "java:comp/env/adminEmail", or injected into the application client main class or its superclasses. For example:
//use static modifier in application client main class only
private static String adminEmail;
The ejb-ref and resource-ref can be looked up with names "java:comp/ejb/testBean" and "java:comp/env/HRDS", respectively.

The reason I include ejb-ref and resource-ref is to show how they fit in descriptors. In Java EE 5 and later, it is easier to use @EJB and @Resource to declare and inject them into component classes.


Anonymous said...

you have a nice site.thanks for sharing this site. various kinds of ebooks are available here


Steve Smith said...

Great and Useful Article.

Online Java Training

Java Online Training India

Java Online Course

Java EE course

Java EE training

Best Recommended books for Spring framework

Java Interview Questions

Java Course in Chennai

Java Online Training India

Vũ Diệu Linh said...

I enjoyed on reading your blog post. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article. Please visit my website, Friv 4000 Games is where all the free friv games.
Friv 4000