8 Replies Latest reply on Feb 29, 2008 7:13 AM by sunspider

    jndi connecting problem

    sunspider

      I bind jboss to one network interface with ./run.sh -b x.x.x.x command.
      When run on the local machine, client using jndi connects correctly to the configured address, and finishes successfully. but on remote machine, exception is thrown. more over, if the code is wrapped inside servlet, though jndi context is correct, the code always connect to localhost.
      first one of the following stack trace is shown on remote machine, the second one is inside container.

      //========================
      {java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.provider.url=192.168.1.101, java.naming.factory.url.pkgs=org.jnp.interfaces:org.jboss.naming}
      javax.naming.CommunicationException: Could not obtain connection to any of these urls: 192.168.1.101 and discovery failed with error: javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out] [Root exception is javax.naming.CommunicationException: Failed to connect to server 192.168.1.101:1099 [Root exception is java.lang.ClassNotFoundException: org.jnp.server.NamingServer_Stub]]
      at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1601)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:636)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:629)
      at javax.naming.InitialContext.lookup(Unknown Source)
      at sunspider.jaxws20.tutorial.service.impl.eventing.AnnoucementEntity.(AnnoucementEntity.java:52)
      at sunspider.jaxws20.tutorial.service.impl.eventing.AnnoucementEntity.main(AnnoucementEntity.java:121)
      Caused by: javax.naming.CommunicationException: Failed to connect to server 192.168.1.101:1099 [Root exception is java.lang.ClassNotFoundException: org.jnp.server.NamingServer_Stub]
      at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:276)
      at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1572)
      ... 5 more
      Caused by: java.lang.ClassNotFoundException: org.jnp.server.NamingServer_Stub
      at java.net.URLClassLoader$1.run(Unknown Source)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(Unknown Source)
      at java.lang.ClassLoader.loadClass(Unknown Source)
      at java.lang.ClassLoader.loadClass(Unknown Source)
      at java.lang.ClassLoader.loadClassInternal(Unknown Source)
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Unknown Source)
      at sun.rmi.server.LoaderHandler.loadClass(Unknown Source)
      at sun.rmi.server.LoaderHandler.loadClass(Unknown Source)
      at java.rmi.server.RMIClassLoader$2.loadClass(Unknown Source)
      at java.rmi.server.RMIClassLoader.loadClass(Unknown Source)
      at sun.rmi.server.MarshalInputStream.resolveClass(Unknown Source)
      at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
      at java.io.ObjectInputStream.readClassDesc(Unknown Source)
      at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
      at java.io.ObjectInputStream.readObject0(Unknown Source)
      at java.io.ObjectInputStream.readObject(Unknown Source)
      at java.rmi.MarshalledObject.get(Unknown Source)
      at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:259)
      ... 6 more

      //===========================
      2008-02-16 19:45:09,834 INFO [STDOUT] thread start
      2008-02-16 19:45:09,850 INFO [STDOUT] {java.naming.provider.url=192.168.1.101, java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces:org.jboss.naming:org.jnp.interfaces:org.jnp.interfaces:org.jboss.naming:org.jnp.interfaces:org.jboss.naming}
      2008-02-16 19:45:15,020 DEBUG [org.jnp.interfaces.NamingContext] Failed to connect to localhost:1099
      javax.naming.CommunicationException: Failed to connect to server localhost:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server localhost:1099 [Root exception is java.net.ConnectException: Connection refused]]
      at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:272)
      at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1423)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:597)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:590)
      at javax.naming.InitialContext.lookup(InitialContext.java:351)
      at org.jboss.ws.extensions.eventing.mgmt.DispatcherDelegate.getServer(DispatcherDelegate.java:84)
      at org.jboss.ws.extensions.eventing.mgmt.DispatcherDelegate.getSubscriptionManager(DispatcherDelegate.java:65)
      at org.jboss.ws.extensions.eventing.mgmt.DispatcherDelegate.dispatch(DispatcherDelegate.java:44)
      at sunspider.jaxws20.tutorial.service.impl.eventing.AnnoucementEntity.run(AnnoucementEntity.java:132)
      Caused by: javax.naming.ServiceUnavailableException: Failed to connect to server localhost:1099 [Root exception is java.net.ConnectException: Connection refused]
      at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:246)
      ... 8 more
      Caused by: java.net.ConnectException: Connection refused
      at java.net.PlainSocketImpl.socketConnect(Native Method)
      at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
      at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
      at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
      at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
      at java.net.Socket.connect(Socket.java:516)
      at java.net.Socket.connect(Socket.java:466)
      at java.net.Socket.(Socket.java:366)
      at java.net.Socket.(Socket.java:266)
      at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:84)
      at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:77)
      at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:242)
      ... 8 more

        • 1. Re: jndi connecting problem
          jaikiran

           

          Root exception is java.lang.ClassNotFoundException: org.jnp.server.NamingServer_Stub ]]


          For this, you will have to include the jbossall-client.jar file in the classpath of the remote client application.


          For the second case, can you post the code of the servlet, where you are doing this lookup. Looks strange, the Context.PROVIDER_URL that you are passing is being ignored.




          • 2. Re: jndi connecting problem
            sunspider

            No, client doesn't have org.jnp.server.* package. this class should be downloaded from server dynamically during invocation.
            I bind jboss to 0.0.0.0 interface, the servlet problem seems solved. but I get another XPath problem. I can evaluate xpath standalone, but can't in the container enviroment. some syntax is not allowed.
            this one is illegal.
            string-length(/ns3:orderOperationResponse/ns2:orderOut/clientID)>0
            this one is legal.
            /ns3:ticketsOperationResponse/ns2:ticketsOut/totalPrice>0
            strange.

            • 3. Re: jndi connecting problem
              sunspider

              The first one is RMI codebase problem, but I haven't solved it.
              second one is OK now, I combined the two XPath into one, with "or".

              • 4. Re: jndi connecting problem
                sunspider

                I opened server firewall port 8083,1099,1098 and some more. I used ethereal to capture the socket syn packets. but I find my client freezed! I've no idea.

                • 5. Re: jndi connecting problem
                  jaikiran

                   

                  No, client doesn't have org.jnp.server.* package. this class should be downloaded from server dynamically during invocation.


                  I did not get this. You are using these classes for JNDI lookup from the client. So shouldn't the jar containing these class files be available in the client's classpath? Did you try adding the jbossall-client.jar in the classpath of the client application?

                  • 6. Re: jndi connecting problem
                    sunspider

                    I tried to use several different method to access JNDI from remote machine, and always get problem on server.
                    The following one is what I get with JNDI over Http.
                    The InitialContext can be obtained, but look up failed.
                    if I put jbossall-client.jar on classpath the first stack trace is obtained, and if I put jbosssx-client.jar, jnp-client.jar, jboss-sercurity-spi.jar, jboss-client.jar on classpath the second stack trace is otained. Both from server side.

                    So this must be an classpath problem.


                    //===========================
                    2008-02-28 21:18:13,952 DEBUG [org.jboss.invocation.http.servlet.InvokerServlet] Invoke threw exception
                    java.io.InvalidClassException: org.jboss.security.plugins.JBossSecurityContext; class invalid for deserialization
                    at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:571)
                    at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1552)
                    at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1466)
                    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1699)
                    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
                    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
                    at org.jboss.invocation.MarshalledInvocation.readExternal(MarshalledInvocation.java:590)
                    at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1755)
                    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1717)
                    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
                    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
                    at org.jboss.invocation.http.servlet.InvokerServlet.processRequest(InvokerServlet.java:137)
                    at org.jboss.invocation.http.servlet.InvokerServlet.doPost(InvokerServlet.java:224)
                    at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
                    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
                    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:231)
                    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
                    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:174)
                    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
                    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:86)
                    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
                    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
                    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:238)
                    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
                    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:624)
                    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
                    at java.lang.Thread.run(Thread.java:595)


                    //==================================
                    2008-02-28 21:38:12,884 DEBUG [org.jboss.invocation.http.servlet.InvokerServlet] Invoke threw exception
                    java.lang.ArrayIndexOutOfBoundsException: 20
                    at org.jboss.invocation.InvocationKey.readResolve(InvocationKey.java:170)
                    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 java.io.ObjectStreamClass.invokeReadResolve(ObjectStreamClass.java:1033)
                    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1728)
                    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
                    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
                    at org.jboss.invocation.MarshalledInvocation.readExternal(MarshalledInvocation.java:589)
                    at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1755)
                    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1717)
                    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
                    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
                    at org.jboss.invocation.http.servlet.InvokerServlet.processRequest(InvokerServlet.java:137)
                    at org.jboss.invocation.http.servlet.InvokerServlet.doPost(InvokerServlet.java:224)
                    at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
                    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
                    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:231)
                    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
                    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:174)
                    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
                    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:86)
                    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
                    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
                    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:238)
                    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
                    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:624)
                    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
                    at java.lang.Thread.run(Thread.java:595)

                    • 7. Re: jndi connecting problem
                      jaikiran

                       

                      2008-02-28 21:18:13,952 DEBUG [org.jboss.invocation.http.servlet.InvokerServlet] Invoke threw exception
                      java.io.InvalidClassException: org.jboss.security.plugins.JBossSecurityContext; class invalid for deserialization


                      Did you use the same JBoss jar files which are on the server? Also, make sure you are using the same version of Java on both the server and the client.

                      • 8. Re: jndi connecting problem
                        sunspider

                        sorry, I compiled jboss-5.0.0-Beta2 and used it as server, but at client side, I just installed jboss-5.0.0-Beta3. So that caused the problem.