aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Call EJB3.1 using Local interface Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Call EJB3.1 using Local interface " Watch "Call EJB3.1 using Local interface " New topic
Author

Call EJB3.1 using Local interface

das govender
Greenhorn

Joined: Mar 12, 2012
Posts: 16
Hi

I have an EJB and WAR deployed in same domain on Glassfish 3.1.2 where the WAR dependency is the EJB's client jar generated by Maven. The EJB has TestSessionBean and its Local interface TestSessionBeanLocal.
How do I look this up in the WAR. I have tried usring @EJB with no success.

any suggestions?

Tks,
D
Engin Okucu
Ranch Hand

Joined: Feb 09, 2002
Posts: 174
Hello Das,

Can you post you code ? easier to help you.
Ernesto Arroyo
Greenhorn

Joined: Mar 06, 2011
Posts: 11

I'm not sure about this, but I think that you need to use a @Remote to access the EJB from the WAR
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30762
    
156

Ernesto Arroyo wrote:I'm not sure about this, but I think that you need to use a @Remote to access the EJB from the WAR

To elaborate on this, you need @Remote unless the ejb and war are deployed in the same ear file.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Alexandre Sbriglio
Greenhorn

Joined: Jun 09, 2011
Posts: 4
Hi,
If you have deployed independently your ejb module and your war module, you have to expose your EJB with a remote view (@Remote) in order to inject it in the war module. But if you have packaged your EJB and war modules in an enterprise archive (ear), the local view or the no-interface view are efficients.

regards,
alex


Alexandre Sbriglio - Marseille
SCJP 6 / OCP BCD5
Engin Okucu
Ranch Hand

Joined: Feb 09, 2002
Posts: 174
Hi Alex,


Even @Local is sufficient as long as the EJB and the client are in the same JVM. @Remote is used when you deploy separately.
What do you think ?
das govender
Greenhorn

Joined: Mar 12, 2012
Posts: 16
Hi Guys

thanks for the reply. Engin what di you mean by same JVM w.r.t to Glassfish. Same domain == JVM? I do not think this is the case.

tks,
daslan
Alexandre Sbriglio
Greenhorn

Joined: Jun 09, 2011
Posts: 4
Hi,
I don't think we must think in therm of JVM co-location (/or glassfish domain) to choose between remote or local client view. We must think in therm of application co-location :
If the client is packaged in the same application (ejb-jar, war, ear) than the session bean, this client can access the bean through his local business interface, otherwise if the the client is not in the same application, it must access through the remote interface.
So if we deploy separate war and ejb modules, we have 2 separate applications.

the EJB 3.1 says about local 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. Compliant implementations of this specification may optionally support access to the local client view of an enterprise bean from a local client packaged in a different application. The configuration requirements for inter-application access to the local client view are vendor-specific and are outside the scope of this specification.

If i don't mistake a glassfish domain is a server instance running in a JVM, in the case of a non clustered domain.

Sorry for my bad english.
Regards,
Alex



 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Call EJB3.1 using Local interface