Problem establishing socket connection for InvokerLocator
chengwen Jul 20, 2011 10:45 AMhello, all
Today I am confused by a problem. I am trying to migrate my project form JBoss 4.0.4 to JBoss AS 6.0.0 Final these days. With JBoss 6 and ejb3, now everything looks fine except one:
The testing code is as below:
try { Properties jndiProps = new Properties(); jndiProps.put("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory"); jndiProps.put("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces"); jndiProps.put("java.naming.provider.url","localhost"); InitialContext ctx = new InitialContext(jndiProps); ReflectEJBTest bean = (ReflectEJBTest) ctx.lookup("ReflectEJBBeanTest/remote"); bean.login("admin", "123456", true); } catch (Exception e) { e.printStackTrace (); }
if I just double click /%jboss_home%/bin/run.bat to run jboss, the testing code works fine.
However, if I run the bat with parameters like this:
run.bat -c default
Then, the code shows exceptions:
javax.naming.NamingException: Could not dereference object [Root exception is org.jboss.remoting.CannotConnectException: Can not get connection to server. Problem establishing socket connection for InvokerLocator [socket://Eowyn_Computer/?timeout=300000]] at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1504) at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:822) at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:686) at javax.naming.InitialContext.lookup(InitialContext.java:392) at mytest.LoginTest.main(LoginTest.java:430) Caused by: org.jboss.remoting.CannotConnectException: Can not get connection to server. Problem establishing socket connection for InvokerLocator [socket://Eowyn_Computer/?timeout=300000] at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.transport(MicroSocketClientInvoker.java:776) at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:165) at org.jboss.remoting.Client.invoke(Client.java:1724) at org.jboss.remoting.Client.invoke(Client.java:629) at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:60) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) at org.jboss.ejb3.proxy.impl.remoting.IsLocalProxyFactoryInterceptor.invoke(IsLocalProxyFactoryInterceptor.java:72) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) at org.jboss.aspects.remoting.PojiProxy.invoke(PojiProxy.java:62) at $Proxy0.createProxyBusiness(Unknown Source) at org.jboss.ejb3.proxy.impl.objectfactory.session.SessionProxyObjectFactory.createProxy(SessionProxyObjectFactory.java:129) at org.jboss.ejb3.proxy.impl.objectfactory.session.stateless.StatelessSessionProxyObjectFactory.getProxy(StatelessSessionProxyObjectFactory.java:79) at org.jboss.ejb3.proxy.impl.objectfactory.ProxyObjectFactory.getObjectInstance(ProxyObjectFactory.java:158) at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304) at org.jnp.interfaces.NamingContext.getObjectInstance(NamingContext.java:1479) at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1496) ... 4 more Caused by: java.lang.IllegalArgumentException: port out of range:-1 at java.net.InetSocketAddress.<init>(InetSocketAddress.java:118) at org.jboss.remoting.transport.socket.SocketClientInvoker.createSocket(SocketClientInvoker.java:197) at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.getConnection(MicroSocketClientInvoker.java:1089) at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.transport(MicroSocketClientInvoker.java:762) at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:165) at org.jboss.remoting.Client.invoke(Client.java:1724) at org.jboss.remoting.Client.invoke(Client.java:629) at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:60) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) at org.jboss.ejb3.proxy.impl.remoting.IsLocalProxyFactoryInterceptor.invoke(IsLocalProxyFactoryInterceptor.java:72) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) at org.jboss.aspects.remoting.PojiProxy.invoke(PojiProxy.java:62) at $Proxy0.createProxyBusiness(Unknown Source) at org.jboss.ejb3.proxy.impl.objectfactory.session.SessionProxyObjectFactory.createProxy(SessionProxyObjectFactory.java:129) at org.jboss.ejb3.proxy.impl.objectfactory.session.stateless.StatelessSessionProxyObjectFactory.getProxy(StatelessSessionProxyObjectFactory.java:79) at org.jboss.ejb3.proxy.impl.objectfactory.ProxyObjectFactory.getObjectInstance(ProxyObjectFactory.java:158) at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304) at org.jnp.interfaces.NamingContext.getObjectInstance(NamingContext.java:1479) at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1496) at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:822) at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:686) at javax.naming.InitialContext.lookup(InitialContext.java:392) at mytest.LoginTest.main(LoginTest.java:430) at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:72) ... 15 more
I ontice the message:
Can not get connection to server. Problem establishing socket connection for InvokerLocator [socket://Eowyn_Computer/?timeout=30000
Eowyn_Computer is my computer name. I don't think the "socket://Eowyn_Computer/?timeout=30000" is correct. But why?
Because I need to run multi instance in the project, parameters like "-c serverNode" are necessary.
I guess I missed something, mayby some configuration files?
Any one can help? Or any advices?
Thanks very, very much!