• 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

Call EJB3.1 using Local interface

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Das,

Can you post you code ? easier to help you.
 
Greenhorn
Posts: 11
Objective C Ruby Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not sure about this, but I think that you need to use a @Remote to access the EJB from the WAR
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Engin Okucu
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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



 
reply
    Bookmark Topic Watch Topic
  • New Topic