3 Replies Latest reply on Mar 14, 2007 4:50 PM by ppw

    Problem with JNDI Lookup

    ppw

      I am getting the following error messages. I tried to add
      <use-java-context>false</use-java-context> to oracle-ds.xml file, but it messes up with my form login, so I have to remove it.

      17:23:21,171 ERROR [STDERR] javax.naming.NameNotFoundException: DesignObjectManger not bound
      17:23:21,171 ERROR [STDERR] at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
      17:23:21,171 ERROR [STDERR] at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
      17:23:21,171 ERROR [STDERR] at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
      17:23:21,171 ERROR [STDERR] at org.jnp.server.NamingServer.lookup(NamingServer.java:296)
      17:23:21,171 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:625)
      17:23:21,171 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
      17:23:21,171 ERROR [STDERR] at javax.naming.InitialContext.lookup(Unknown Source)
      17:23:21,171 ERROR [STDERR] at com.atsva.cmmts.struts.action.DesignElementAction.landing(DesignElementAction.java:86)
      17:23:21,171 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      17:23:21,171 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      17:23:21,171 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      17:23:21,171 ERROR [STDERR] at java.lang.reflect.Method.invoke(Unknown Source)
      17:23:21,171 ERROR [STDERR] at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:280)
      17:23:21,171 ERROR [STDERR] at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:216)
      17:23:21,171 ERROR [STDERR] at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
      17:23:21,171 ERROR [STDERR] at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
      17:23:21,171 ERROR [STDERR] at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
      17:23:21,171 ERROR [STDERR] at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
      17:23:21,171 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
      17:23:21,171 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      17:23:21,171 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
      17:23:21,171 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      17:23:21,171 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      17:23:21,171 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      17:23:21,171 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      17:23:21,171 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
      17:23:21,171 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
      17:23:21,171 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
      17:23:21,171 ERROR [STDERR] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
      17:23:21,171 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
      17:23:21,171 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
      17:23:21,171 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
      17:23:21,171 ERROR [STDERR] at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
      17:23:21,171 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
      17:23:21,171 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
      17:23:21,171 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
      17:23:21,171 ERROR [STDERR] at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
      17:23:21,187 ERROR [STDERR] at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
      17:23:21,187 ERROR [STDERR] at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
      17:23:21,187 ERROR [STDERR] at java.lang.Thread.run(Unknown Source)



      Here is the code that does the lookup from the web modual.

      // Hashtable env = new Hashtable();
      // env.put(Context.INITIAL_CONTEXT_FACTORY,
      // "org.jnp.interfaces.NamingContextFactory");
      // env.put(Context.PROVIDER_URL, "localhost:1099");
      // env.put(Context.URL_PKG_PREFIXES,
      // "org.jboss.naming:org.jnp.interfaces");
      // Context ctx = new InitialContext(env);

      Context ctx = new InitialContext();
      Object obj = ctx.lookup("DesignObjectManger");



      jboss.xml
      <ejb-name>DesignObjectManger</ejb-name>
      <jndi-name>ejb/com/atsva/cmmts/ejb/DesignObjectManger</jndi-name>
      <local-jndi-name>DesignObjectMangerLocal</local-jndi-name>


      ejb-jar.xml
      <ejb-name>DesignObjectManger</ejb-name>

      com.atsva.cmmts.interfaces.DesignObjectMangerHome
      com.atsva.cmmts.interfaces.DesignObjectManger
      <local-home>com.atsva.cmmts.interfaces.DesignObjectMangerLocalHome</local-home>
      com.atsva.cmmts.interfaces.DesignObjectMangerLocal
      <ejb-class>com.atsva.cmmts.ejb.DesignObjectMangerSession</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>


      Any suggestions? Thanks.

        • 1. Re: Problem with JNDI Lookup

          Try the following:

          ctx.lookup("java:/DesignObjectManager");
          

          or
          ctx.lookup("java:comp/env/ejb/com/atsva/cmmts/ejb/DesignObjectManager");
          


          Also, go to your JMX Console --> JNDIView and list all the bindings to see if your object is there
          Hope it helps

          • 2. Re: Problem with JNDI Lookup
            ppw

            The second one works. Thank you very much.

            • 3. Re: Problem with JNDI Lookup
              ppw

              Forgot to post the working code.

              Object obj = ctx.lookup("ejb/com/atsva/cmmts/ejb/DesignObjectManger");

              Apparently it needs to match the xdoclet tag which is
              * jndi-name="ejb/com/atsva/cmmts/ejb/DesignObjectManger"