[jboss-user] [EJB/JBoss] - EJB 3873 Can not get connection to server

zjx_cool do-not-reply at jboss.com
Mon Jan 14 19:12:58 EST 2008


I got a frustrated problem when I try to call more than two method in same remote interface from client, sometimes it run correctlly and give me right answer but 90% will get a Exception listed bellow. I tryed likely hundreds times and figure out that if I only call one method at a time , it work fine. but if I
call two method closely it will throw this Exception...hep thanks.



	public static void main(String[] args)
  | 	{
  | 	
  | 		InitialContext ctx;
  | 		try
  | 		{
  | 			ctx = new javax.naming.InitialContext();
  | 			ctx.addToEnvironment(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
  | 			ctx.addToEnvironment(Context.PROVIDER_URL, "jnp://localhost");
  | 			ctx.addToEnvironment("InitialContext.SECURITY_PRINCIPAL", "user");
  | 			ctx.addToEnvironment("InitialContext.SECURITY_CREDENTIALS", "password");
  | 			
  | 			ctx.addToEnvironment("java.naming.factory.url.pkgs", "org.jboss.naming");
  | 			HelloWorldRemote remote = (HelloWorldRemote)ctx.lookup("HelloWorld/remote");
  | 			System.out.println(remote.sayHello("ken"));
  | 
  | 			System.out.println("res =" + remote.getRes());
  | 			System.out.println("res + 10 = " + remote.add(10));
  | 
  | 			System.out.println("res =" + remote.getRes());
  | 			System.out.println("res + 20 = " + remote.add(20));
  | 			System.out.println("res =" + remote.getRes());
  | 			
  | 			ctx.close();
  | 		}
  | 		catch (NamingException e)
  | 		{
  | 			// TODO Auto-generated catch block
  | 			e.printStackTrace();
  | 		}
  | 
  | 	}
  | 


it will keep giving me Exception :


  | hello world ken
  | Exception in thread "main" org.jboss.remoting.CannotConnectException: Can not get connection to server. Problem establishing socket connection for InvokerLocator [socket://127.0.0.1:3873/]
  | 	at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.transport(MicroSocketClientInvoker.java:532)
  | 	at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:122)
  | 	at org.jboss.remoting.Client.invoke(Client.java:1634)
  | 	at org.jboss.remoting.Client.invoke(Client.java:548)
  | 	at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:62)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:67)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:53)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:74)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:107)
  | 	at $Proxy0.getRes(Unknown Source)
  | 	at TestMain.main(TestMain.java:31)
  | Caused by: java.lang.reflect.InvocationTargetException
  | 	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
  | 	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
  | 	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
  | 	at java.lang.reflect.Constructor.newInstance(Unknown Source)
  | 	at org.jboss.remoting.transport.socket.SocketClientInvoker.createClientSocket(SocketClientInvoker.java:152)
  | 	at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.getConnection(MicroSocketClientInvoker.java:856)
  | 	at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.transport(MicroSocketClientInvoker.java:525)
  | 	at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:122)
  | 	at org.jboss.remoting.Client.invoke(Client.java:1634)
  | 	at org.jboss.remoting.Client.invoke(Client.java:548)
  | 	at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:62)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:67)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:53)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:74)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:107)
  | 	at $Proxy0.getRes(Unknown Source)
  | 	at TestMain.main(TestMain.java:31)
  | 	at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:74)
  | 	... 10 more
  | Caused by: java.net.SocketException: Software caused connection abort: socket write error
  | 	at java.net.SocketOutputStream.socketWrite0(Native Method)
  | 	at java.net.SocketOutputStream.socketWrite(Unknown Source)
  | 	at java.net.SocketOutputStream.write(Unknown Source)
  | 	at java.io.BufferedOutputStream.flushBuffer(Unknown Source)
  | 	at java.io.BufferedOutputStream.flush(Unknown Source)
  | 	at java.io.ObjectOutputStream$BlockDataOutputStream.flush(Unknown Source)
  | 	at java.io.ObjectOutputStream.flush(Unknown Source)
  | 	at org.jboss.remoting.marshal.serializable.SerializableMarshaller.getMarshallingStream(SerializableMarshaller.java:90)
  | 	at org.jboss.remoting.marshal.serializable.SerializableMarshaller.getMarshallingStream(SerializableMarshaller.java:72)
  | 	at org.jboss.remoting.transport.socket.ClientSocketWrapper.createOutputStream(ClientSocketWrapper.java:204)
  | 	at org.jboss.remoting.transport.socket.ClientSocketWrapper.createStreams(ClientSocketWrapper.java:163)
  | 	at org.jboss.remoting.transport.socket.ClientSocketWrapper.<init>(ClientSocketWrapper.java:66)
  | 	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
  | 	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
  | 	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
  | 	at java.lang.reflect.Constructor.newInstance(Unknown Source)
  | 	at org.jboss.remoting.transport.socket.SocketClientInvoker.createClientSocket(SocketClientInvoker.java:152)
  | 	at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.getConnection(MicroSocketClientInvoker.java:856)
  | 	at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.transport(MicroSocketClientInvoker.java:525)
  | 	at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:122)
  | 	at org.jboss.remoting.Client.invoke(Client.java:1634)
  | 	at org.jboss.remoting.Client.invoke(Client.java:548)
  | 	at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:62)
  | 	... 10 more
  | 
  | 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4119868#4119868

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4119868



More information about the jboss-user mailing list