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
