4 Replies Latest reply on Jan 11, 2006 5:27 PM by starksm64

    JNDI over HTTP - can't get it to work

    chrisbitmead


      I have an EJB application working on my machine in Eclipse. Both the .ear file and my client side work with a jndi.properties like this:

      java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
      java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
      java.naming.provider.url=jnp://localhost:1099

      but I want to get it working with HTTP protocol. So I changed my jndi.properties to be this in both .ear and my client app, and re-installed:

      java.naming.factory.initial=org.jboss.naming.HttpNamingContextFactory
      java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
      java.naming.provider.url=http://127.0.0.1:8080/invoker/JNDIFactory

      But now I get an exception in the client:
      javax.naming.NameNotFoundException: SpFinOtherSession not bound
      at org.jnp.server.NamingServer.getBinding(NamingServer.java:514)
      at org.jnp.server.NamingServer.getBinding(NamingServer.java:522)
      at org.jnp.server.NamingServer.getObject(NamingServer.java:528)
      at org.jnp.server.NamingServer.lookup(NamingServer.java:281)
      ....

      where SpFinOtherSession is one of my ejbs. But jboss started up correctly, with all the EJBS installed, and I can see this EJB in the JMX console correctly.

      If I visit http://127.0.0.1:8080/invoker/JNDIFactory in a browser it has some x-java-serialised-object there, so that seems to be doing something.

      Was there something else I have to change to get this working? I've read everything on the internet on this topic including the manual about 10 times and I can't figure it out. Do I have to do something special to enable the http forwarding in Jboss?

        • 1. Re: JNDI over HTTP - can't get it to work
          chrisbitmead

          This is the full stack trace. The fact that http servlet is in the middle of the stack trace seems to indicate I guess that the servlet proxy is getting called, and then what happens, I don't know...

          javax.naming.NameNotFoundException: SpFinOtherSession not bound
          at org.jnp.server.NamingServer.getBinding(NamingServer.java:514)
          at org.jnp.server.NamingServer.getBinding(NamingServer.java:522)
          at org.jnp.server.NamingServer.getObject(NamingServer.java:528)
          at org.jnp.server.NamingServer.lookup(NamingServer.java:281)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:585)
          at org.jboss.naming.NamingService.invoke(NamingService.java:327)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:585)
          at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
          at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
          at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:118)
          at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
          at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:127)
          at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
          at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
          at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
          at org.jboss.invocation.http.servlet.InvokerServlet.processRequest(InvokerServlet.java:147)
          at org.jboss.invocation.http.servlet.InvokerServlet.doPost(InvokerServlet.java:209)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
          at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
          at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
          at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
          at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
          at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159)
          at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:407)
          at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
          at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
          at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
          at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
          at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
          at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
          at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
          at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
          at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
          at java.lang.Thread.run(Thread.java:595)

          • 2. Re: JNDI over HTTP - can't get it to work
            chrisbitmead


            My server.log contains the following. I have no idea if it relates to my problem. I can't see anything in any config that would cause it.

            2006-01-11 14:29:45,919 DEBUG [org.jnp.interfaces.NamingContext] Failed to connect to http:1099

            javax.naming.CommunicationException: Failed to connect to server http:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server http:1099 [Root exception is java.net.UnknownHostException: http: http]]

            at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:254)

            at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1370)

            at org.jnp.interfaces.NamingContext.rebind(NamingContext.java:469)

            at org.jnp.interfaces.NamingContext.rebind(NamingContext.java:462)

            • 3. Re: JNDI over HTTP - can't get it to work
              chrisbitmead

              Hmm, I see that if I change the jndi.properties on the client to use http, but leave the server .ear jndi.properties as standard, then it works. Could it be that the server .ear cannot access jndi via http, yet the client can? Seems that way. Not sure why. I guess it is ok, there is no reason for the server to use http.

              • 4. Re: JNDI over HTTP - can't get it to work
                starksm64

                Server deployments should not have jndi.properties as this conflicts with the default deployment naming context obtained from new InitialContext()