4 Replies Latest reply on Nov 14, 2002 8:44 PM by Adrian Brock

    JNDI local lookup problem - cmp not bound

    Allen Walker Newbie

      Running the default server. Able to lookup session beans remotely. Here's my jboss.xml:


      <enterprise-beans>

      <ejb-name>SecurityInfo</ejb-name>
      <local-jndi-name>cmp/SecurityInfo</local-jndi-name>


      <ejb-name>SecurityVerifier</ejb-name>
      <jndi-name>ejb/SecurityVerifier</jndi-name>


      <ejb-name>UserTag</ejb-name>
      <local-jndi-name>cmp/UserTag</local-jndi-name>


      <ejb-name>SavedEcoAnalysis</ejb-name>
      <local-jndi-name>cmp/SavedEcoAnalysis</local-jndi-name>


      <ejb-name>UserSession</ejb-name>
      <jndi-name>ejb/UserSession</jndi-name>

      </enterprise-beans>




      And my code to do the lookup:
      try {
      Context ejb = (Context) new InitialContext().lookup("java:comp/env");
      home = (SavedEcoAnalysisLocalHome)ejb.lookup("local/SavedEcoAnalysis");
      }
      catch (NamingException ne) { throw new EJBException(ne); }


      The exception:

      java.rmi.ServerException: RemoteException occurred in server thread; nested
      exception is:
      java.rmi.ServerException: EJBException:; nested exception is:
      javax.ejb.EJBException: null; CausedByException is:
      cmp not bound
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:292)
      at sun.rmi.transport.Transport$1.run(Transport.java:148)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
      at java.lang.Thread.run(Thread.java:536)
      at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
      at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
      at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:133)
      at org.jboss.invocation.jrmp.server.JRMPInvoker_Stub.invoke(Unknown Source)
      at org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInvokerProxy.java:129)
      at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:108)
      at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:77)
      at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:80)
      at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:111)
      at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:76)
      at $Proxy11.saveEcoData(Unknown Source)
      at com.drillinginfo.struts.actions.CalculatorAction.customPerform(CalculatorAction.java:187)
      at com.drillinginfo.struts.actions.DIAction.perform(DIAction.java:51)
      at org.apache.struts.action.Action.execute(Action.java:401)
      at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:446)
      at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:266)
      at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1292)
      at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:492)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:126)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:103)
      at com.caucho.server.http.FilterChainServlet.doFilter(FilterChainServlet.java:96)
      at com.caucho.server.http.Invocation.service(Invocation.java:312)
      at com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:135)
      at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:244)
      at com.caucho.server.http.HttpRequest.handleConnection(HttpRequest.java:163)
      at com.caucho.server.TcpConnection.run(TcpConnection.java:137)
      at java.lang.Thread.run(Thread.java:536)


      thanks

        • 1. Re: JNDI local lookup problem - cmp not bound
          Adrian Brock Master

          new InitialContext().lookup("cmp/SavedEcoAnalysis");

          The <local-jndi-name> overrides the name for global
          jndi local/<ejb-name> by default.

          If you want java:comp/env
          you need to define an <ejb-ref>

          Regards,
          Adrian

          • 2. Re: JNDI local lookup problem - cmp not bound
            Allen Walker Newbie

            Hmm. ok so I changed my ejb-jar.xml to:


            <ejb-name>UserSession</ejb-name>
            com.drillinginfo.ejb.UserSessionHome
            com.drillinginfo.ejb.UserSession
            <ejb-class>com.drillinginfo.ejb.UserSessionBean</ejb-class>
            <session-type>Stateless</session-type>
            <transaction-type>Container</transaction-type>


            <ejb-ref>
            <ejb-ref-name>cmp/SavedEcoAnalysis</ejb-ref-name>
            <ejb-ref-type>Entity</ejb-ref-type>
            com.drillinginfo.ejb.SavedEcoAnalysisLocalHome
            com.drillinginfo.ejb.SavedEcoAnalysis
            <ejb-link>SavedEcoAnalysis</ejb-link>
            </ejb-ref>





            And the lookup in UserSessionBean.java:

            try {
            Context ejb = (Context) new InitialContext();
            home = (SavedEcoAnalysisLocalHome)ejb.lookup("java:comp/env/cmp/SavedEcoAnalysis");
            }
            catch (NamingException ne) { throw new EJBException(ne); }


            still throws the

            "SavedEcoAnalysis not bound" exception. My jboss.xml has:

            <enterprise-beans>

            <ejb-name>SecurityInfo</ejb-name>
            <local-jndi-name>cmp/SecurityInfo</local-jndi-name>


            <ejb-name>SecurityVerifier</ejb-name>
            <jndi-name>ejb/SecurityVerifier</jndi-name>


            <ejb-name>UserTag</ejb-name>
            <local-jndi-name>cmp/UserTag</local-jndi-name>


            <ejb-name>SavedEcoAnalysis</ejb-name>


            <ejb-name>UserSession</ejb-name>
            <jndi-name>ejb/UserSession</jndi-name>

            </enterprise-beans>

            • 3. Re: JNDI local lookup problem - cmp not bound
              Allen Walker Newbie

              Hmm. ok so I changed my ejb-jar.xml to:


              <ejb-name>UserSession</ejb-name>
              com.drillinginfo.ejb.UserSessionHome
              com.drillinginfo.ejb.UserSession
              <ejb-class>com.drillinginfo.ejb.UserSessionBean</ejb-class>
              <session-type>Stateless</session-type>
              <transaction-type>Container</transaction-type>


              <ejb-ref>
              <ejb-ref-name>cmp/SavedEcoAnalysis</ejb-ref-name>
              <ejb-ref-type>Entity</ejb-ref-type>
              com.drillinginfo.ejb.SavedEcoAnalysisLocalHome
              com.drillinginfo.ejb.SavedEcoAnalysis
              <ejb-link>SavedEcoAnalysis</ejb-link>
              </ejb-ref>





              And the lookup in UserSessionBean.java:

              try {
              Context ejb = (Context) new InitialContext();
              home = (SavedEcoAnalysisLocalHome)ejb.lookup("java:comp/env/cmp/SavedEcoAnalysis");
              }
              catch (NamingException ne) { throw new EJBException(ne); }


              still throws the

              "SavedEcoAnalysis not bound" exception. My jboss.xml has:

              <enterprise-beans>

              <ejb-name>SecurityInfo</ejb-name>
              <local-jndi-name>cmp/SecurityInfo</local-jndi-name>


              <ejb-name>SecurityVerifier</ejb-name>
              <jndi-name>ejb/SecurityVerifier</jndi-name>


              <ejb-name>UserTag</ejb-name>
              <local-jndi-name>cmp/UserTag</local-jndi-name>


              <ejb-name>SavedEcoAnalysis</ejb-name>


              <ejb-name>UserSession</ejb-name>
              <jndi-name>ejb/UserSession</jndi-name>

              </enterprise-beans>

              • 4. Re: JNDI local lookup problem - cmp not bound
                Adrian Brock Master

                com.drillinginfo.ejb.SavedEcoAnalysisLocalHome

                Don't you mean <local-home> ?

                If it is a local bean you will also need a
                <ejb-local-ref>

                Here's the resource files for JBoss's ejb-link tests.

                http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jboss/jbosstest/src/resources/naming/ear/a/META-INF/

                http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jboss/jbosstest/src/resources/naming/ear/b/META-INF/

                Regards,
                Adrian