Win a copy of Head First Android this week in the Android forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Please help me understanding this piece of code

 
Ranch Hand
Posts: 212
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please help me understanding this piece of code

I have a


and also its impleentation class .



How the servlet will get access to the TravelAgentRemote ?

What are the steps i need to follow for this ?

Please help me .
 
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would assume that the manager in your code is EntityManager.

Assuming the EJB jar and WAR are packaged into an EAR, then you could use the following annotation for dependency injection



If the servlet is packaged outside the EAR, then you need to modify your deployment descriptor (web.xml) for DI or you can access it via JNDI.

Regards.
 
PavanPL KalyanK
Ranch Hand
Posts: 212
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jerwin ,

How this is mapped as there are no EJB name or a Mapped Name on to Remote EJB . How this dependency injection would be possible to look up from servlet

I want to know how this is possible with by directly looking up with the JNDI name inside the servlet with out writing anything in XML files.

 
Jerwin Louise Uy
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Convention over Configuration.

If you deploy your EJB without specifying the name or mappedName(vendor specific, not portable) then the application server will assume a default global JNDI name. The default global JNDI name is dependent on the application server.

I would recommend reading EJB 3 in Action. The answers to your questions can be found there.

Regards.
 
PavanPL KalyanK
Ranch Hand
Posts: 212
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jerwin ,

One more thing i wanted to know is that

From the servlet we make a call to the interface which is annotated as @Remote

Or

to the class which is annotated as @stateless

Please make me understand this.
 
Jerwin Louise Uy
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

You are making a call against the interface and not the implementation. The EJB container makes a proxy and delegates call to the actual implementation.

I hope I answered your question.

Regards.
 
PavanPL KalyanK
Ranch Hand
Posts: 212
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes Jerwin , you answered my query , but one more from me

"making a call against the interface"

Is this the right approach used ?
 
Jerwin Louise Uy
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Yes. For remote calls (different JVM instances), you need not have the actual implementation in your classpath. You only need the stubs (i.e. ejb-jar containing interfaces) so that you can make a call against that interface. You don't make a call against the implementation because you don't have direct access to the implementation - even through JNDI.

Regards.
 
PavanPL KalyanK
Ranch Hand
Posts: 212
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jerwin , Thats great .

At this moment you are GOD to me .Thank you very much.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic