I use weblogic 10.3.6 and so EJB 3.0. I have EJB and local interface. Both packaged in ejb-jar inside ear.
@Local
public interface TestLocal {
...
}
@Stateless
public class TestEJB implements TestLocal {
...
}
To access this EJB from war I have in my web.xml
<ejb-local-ref>
<ejb-ref-name>ejb/TestLocal</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local>testpackage.TestLocal</local>
</ejb-local-ref>
And lookup looks like
test = (TestLocal) new InitialContext().lookup("java:comp/env/ejb/TestLocal");
Everything works fine. Now I need to call this EJB from the same ejb-jar where it packaged. But I have javax.naming.NameNotFoundException all the time. What I have already tried:
In
ejb-jar.xmlin ejb-jar (not ear)<ejb-name>TestEJB</ejb-name> <ejb-local-ref> <ejb-ref-name>TestEJB</ejb-ref-name> <ejb-ref-type>Session</ejb-ref-type> <local>testpackage.TestLocal</local> <ejb-link>myjar.jar#TestEJB</ejb-link> </ejb-local-ref>
and following lookups
initialContext.lookup("java:comp/env/TestEJB");
initialContext.lookup("TestEJB");
in
weblogic-ejb-jar.xml<weblogic-enterprise-bean> <ejb-name>TestEJB</ejb-name> <jndi-name>TestEJB</jndi-name> <local-jndi-name>TestEJB</local-jndi-name> <enable-call-by-reference>True</enable-call-by-reference> </weblogic-enterprise-bean>Both
weblogic-ejb-jar.xmlandejb-jar.xml
Have you any ideas of what I'm doing wrong?