1 Reply Latest reply on Jun 25, 2002 10:50 AM by adrian.brock

    javax.naming.NameNotFoundException: ForumEJB not bound

    sakkiel

      Hi,

      Running JBoss 3.0 RC 1. Trying to deploy a simple entity bean called ForumEJB; keep getting "ForumEJB" not bound. I have tried fiddling with the JNDI settings, I have redeployed numerous times, I've tried adding a jboss.xml file, but nothing. The jar gets deployed without an error message, but it seems as though the bean doesn't getting bound into the JNDI tree. When viewing the JNDI view in JMX, I don't see it anywhere, even though it supposedly deployed successfully. Any hints from anyone?

      Here follows the full error:
      javax.naming.NameNotFoundException: ForumEJB not bound
      at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Stream
      RemoteCall.java:245)
      at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:
      220)
      at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:122)
      at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:365)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:349)
      at javax.naming.InitialContext.lookup(InitialContext.java:350)
      at test.main(test.java:14)

      The code that causes the error:
      public static void main(String[] args) {
      try {
      Context jndiContext = getInitialContext();
      Object ref = jndiContext.lookup("ForumEJB");
      ForumHome home = (ForumHome)
      PortableRemoteObject.narrow(ref, ForumHome.class);
      ForumRemote remote = home.create(new Integer(1));
      remote.setName("test");
      System.out.println("created forum EJB");
      } catch (java.rmi.RemoteException re) {re.printStackTrace();}
      catch (javax.naming.NamingException ne) {ne.printStackTrace();}
      catch (javax.ejb.CreateException ce) {ce.printStackTrace();}
      }

      public static Context getInitialContext()
      throws javax.naming.NamingException {

      Properties p = new Properties();
      p.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
      p.put(Context.PROVIDER_URL, "localhost:1099");
      p.put(Context.URL_PKG_PREFIXES, "org.jboss.naming");

      return new javax.naming.InitialContext(p);
      }

      Here follows the ejb-jar.xml:
      <!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>

      <ejb-name>ForumEJB</ejb-name>
      com.emedia24.discuss.ForumHome
      com.emedia24.discuss.ForumRemote
      <ejb-class>com.emedia24.discuss.ForumBean</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>java.lang.Integer</prim-key-class>
      False
      <abstract-schema-name>Forum</abstract-schema-name>
      <cmp-version>2.x</cmp-version>
      <cmp-field><field-name>id</field-name></cmp-field>
      <cmp-field><field-name>description</field-name></cmp-field>
      <primkey-field>id</primkey-field>
      <security-identity><use-caller-identity/></security-identity>

      </enterprise-beans>

      <assembly-descriptor>
      <security-role>
      everyone allowed
      <role-name>everyone</role-name>
      </security-role>
      <method-permission>
      <role-name>everyone</role-name>

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

      </method-permission>
      <container-transaction>

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

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