Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

i am trying to get this jndi lookup right. Need you hint.

kevin ou
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all
I am trying to lookup the customer entity bean from the jsp page.
In jsp I write this statement.
jndiContext = EJBHelper.getInitialContext();
Object ref = jndiContext.lookup("java:comp/env/ejb/customer");
and I have defined my getInitialContext function like this:
public static Context getInitialContext() throws NamingException {
// String url = "t3://DEFAULT-E38STB3:7001";
String url = "t3://";
String user = null;
String password = null;
Properties properties = null;
try {
properties = new Properties();
properties.put(Context.PROVIDER_URL, url);
if (user != null) {
properties.put(Context.SECURITY_PRINCIPAL, user);
password == null ? "" : password);
return new InitialContext(properties);
catch (NamingException e) {
System.out.println("Unable to connect to WebLogic server at " + url);
System.out.println("Please make sure that the server is running.");
throw e;
and I have setup the web.xml like this:
<description />
and the weblogic xml like this:
<description>WebLogic Descriptor</description>

However I am still getting name NameNotFoundException error.
Can you guys please give a hint for this. What else I am missing here.
Thanks a lot!
<Error> <HTTP> <101017> <[ServletContext(id=230937
6,name=AuctionWeb,context-path=/AuctionWeb)] Root cause of ServletException
javax.naming.LinkException: .
Root exception is javax.naming.LinkException: .
Root exception is javax.naming.NameNotFoundException: Unable to resolve 'app/ejb
/CustomerEJB.jar#CustomerEJB/local-home' Resolved: 'app/ejb' Unresolved:'Custome
rEJB.jar#CustomerEJB' ; remaining name 'CustomerEJB.jar#CustomerEJB/local-home'
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic