• 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
  • Paul Clapham
  • Tim Cooke
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Junilu Lacar
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst
  • Peter Rooke
  • Mikalai Zaikin
Bartenders:
  • Himai Minh

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

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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://192.168.1.110:7001";
String user = null;
String password = null;
Properties properties = null;
try {
properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
properties.put(Context.PROVIDER_URL, url);
if (user != null) {
properties.put(Context.SECURITY_PRINCIPAL, user);
properties.put(Context.SECURITY_CREDENTIALS,
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:
<ejb-ref>
<description />
<ejb-ref-name>ejb/customer</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<home>components.customer.ejb.CustomerLocalHome</home>
<remote>components.customer.ejb.CustomerLocal</remote>
</ejb-ref>
and the weblogic xml like this:
<weblogic-web-app>
<description>WebLogic Descriptor</description>
<reference-descriptor>
<ejb-reference-description>
<ejb-ref-name>ejb/customer</ejb-ref-name>
<jndi-name>ejb/CustomerEJB</jndi-name>
</ejb-reference-description>
</reference-descriptor>
</weblogic-web-app>

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'
kevin
 
I’m tired of walking, and will rest for a minute and grow some wheels. This is the promise of this tiny ad:
Master Gardener Program
https://coderanch.com/t/771761/Master-Gardener-Program
reply
    Bookmark Topic Watch Topic
  • New Topic