• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Bear Bibeault
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • salvin francis
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
Bartenders:
  • Jj Roberts
  • Carey Brown
  • Scott Selikoff

EJB 3.0 / Glassfish2u2 / JNDI Lookup for Local Interface :shock:

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I got really puzzled about JNDI lookup for local interface in Glassfish2u2.

Whenever I call remote interface like

InitialContext ctx = new InitialContext(); TestingRemote testingBeanJndi = (TestingRemote) ctx.lookup(TestingRemote.class.getName());

It works fine.........

But

InitialContext ctx = new InitialContext(); String strLookUp = ""java:comp/env/ejb/TestingBean"; TestingLocal testingBeanJndi = (TestingLocal) ctx.lookup(strLookUp);

It doesn't work...
I tried
strLookUp = ""java:comp/env/TestingBean";

I also tried like
@Stateless(name="ejb/TestingBeanLocal") // previously I didn't overwrite 'name'
public class TestingBean implements TestingRemote, TestingLocal { }

AND

strLookUp = ""java:comp/env/ejb/TestingBeanLocal";

Not working as well.


Could anyone please help me?

And could I get list for all JNDI env by using any command?

PS -- I am packing in the Beans in ear file.
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mohammad Rezwan wrote:I got really puzzled about JNDI lookup for local interface in Glassfish2u2.

Whenever I call remote interface like

InitialContext ctx = new InitialContext(); TestingRemote testingBeanJndi = (TestingRemote) ctx.lookup(TestingRemote.class.getName());

It works fine.........

But

InitialContext ctx = new InitialContext(); String strLookUp = ""java:comp/env/ejb/TestingBean"; TestingLocal testingBeanJndi = (TestingLocal) ctx.lookup(strLookUp);

It doesn't work...
I tried
strLookUp = ""java:comp/env/TestingBean";

I also tried like
@Stateless(name="ejb/TestingBeanLocal") // previously I didn't overwrite 'name'
public class TestingBean implements TestingRemote, TestingLocal { }

AND

strLookUp = ""java:comp/env/ejb/TestingBeanLocal";

Not working as well.


Could anyone please help me?

And could I get list for all JNDI env by using any command?

PS -- I am packing in the Beans in ear file.



Where are you putting this look up code??
in which component (Servlete or app client ......)

Dhiren
 
Mohammad Rezwan
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I need JNDI Lookup from POJO
 
Mohammad Rezwan
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I found the answer from following two URLs

1.http://www.nabble.com/lookup-ejbs-td19961900.html
2.https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html#POJOLocalEJB
 
There is no beard big enough to make me comfortable enough with my masculinity to wear pink. Tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic