Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

JNDI lookup problem from SessionBean

 
Author
Posts: 531
Mac OS X Netbeans IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi friends
I use WSAD 5.1.2 and test environment 5.
I have a problem in locating a CMP from a
Session bean (Stateless) .
There is one package in my project named cmps
and two ejb
1-SessionBean : Usermanagement.
2-CMP : User.
I used UTC to check my CMP it works fine and has no problem
but my lookup code in SessionBean could not find it in JNDI

my code is :
public UserLocalHome getUserHome()throws NamingException
{
Context ctx = new InitialContext();
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,"com.ibm.websphere.naming.WsnInitialContextFactory");
env.put(Context.PROVIDER_URL,"corbaloc::127.0.0.1:9810");
return (UserLocalHome)ctx.lookup("ejb/cmps/UserLocalHome");
}
Also I tried to use local lookup (previus code without env) but it doesnt works.

can some one tell me what is problem here?
thank you.
 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well,

shouldnt you first create the Hashtable (env) with the proper values and then create the InitialContext passing the env?
How would the InitialCOntext know about the properties otherwise?

check the port number for the RMI connector, too (just an idea)


cheers
Joe
 
There are 29 Knuts in one Sickle, and 17 Sickles make up a Galleon. 42 tiny ads in a knut:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic