0 Replies Latest reply: Jan 21, 2013 7:13 AM by Mirian RSS

    Help to understand EJB bean JNDI name

      Hi Guys.

      I made a small example using weblogic 10.3.6 and EJB 3.0. Define SimpleService class, define weblogic-ejb-jar.xml in order to map SimpleService class to JNDI name, pack it as EJB component in EAR file and deploy on server. Deployment is successful and I can see ejb bean with name SimpleServiceBean. After that using standalone application connect to webloigc server through InitialContext with all necessary environment attributes I try to lookup that bean. I assume that it will be available under name ejb/SimpleService but can't found it under that name and only after I was looking through a JNDI tree name I found out that it available under name SimpleService#ds/base/ejb/SimpleService. Help me to understand what is going on? How should I configure ejb bean in order that it will be available under ejb/SimpleService as it described in the official weblogic manual?

      My classes and configs are:
      @Stateless(mappedName = "ServiceBean")
      public class SimpleServiceBean implements SimpleService {

      <weblogic-ejb-jar xmlns="http://xmlns.oracle.com/weblogic/weblogic-ejb-jar"
      http://xmlns.oracle.com/weblogic/weblogic-ejb-jar/1.2/weblogic-ejb-jar.xsd ">



      Then try to get it from standalone:
      InitialContext context = new InitialContext(env);
      SimpleService simpleService = (SimpleService) context.lookup("SimpleService#ds/base/ejb/SimpleService");
      assert simpleService != null

      UPD: ds/base/ejb it's a package where SimpleService class is situated.

      Edited by: Mirian on 21.01.2013 5:12