I have problem with connecting to JBoss instance from standalone Java client.
I have this problem with JBoss 4.0.3 with JBoss 4.0.3RC2 all goes fine.
I've prepared some classes to replicate this problem.

session bean class:

  | import javax.ejb.Remote;
  | import javax.ejb.Stateless;
  | @Stateless
  | @Remote(HelloWorldRemote.class)
  | public class HelloWorldBean implements HelloWorld{
  |     public String hello(String msg) {
  |         return "Hello " + msg + " world!";
  |     }
  | }
  | 

interface classes:

  | public interface HelloWorld {
  |     String hello(String msg);
  | }
  | ...
  | import javax.ejb.Remote;
  | @Remote
  | public interface HelloWorldRemote extends HelloWorld{
  | 
  | }
  | 

client class:

  | import java.util.Properties;
  | import javax.naming.Context;
  | import javax.naming.InitialContext;
  | 
  | public class HelloWorldClient implements HelloWorld{
  | 
  |     public String hello(String msg) {
  |         // TODO Auto-generated method stub
  |         return getDelegate().hello(msg);
  |     }
  | 
  |     private HelloWorld getDelegate() {
  |         try {
  |             InitialContext ctx1;
  |             Properties env = new Properties();
  |             env.setProperty(Context.INITIAL_CONTEXT_FACTORY,
  |                     
"org.jboss.security.jndi.JndiLoginInitialContextFactory");
  |             env.setProperty(Context.SECURITY_PRINCIPAL, "guest");
  |             env.setProperty(Context.SECURITY_CREDENTIALS, "q");
  |             ctx1 = new InitialContext(env);
  |             return (HelloWorld) 
ctx1.lookup(HelloWorldRemote.class.getName());
  |         } catch (Throwable e) {
  |             e.printStackTrace();
  |             System.exit(1);           
  |         }
  |         return null;
  |         
  |     }
  |     
  |     public static void main(String[] args) {
  |         HelloWorld hello = new HelloWorldClient();
  |         System.out.println(hello.hello("JBoss4.0.3"));
  |     }
  | }
  | 

I'am using JBoss all configuration prepared to use EJB3
All deploys fine, but when I run client I have to wait couple of second and I 
can see following Exception on the server side:

  | 15:18:35,786 ERROR [ServerThread] failed to process invocation.
  | java.net.SocketTimeoutException: Read timed out
  |         at java.net.SocketInputStream.socketRead0(Native Method)
  |         at java.net.SocketInputStream.read(SocketInputStream.java:129)
  |         at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
  |         at java.io.BufferedInputStream.read1(BufferedInputStream.java:256)
  |         at java.io.BufferedInputStream.read(BufferedInputStream.java:313)
  |         at 
java.io.ObjectInputStream$PeekInputStream.read(ObjectInputStream.java:2217)
  |         at 
java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2230)
  |         at 
java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2698)
  |         at 
java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:750)
  |         at java.io.ObjectInputStream.<init>(ObjectInputStream.java:268)
  |         at 
org.jboss.remoting.transport.socket.ServerSocketWrapper.createInputStream(ServerSocketWrapper.java:33)
  |         at 
org.jboss.remoting.transport.socket.ClientSocketWrapper.getInputStream(ClientSocketWrapper.java:62)
  |         at 
org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:239)
  |         at 
org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:285)
  |         at 
org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:169)
  | 
And after few more soconds on the client:

  | Exception in thread "main" org.jboss.remoting.CannotConnectException: Can 
not get connection to server.  Problem establishing socket connection.
  |     at 
org.jboss.remoting.transport.socket.SocketClientInvoker.transport(SocketClientInvoker.java:230)
  |     at 
org.jboss.remoting.RemoteClientInvoker.invoke(RemoteClientInvoker.java:112)
  |     at org.jboss.remoting.Client.invoke(Client.java:226)
  |     at org.jboss.remoting.Client.invoke(Client.java:189)
  |     at 
org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:41)
  |     at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
  |     at 
org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:46)
  |     at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
  |     at 
org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:40)
  |     at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
  |     at 
org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:41)
  |     at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
  |     at 
org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:88)
  |     at $Proxy1.hello(Unknown Source)
  |     at pl.kapital.HelloWorldClient.hello(HelloWorldClient.java:13)
  |     at pl.kapital.HelloWorldClient.main(HelloWorldClient.java:37)
  | Caused by: java.lang.reflect.InvocationTargetException
  |     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
  |     at 
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
  |     at 
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
  |     at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
  |     at 
org.jboss.remoting.transport.socket.SocketClientInvoker.createClientSocket(SocketClientInvoker.java:452)
  |     at 
org.jboss.remoting.transport.socket.SocketClientInvoker.getConnection(SocketClientInvoker.java:431)
  |     at 
org.jboss.remoting.transport.socket.SocketClientInvoker.transport(SocketClientInvoker.java:226)
  |     ... 15 more
  | Caused by: java.io.EOFException
  |     at 
java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2232)
  |     at 
java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2698)
  |     at 
java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:750)
  |     at java.io.ObjectInputStream.<init>(ObjectInputStream.java:268)
  |     at 
org.jboss.remoting.loading.ObjectInputStreamWithClassLoader.<init>(ObjectInputStreamWithClassLoader.java:43)
  |     at 
org.jboss.remoting.transport.socket.ClientSocketWrapper.createInputStream(ClientSocketWrapper.java:40)
  |     at 
org.jboss.remoting.transport.socket.ClientSocketWrapper.<init>(ClientSocketWrapper.java:32)
  |     ... 22 more
  | 

What is wrong with the new JBoss?
Is that a bug or configuration issue. 
What should I do to get it right?

Rafal

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

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


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to