Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

visibility of EJB in a war file

 
Himai Minh
Ranch Hand
Posts: 1361
7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ivan's notes, p.241, it quotes:

The no interface and local business interface view of an EJB deployed in a WAR file are only visible to components within the WAR. If the WAR file is part of an application and other modules of the application wishes to access the no interface or local business interface view of an EJB, then the EJB must be deployed in a seperated EJB-JAR file in the application.


I wonder if the local/no interface view is only visible in WAR.
I have a .ear file with a WAR and a jar.
Inside the .war, I have a local interface and a bean implements that local interface .
Inside the .jar, I have a bean looking up the local interface view of the bean. It still works.



The lookup works. So, I believe the local interface of the .war file is also visible to the .jar file inside the same .ear.

 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2536
113
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, you are correct. Access to an EJB through the local client view (Local business interface or No-interface) is supported for local clients packaged within the same application as the enterprise bean that provides the local client view.
 
Himai Minh
Ranch Hand
Posts: 1361
7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, thanks for Frits reply.
The JSR 318 says the same thing as Ivan's notes.

20.4.3 Visibility of the local client view
The local client view of an ejb 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 ejb from a different
module in the same application should use an ejb-jar file to define
the ejb that expose the local client view.


But what I see from my code example is that the local view of the EJB in .war can be accessed by another EJB in the .jar file in the same .ear.
In the other words, from my code example, the local view of the bean in .war is visible to other modules in the same .ear (application).
I am surprised that the bean in the .war is visible outside its .war file. This conflicts the specification.
I guess Glassfish allows this nowadays.
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2536
113
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am surprised that the bean in the .war is visible outside its .war file. This conflicts the specification.

I think you got me wrong here.

I always thought that it should be possible because of the following part of the specs:

3.2.2 Local Clients
Access to an enterprise bean through the local client view requires the collocation in the same JVM of both the local client and the enterprise bean that provides the local client view. The local client view therefore does not provide the location transparency provided by the remote client view. Access to an enterprise bean through the local client view is only required to be supported for local clients packaged within the same application as the enterprise bean that provides the local client view.

I read this in a way that local clients are visible within the .ear, but it seems this part of the specs conflics the part that you quoted for EJB's packaged in a .war

 
Himai Minh
Ranch Hand
Posts: 1361
7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Frits. Thanks for pointing out.
I have the same doubt too.
1. Session 3.2.2 says the local view of a bean can be accessed within a .ear file. That implies the local view of a bean packaged in a .war within the .ear is visible to any other bean packaged in other .jar file in the same .ear.

2. But session 20.4.3 says the local view of a bean packaged in a .war within the .ear is not visible to any other bean packaged in other .jar file in the same .ear.

These two notes are not consistent.

Based on the code example I provided in the previous post, the local view of a bean in .war is visible to another bean in .jar in the same .ear.
I believe session 20.4.3 is not true anymore.
 
Himai Minh
Ranch Hand
Posts: 1361
7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One more notes on p.244 of Ivan's notes:

Empirical results tell me that components in a web module in an EAR file are not accessible by components outside of the web module.

The web module refers to .war file.
Based on my previous code example (within the same .ear, the bean in .jar can lookup another bean in .war)
and session 3.2.2 in JSR-318, it is not true anymore.
 
Himai Minh
Ranch Hand
Posts: 1361
7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is a related discussion in Enthuware forum about local client's visibility http://www.enthuware.com/forum/viewtopic.php?f=4&t=3201

In my original post, I think GlassFish 3.1.2 allows a bean in a .jar to access another bean's local view/no-interface view in .war within the same .ear.
The spec only requires the local view / no-interface view to be accessed within the same application (eg the same .war or .jar).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic