3 Replies Latest reply on Oct 3, 2001 12:25 PM by southin

    NameNotFoundException

    southin

      Hi,

      I am having quite a problem trying to get a simple ejb session stateless bean to run. I have read another thread but that doesn't seem to help.

      I am running Jboss 2.4.1-Tomcat 3.2.3. I get a name not found exception error on the bean:

      [Default] JBoss 2.2.1 Started in 0m:22s
      [EmbeddedTomcat] Test ctx = javax.naming.InitialContext@6e6ad6
      [EmbeddedTomcat] Error in Text e: javax.naming.NameNotFoundException: SBSalary n
      ot bound

      I know it got deployed successfully.

      [Auto deploy] Auto deploy of file:/C:/jboss/deploy/Renault.jar
      [J2EE Deployer Default] Deploy J2EE application: file:/C:/jboss/deploy/Renault.j
      ar
      [J2EE Deployer Default] Create application Renault.jar
      [J2EE Deployer Default] install module Renault.jar
      [Container factory] Deploying:file:/C:/jboss/tmp/deploy/Default/Renault.jar
      [Verifier] Verifying file:/C:/jboss/tmp/deploy/Default/Renault.jar/ejb1002.jar
      [Container factory] Deploying SBSalary
      [Container factory] Deployed application: file:/C:/jboss/tmp/deploy/Default/Rena
      ult.jar
      [J2EE Deployer Default] J2EE application: file:/C:/jboss/deploy/Renault.jar is d
      eployed.
      [Auto deploy] Auto deploy of file:/C:/jboss/deploy/SimpleWebService.war

      My ejb-jar.xml is:

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

      <ejb-name>SBSalary</ejb-name>
      com.skunkworks.renault.SBSalaryHome
      com.skunkworks.renault.SBSalary
      <ejb-class>com.skunkworks.renault.SBSalaryBean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Bean</transaction-type>

      </enterprise-beans>
      </ejb-jar>

      The Jboss jndiview list on localhost:8082 is:

      list Successful



      --------------------------------------------------------------------------------

      The operation

      was successfully invoked for the MBean [DefaultDomain:service=JNDIView].
      The operation returned with the value:


      Application: file:/C:/jboss/tmp/deploy/Default/SimpleWebService.war
      Application: file:/C:/jboss/tmp/deploy/Default/Renault.jar
      java:comp namespace of the SBSalary bean:
      +- UserTransaction (class: javax.transaction.UserTransaction)
      +- env (class: org.jnp.interfaces.NamingContext)

      My java code is:

      try {

      InitialContext ctx = new InitialContext();
      System.out.println("Test ctx = " + ctx);

      // synchronized (ctx) {


      Object ref = ctx.lookup("java:comp/SBSalary");
      System.out.println("Test ref = " + ref);

      SBSalaryHome home = (SBSalaryHome) PortableRemoteObject.narrow(ref, SBSalaryHome.class);

      //SBSalaryHome home = (SBSalaryHome) ctx.lookup("java:/SBSalary");

      System.out.println("Test home = " + home);

      //SBSalary salary_obj = home.create();
      //total_salary = salary_obj.calculateSalary(salary, bonus);

      return 1;


      //} //synchronized
      } catch (Exception e) {
      System.out.println("Error in Text e: " + e);
      return 0;
      }

      Am I missing something? I did try going the other route of having a Renault-client.jar but that gave me lots of problems.

      Southin




        • 1. Re: NameNotFoundException
          p_d_austin

          Take out the java:/ infront of the lookup call.

          Paul

          • 2. Re: NameNotFoundException
            southin

            Paul,

            I changed

            Object ref = ctx.lookup("java:comp/SBSalary");

            to

            Object ref = ctx.lookup("SBSalary");.

            I recompiled and reloaded my war to Jboss and get the following.

            [Container factory] Deployed application: file:/C:/jboss/tmp/deploy/Default/Powe
            r.war/
            [J2EE Deployer Default] J2EE application: file:/C:/jboss/deploy/Power.war is dep
            loyed.
            [EmbeddedTomcat] Test ctx = javax.naming.InitialContext@72f0d0
            [EmbeddedTomcat] Error in Text e: javax.naming.CommunicationException [Root exce
            ption is java.lang.ClassNotFoundException: com.skunkworks.renault.SBSalaryHome]




            • 3. Re: NameNotFoundException
              southin

              P.S.

              I did check the jar file to make sure that all 3 classes and the ejb-jar xml files are there.