• 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

how to access one ejb with local interface from different application deployed in same server.

 
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I am using EJB 3 with annotation. I have one local interface and bean class. I want to access this EJB in different application which is deployed in same application server. When i am using

@EJB
public TestEjbInterface testInterface

in any servlet or any EJB session bean from different applicaiton, i am able to get the values but when i am trying to do JNDI look up in POJO class to get TestEjbInterface i am getting Naming exception. I cannot do dependency injection in POJO class as POJO class is not managed by the server.

What is the way to get local ejb which is running in different applicatioin in same applicaiton server in POJO class. If i am using remote interface, i am able to do jndi names.
I am using glassfish application server.

If local interface EJB is not accessible outside the application , then why i am able to get this by using Dependency injection in some servlet or EJB , which are in diff. applicaiton.

Please help me.

Sunil
 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In general the following steps should solve your problems (the actual steps may differ from application server to application server).

1. Define the JNDI name in a scope that includes both the application. For example define the JNDI at a Server, Node or cell level.

2. Use fully qualified name to look up the JNDI , starting with cell . For example:

initialContext.lookup(cell/nodes/YourNode/servers/YourServer/com/YourEjb)


Hope this helps
 
xsunil kumar
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Pallav, but still it is not clear to me. Can you give me some sample example or how to define global JNDI names and where.
My another doubt is that , as per my understanding local interface ejb should not be accessible out side of the applicaiton, then how i am able to access this ejb in differnet application using dependency injection.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic