3 Replies Latest reply on Aug 5, 2002 11:53 PM by steve corrie

    ejb create failure

    steve corrie Newbie

      I'm having difficulty with the create method of the BMP entity bean of JBoss 3 sample application. findByPrimaryKey works fine. The CMP entity bean works fine.


      test.interfaces.TestBMPEntity tbe = null;
      test.interfaces.TestBMPEntityData tbed = null;

      try {
      InitialContext lContext = new InitialContext();

      Object objref = lContext.lookup( "ejb/test/TestBMPEntity" );
      test.interfaces.TestBMPEntityHome lHome =
      (test.interfaces.TestBMPEntityHome)PortableRemoteObject.narrow(objref,
      test.interfaces.TestBMPEntityHome.class);
      test.interfaces.TestBMPEntityPK pKey =
      new test.interfaces.TestBMPEntityPK(2);
      tbe = lHome.findByPrimaryKey(pKey); // this works fine
      tbed = tbe.getValueObject();
      System.out.println("tbed.getId() [" + tbed.getId() + "]");
      System.out.println("tbed.getFirstName() [" + tbed.getFirstName() + "]");
      System.out.println("tbed.getLastName() [" + tbed.getLastName() + "]");
      tbed = new test.interfaces.TestBMPEntityData(0,"Steve","Corrie");
      tbe = lHome.create(tbed); // <<<<======= bombs out here

      I get the following error:
      java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
      java.rmi.ServerException: Naming lookup failure: ejb not bound; nested exception is:
      javax.ejb.EJBException: Naming lookup failure: ejb not bound

      Does anyone have any ideas as to what my blunder is?

      Thanks in advance

      Steve

        • 1. Re: ejb create failure
          Werner Ramaekers Newbie

          check the JBoss log to see under what name your TestBMPEntity was bound at deployment, normally it will be something like
          "test/TestBMPEntity" instead of "ejb/test/TestBMPEntity"
          but you will find it in the server log

          And then change your lookup accordingly.

          Werner

          • 2. Re: ejb create failure
            steve corrie Newbie

            Thanks, but I tried fiddling with the InitialContext lookup, and the only one that works is

            lookup("ejb/test/TestBMPEntity");

            That's the installed jndi name.

            The returned object's findByPrimaryKey method works fine.

            There's some so far undiscovered lookup in the JBoss 3 TestBMPEntity example's code that the server needs that is not being addressed by the XDoclet automatically generated deployment descriptors.

            If anyone can get the sample TestBMPEntity's create method to work from a client app, I'd be happy to hear from them.

            Thanks again,

            Steve

            • 3. Re: ejb create failure
              steve corrie Newbie

              I fixed the problem. Thanks for the suggestion.

              As suggested, it was a lookup problem. I changed the sample TestBMPEntityBean's generateUniqueId() lookup from "java:comp/env/ejb/test/SequenceGenerator" (not there) to "ejb/test/SequenceGenerator" (which has a JNDI name).

              Case closed.

              Steve