1 Reply Latest reply on Sep 14, 2006 3:34 PM by Martin Landwehr

    Could not dereference object on Remote Server

    Martin Landwehr Newbie

      Hi!

      I'm a newby in ejb3.0 and startet with the tutorials.

      The first step was testing the Stateful-ShoppingCart-Example.
      I used the JBoss4.0.4 (ejb3-installer) on a local machine - the same machine from where i started the client-app. >> everything works!

      The next step was using an 4.0.4-JBoss on an remote Server (Ubuntu 5.10). This Server i used already with jboss4.0.3 and ejbs2.1 and j2ee works with him.

      When I deployed the ShoppingCart.jar and tryed to run the Client from an remote win2000-pc i have this error:



      Exception in thread "main" javax.naming.NamingException: Could not dereference object [Root exception is org.jboss.remoting.CannotConnectException: Can not get connection to server. Problem establishing socket connection.]
       at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1150)
       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:705)
       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
       at javax.naming.InitialContext.lookup(Unknown Source)
       at org.jboss.tutorial.stateful.client.Client.main(Client.java:53)
      Caused by: org.jboss.remoting.CannotConnectException: Can not get connection to server. Problem establishing socket connection.
       at org.jboss.remoting.transport.socket.SocketClientInvoker.transport(SocketClientInvoker.java:267)
       at org.jboss.remoting.RemoteClientInvoker.invoke(RemoteClientInvoker.java:143)
       at org.jboss.remoting.Client.invoke(Client.java:525)
       at org.jboss.remoting.Client.invoke(Client.java:488)
       at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:41)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
       at org.jboss.aspects.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:34)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
       at org.jboss.aspects.remoting.PojiProxy.invoke(PojiProxy.java:46)
       at $Proxy0.createProxy(Unknown Source)
       at org.jboss.ejb3.JndiProxyFactory.getObjectInstance(JndiProxyFactory.java:52)
       at javax.naming.spi.NamingManager.getObjectInstance(Unknown Source)
       at org.jnp.interfaces.NamingContext.getObjectInstance(NamingContext.java:1125)
       at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1142)
       ... 4 more
      Caused by: java.net.ConnectException: Connection refused: connect
       at java.net.PlainSocketImpl.socketConnect(Native Method)
       at java.net.PlainSocketImpl.doConnect(Unknown Source)
       at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
       at java.net.PlainSocketImpl.connect(Unknown Source)
       at java.net.SocksSocketImpl.connect(Unknown Source)
       at java.net.Socket.connect(Unknown Source)
       at java.net.Socket.connect(Unknown Source)
       at java.net.Socket.<init>(Unknown Source)
       at java.net.Socket.<init>(Unknown Source)
       at org.jboss.remoting.transport.socket.SocketClientInvoker.createSocket(SocketClientInvoker.java:535)
       at org.jboss.remoting.transport.socket.SocketClientInvoker.getConnection(SocketClientInvoker.java:471)
       at org.jboss.remoting.transport.socket.SocketClientInvoker.transport(SocketClientInvoker.java:263)
       ... 17 more
      



      In the Demo-Code I just made this changes:

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



      The run.sh was modified, too:

      while [ $STATUS -eq 10 ]
      do
      # Execute the JVM
       "$JAVA" $JAVA_OPTS \
       -Djava.endorsed.dirs="$JBOSS_ENDORSED_DIRS" \
       -Djava.rmi.server.hostname=192.168.1.2 \
       -Djava.rmi.server.useLocalHostname=false \
       -classpath "$JBOSS_CLASSPATH" \
       org.jboss.Main "$@"
       STATUS=$?
       # if it doesn't work, you may want to take a look at this:
       # http://developer.java.sun.com/developer/bugParade/bugs/4465334.html
      done
      


      My Linux-Server is already working with jboss4.0.3 and i can access the 2.1-beans via the clientapps on my win2000pc - the network-connection and the firewall-configuration must be ok.

      Where is the(my) problem?

      Greetings
      Martin