5 Replies Latest reply on Jul 23, 2005 10:00 AM by Joao Limberger

    NameNotFoundException: ejb local not found

    Rajesh J Newbie

      Hi,

      I have a session bean

      MRManagerBean

      and a few other beans.. in a mrejbs.jar when deploying I get

      .jca:name=EtsDataSource,service=DataSourceBinding to JNDI name 'java:EtsDataSource'
      [EjbModule] Deploying MarketingRequestItemShipments
      [EjbModule] Deploying MarketingRequests
      [EjbModule] Deploying MarketingRequestItems
      [EjbModule] Deploying MRManager
      [EJBDeployer] Deployed: file:/C:/jboss/server/default/deploy/mrejbs.jar

      In ther JBoss console.

      But when I try to use it in client class

      InitialContext ic = new InitialContext();
      Object ref = ic.lookup("java:comp/MRManagerLocal");
      MRManagerLocalHome home = (MRManagerLocalHome) PortableRemoteObject.narrow(ref,MRManagerLocalHome.class);
      MRManagerLocal localSession = home.create();



      I get

      12:57:57,124 INFO [STDOUT] javax.naming.NameNotFoundException: ejb not bound
      12:57:57,124 INFO [STDOUT] at org.jnp.server.NamingServer.getBinding(NamingServer.java:491)
      12:57:57,139 INFO [STDOUT] at org.jnp.server.NamingServer.getBinding(NamingServer.java:499)
      12:57:57,139 INFO [STDOUT] at org.jnp.server.NamingServer.getObject(NamingServer.java:505)
      12:57:57,139 INFO [STDOUT] at org.jnp.server.NamingServer.lookup(NamingServer.java:249)
      12:57:57,139 INFO [STDOUT] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:610)
      12:57:57,139 INFO [STDOUT] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572)
      12:57:57,139 INFO [STDOUT] at javax.naming.InitialContext.lookup(InitialContext.java:347)




      I have tried
      Object ref = ic.lookup("MRManagerLocal");

      Object ref = ic.lookup("ejb/MRManagerLocal");

      Object ref = ic.lookup("java:comp/env/ejb/MRManagerLocal");

      all with the same error.

      My descriptors look like
      JBoss.xml

      <ejb-name>MRManager</ejb-name>
      <local-jndi-name>MRManagerLocal</local-jndi-name>

      <method-attributes>
      </method-attributes>


      ejb-jar.xml

      [CDATA[]]

      <ejb-name>MRManager</ejb-name>

      <local-home>mr.massconnections.server.MRManagerLocalHome</local-home>
      mr.massconnections.server.MRManagerLocal
      <ejb-class>mr.massconnections.server.MRManagerSession</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>



      I am not sure what I am missing or where I am going wrong.. I looked at the Jndi list on the console and it says that the JNDI name is "MRManagerLocal"

      Can anyone help me.

      Regards
      Rajesh J

        • 1. Re: NameNotFoundException: ejb local not found
          Darran Lofthouse Master

          When posting problems can you please make sure you post the correct error for the code you are showing.

          Local interfaces are for use localy within the application server JVM, you can not make use of them from remote clients. You will need to give your bean a home and remote interface and use these from the remote client.

          • 2. Re: NameNotFoundException: ejb local not found
            Rajesh J Newbie

            Hi,

            My client is a java file in a webapp running on the same JBoss server, I thought I can use local interfaces if the server is same. Thats the way it works in weblogic so I assumed its the same here. Can you confirm that it is not the case and I do need to use remote interfaces.

            Rajesh J

            • 3. Re: NameNotFoundException: ejb local not found
              Darran Lofthouse Master

              Ok, yes you can access the local interface from the web application. You will have to remote the PortableRemoteObject.narrow as you are not using a portable remote object, you are using a local object. Just cast the looked up object to the local home interface type.

              What is the error you get when you lookup 'MRManagerLocal'?

              • 4. Re: NameNotFoundException: ejb local not found
                Rajesh J Newbie

                Hi,

                I shall cast it directly,

                I am getting a namenotfoundexception. I am trying to create a ear file now, so that I can remove the interfaces from my war file and have my ejb jar and war file in one ear file. Hoping that will solve my problem.

                The exception I get now is

                13:05:20,331 INFO [STDOUT] javax.naming.NameNotFoundException: MRManagerLocal not bound
                13:05:20,331 INFO [STDOUT] at org.jnp.server.NamingServer.getBinding(NamingServer.java:491)
                13:05:20,331 INFO [STDOUT] at org.jnp.server.NamingServer.getBinding(NamingServer.java:499)
                13:05:20,331 INFO [STDOUT] at org.jnp.server.NamingServer.getObject(NamingServer.java:505)
                13:05:20,331 INFO [STDOUT] at org.jnp.server.NamingServer.lookup(NamingServer.java:278)
                13:05:20,331 INFO [STDOUT] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:610)
                13:05:20,347 INFO [STDOUT] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:701)
                13:05:20,347 INFO [STDOUT] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572)
                13:05:20,347 INFO [STDOUT] at javax.naming.InitialContext.lookup(InitialContext.java:347)

                Regards
                Rajesh J

                • 5. Re: NameNotFoundException: ejb local not found
                  Joao Limberger Newbie

                  I have this throwble too!
                  I can`t access a java:comp/env resource.

                  Where can i found a working sample with JBoss 4.02?