2 Replies Latest reply on Jan 25, 2006 12:07 PM by philc_jboss

    JBoss issue? 2 EJBs implemented the same, but only one can b

    philc_jboss

      Is the issue with the ApplicationServer?

      I have two EJB's, MemberBean and PersonBean, implemented the same way. However, jndi lookup is successful for one (MemberBean), but not the other (PersonBean - javax.naming.NameNotFoundException on the second lookup). See below for the detail, I don't get this one:

      From the log file you can see that both beans are bound succesfully

      APPSERVER LOG FILE


      16:09:34,183 INFO [EjbModule] Deploying MemberBean
      16:09:34,208 INFO [EjbModule] Deploying PersonBean
      16:09:36,917 INFO [BaseLocalProxyFactory] Bound EJB LocalHome 'MemberBean' to jndi 'MemberBeanLocalHome'
      16:09:37,066 INFO [BaseLocalProxyFactory] Bound EJB LocalHome 'PersonBean' to jndi 'PersonBeanLocalHome'
      ...
      ##However the PersonBean fails the context lookup ##

      16:10:22,630 ERROR [PersonDelegate] javax.naming.NameNotFoundException: PersonBeanLocalHome not bound
      ...
      2006-01-24 16:10:22,368 DEBUG [org.blah.delegate.MemberDelegate] GOT MEMBER EJB
      ...
      2006-01-24 16:10:22,629 DEBUG [org.blah.delegate.PersonDelegate] ENTERED>>>>>>>>>>>>>>>>>>>>>
      2006-01-24 16:10:22,630 ERROR [org.blah.delegate.PersonDelegate] javax.naming.NameNotFoundException: PersonBeanLocalHome not bound

      Both Beans are found in the jndi view

      JMX-Console

      +- PersonBeanLocalHome (proxy: $Proxy105 implements interface org.blah.ejb.PersonBeanLocalHome)
      +- XAConnectionFactory
      +- UserTransaction
      +- MemberBeanLocalHome (proxy: $Proxy104 implements interface org.blah.ejb.MemberBeanLocalHome)

      Implmentation Snippets

      PersonBean lookup:

       private PersonBeanLocal getLocalSession()
       {
       PersonBeanLocal local = null;
      
       try
       {
       logger.debug("ENTERED>>>>>>>>>>>>>>>>>>>>>");
      
       Context ctx = new InitialContext();
       Object ref = ctx.lookup("java:comp/env/PersonBeanLocalHome");
      
       logger.debug("GOT PERSON EJB");
       logger.debug("Object ::: " + ref.getClass().getName());
      
       PersonBeanLocalHome home = (PersonBeanLocalHome)ref;
       local = home.create();
       }
       catch(Exception e)
       {
       logger.error("" + e.toString());
       }
       return local;
       }
      


      MemberBean lookup:

       private MemberBeanLocal getLocalSession()
       {
       MemberBeanLocal local = null;
      
       try
       {
       Context ctx = new InitialContext();
       Object ref = ctx.lookup("java:comp/env/MemberBeanLocalHome");
      
       logger.debug("GOT MEMBER EJB");
       logger.debug("Object ::: " + ref.getClass().getName());
      
       MemberBeanLocalHome home = (MemberBeanLocalHome)ref;
       local = home.create();
       }
       catch(Exception e)
       {
       logger.error("" + e.toString());
       }
       return local;
       }
      


      DESCRIPTORS
      
      ejb-jar.xml
      
      ...
      <ejb-jar>
      
       <enterprise-beans>
       <session>
       <display-name>MemberBean</display-name>
       <ejb-name>MemberBean</ejb-name>
       <local-home>org.blah.ejb.MemberBeanLocalHome</local-home>
       <local>org.blah.ejb.MemberBeanLocal</local>
       <ejb-class>org.blah.ejb.MemberBeanLocalEJB</ejb-class>
       <session-type>Stateless</session-type>
       <transaction-type>Container</transaction-type>
       </session>
       <session>
       <display-name>PersonBean</display-name>
       <ejb-name>PersonBean</ejb-name>
       <local-home>org.blah.ejb.PersonBeanLocalHome</local-home>
       <local>org.blah.ejb.PersonBeanLocal</local>
       <ejb-class>org.blah.ejb.PersonBeanLocalEJB</ejb-class>
       <session-type>Stateless</session-type>
       <transaction-type>Container</transaction-type>
       </session>
       <assembly-descriptor>
       </assembly-descriptor>
       </enterprise-beans>
      </ejb-jar>
      ...
      
      
      jboss.xml
      
       <jboss>
       <enterprise-beans>
       <session>
       <ejb-name>MemberBean</ejb-name>
       <local-jndi-name>MemberBeanLocalHome</local-jndi-name>
       </session>
       <session>
       <ejb-name>PersonBean</ejb-name>
       <local-jndi-name>PersonBeanLocalHome</local-jndi-name>
       </session>
       <secure>false</secure>
       </enterprise-beans>
       </jboss>