Local Interface Error - Client to Session Bean
Hi,
I am trying out local interfaces and cannot get my example to work.
In summary I am using WebLogic and am getting the following error
javax.naming.LinkException: . Root exception is javax.naming.NameNotFoundException: remaining name: /app/ejb/ejb20_basic_statefulSession.jar#statefulSession/local-home
<<no stack trace available>>
Can anyone see what I am doing wrong?
thanks in advance,
Kevin
my ejb-jar.xml file looks as follows ...
<ejb-jar>
<enterprise-beans>
<session>
<ejb-name>statefulSession</ejb-name>
<local-home>examples.ejb20.basic.statefulSession.LocalTraderHome</local-home>
<local>examples.ejb20.basic.statefulSession.LocalTrader</local>
<ejb-class>examples.ejb20.basic.statefulSession.TraderBean</ejb-class>
<session-type>Stateful</session-type>
<transaction-type>Container</transaction-type>
....
</ebj-jar>
My weblogic-ejb-jar file looks as follows ....
<weblogic-ejb-jar>
<weblogic-enterprise-bean>
<ejb-name>statefulSession</ejb-name>
<local-jndi-name>ejb20-statefulSession-TraderHome</local-jndi-name>
</weblogic-enterprise-bean>
</weblogic-ejb-jar>
My Client code looks as follows ...
// Lookup the beans home using JNDI
Context ctx = getInitialContext();
try {
Object home = ctx.lookup("ejb20-statefulSession-TraderHome");
return (LocalTraderHome) narrow(home, LocalTraderHome.class);
} catch (NamingException ne) {
ne.printStackTrace();
throw ne;
}
private Context getInitialContext() throws NamingException {
try {
// Get an InitialContext
Properties h = new Properties();
h.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
h.put(Context.PROVIDER_URL, url);
return new InitialContext(h);
} catch (NamingException ne) {
log("We were unable to get a connection to the WebLogic server at "+url);
log("Please make sure that the server is running.");
ne.printStackTrace();
throw ne;
}

