• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Expose EJBs within .war to other modules within the same EAR

 
Ranch Hand
Posts: 577
Tomcat Server Notepad Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have the following excerpts from EJB3.1 specifications document and questions-

page 590

Applications needing access to the local client view of an enterprise bean from a different module in the same application should use an ejb-jar file to define the enterprise bean that exposes the local client view.



Okay, I understand we should have WEB-INF/ejb-jar.xml to expose local client view(including no-interface client view). Can I see some sample xml fragment of how this can be done? Also, imagine I have under WEB-INF/lib/<ejb-jar>.jar file which has in itself META-INF/ejb-jar.xml. Can I still expose my local client view(including no-interface client view) without defining WEB-INF/ejb-jar.xml?


page 593

If the by-reference approach is used, the ejb-jarfile or .war file producer does not duplicate the content of the ejb-client JAR file in the ejb-jar fileor .war file, but instead uses a Manifest Class-Path entry in the ejb-jar file or .war file to specify that the ejb-jar file or .war file depends on the ejb-client JAR at runtime. The use of the Class-Path entries in JAR files and .war files is explained in the Java EE Platform specification [12].



Why does a Bean Provider/Application Assembler want to create ejb client jar file "within" the EAR file/WAR file? It has to be generated outside and shared to the clients. Also, why do .war or ejb-jar file want to depend on ejb client jar file by referring in my MANIFEST.MF's Class-Path entry? ejb client jar has nothing to do with the actual ejb jar file but it is needed to clients who call these EJBs. I'm sure, spec doesn't lie, may be my interpretation is wrong?

Thanks,
Naren
 
Creator of Enthuware JWS+ V6
Posts: 3411
320
Android Eclipse IDE Chrome
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The way I read this:

The local client view(including the no-interface view) of an enterprise bean component defined within a .war file is only required to be accessible to components within the same .war file. Applications needing access to the local client view of an enterprise bean from a different module in the same application should use an ejb-jar file to define the enterprise bean that exposes the local client view.


is that if you want to expose a local view of the EJB packaged in the .war file you should have a setup like this (ejb packaged in an ejb-jar inside WEB-INF/lib, no EJB classes inside WEB-INF/classes). Note that having an ejb-jar file inside the lib directory is logically the same as having the ejb classes in the WEB-INF/classes directory of the .war file.


Naren Chivukula wrote: Why does a Bean Provider/Application Assembler want to create ejb client jar file "within" the EAR file/WAR file? It has to be generated outside and shared to the clients


It can create an ejb client jar inside the lib directory of the .war file:

The MyEJBClient.jar can than be used for local clients outside the .war file as well (the .ear file might consist of a couple of EJB modules all using the same MyEJB). Just to get an idea you might want to have a look at my graph in chapter 10.2.1.

Regards,
Frits
 
Naren Chivukula
Ranch Hand
Posts: 577
Tomcat Server Notepad Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Frits. A second read-through makes sense.

 
No prison can hold Chairface Chippendale. And on a totally different topic ... my stuff:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic