0 Replies Latest reply on Aug 31, 2006 2:57 AM by Johannes Martin

    context.list() shows Object, but context.lookup() fails with

    Johannes Martin Newbie

      The following problem occurs while looking up an EJB within an EAR in JBoss 4.0.4SP1.

      When I try to lookup an EJB like
      ... = new InitialContext().lookup("local/SomeService");
      a "javax.naming.NameNotFoundException: SomeService not bound" is thrown.

      Obvious reason would be that something is wrong with ejb-jar.xml or jboss.xml, but they look right (see below).

      Also, when I use the following code to list the contents of "local", the TRXService appears:
      ne = new InitialContext.list("local");
      while (ne.hasMore()) {
      NameClassPair p = (NameClassPair) ne.next();
      System.out.println(p.getName() + ":\t" + p.getClassName());
      }
      ...
      08:42:03,703 INFO [STDOUT] SomeService@12594563: $Proxy180
      ...

      Also, the lookup seems to work fine with JBoss 3.2.1.

      Any hints?

      Thanks
      Johannes

      -----
      jboss.xml:
      <?xml version="1.0" encoding="UTF-8"?>

      <enterprise-beans>

      <ejb-name>SomeService</ejb-name>
      <jndi-name>local/SomeService</jndi-name>

      </enterprise-beans>

      -----
      ejb-jar.xml:
      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE ejb-jar PUBLIC
      "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN"
      "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
      <ejb-jar>
      <enterprise-beans>

      <display-name>SomeService</display-name>
      <ejb-name>SomeService</ejb-name>
      <local-home>de.mycompany.SomeServiceHome</local-home>
      de.mycompany.SomeService
      <ejb-class>de.mycompany.SomeServiceBean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>
      <security-identity>

      <use-caller-identity />
      </security-identity>

      </enterprise-beans>

      <assembly-descriptor>
      <container-transaction>

      <ejb-name>SomeService</ejb-name>
      <method-name>*</method-name>

      <trans-attribute>Required</trans-attribute>
      </container-transaction>
      <container-transaction>

      <ejb-name>SomeService</ejb-name>
      <method-name>execute</method-name>

      <trans-attribute>RequiresNew</trans-attribute>
      </container-transaction>
      </assembly-descriptor>
      </ejb-jar>
      -----