4 Replies Latest reply on Apr 13, 2006 12:18 PM by Terry

    problem with ejb3 on jboss4.0.3SP1

    alberto coletti Newbie

      I cannot get rid of this:

      I've a trivial ejb3 stateless session bean.

      package com.alblab.ejb3.interfaces;
      // remote interface
      
      import javax.ejb.Local;
      
      @Remote
      public interface RemoteCalculator {
       public double calculate(int a,int b);
      }



      //implementation bean
      package com.alblab.ejb3.stateless;
      
      import javax.ejb.*;
      import com.alblab.ejb3.interfaces.RemoteCalculator;
      @Stateless
      public class CalculatorBean implements RemoteCalculator {
       public int calculate(int a, int b){
       return a+b;
       }
      }


      I've packed these classes in a jar with extension .ejb3
      and deployed it on jboss 4.0.3SP1

      //deployement info

      13:32:48,305 INFO [JaccHelper] Initialising JACC Context for deployment: Calculator.ejb3
      13:32:48,506 INFO [Ejb3AnnotationHandler] found EJB3: ejbName=com.alblab.ejb3.stateless.CalculatorBean, class=com.alblab.ejb3.stateless.CalculatorBean, type=ST
      ATELESS
      13:32:48,716 INFO [JaccHelper] com.alblab.ejb3.stateless.CalculatorBean has no @SecurityDomain - skipping JACC configuration
      13:32:48,716 INFO [JaccHelper] JACC Policy Configuration for deployment has been put in service
      13:32:48,716 INFO [Ejb3Deployment] EJB3 deployment time took: 411
      13:32:48,796 INFO [ProxyDeployer] no declared remote bindings for : com.alblab.ejb3.stateless.CalculatorBean
      13:32:48,806 INFO [ProxyDeployer] there is remote interfaces for com.alblab.ejb3.stateless.CalculatorBean
      13:32:48,806 INFO [ProxyDeployer] default remote binding has jndiName of com.alblab.ejb3.interfaces.RemoteCalculator
      13:32:48,896 INFO [EJB3Deployer] Deployed: file:/C:/Java/workspace/ejb3_Prj_1/Calculator.ejb3


      Then I tryed to test the stateless session bean with tish client:

      //test client
      import java.util.*;
      import javax.naming.*;
      import com.alblab.ejb3.interfaces.*;
      public class Test {
      
       public static void main(String[] args) {
      
       System.setSecurityManager(new SecurityManager(){
       public void checkPermission(Permission p){}
       });
      
       try {
       Properties tab= new Properties();
       tab.put("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
       tab.put("java.naming.provider.url","localhost:1099");
       tab.put("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces");
       Context ctx = new InitialContext(tab);
       RemoteCalculator cal= (RemoteCalculator) ctx.lookup(RemoteCalculator.class.getName());
       int res=cal.calculate(1,1);
       } catch (NamingException e) {
       e.printStackTrace();
       }
       }
      
      }


      The client succeds in the lookup operation but fails when the method "calculate" is invoked with the stack trace that follows:

      // error: server stack trace

      13:34:25,535 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)


      // error: client stack trace

      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: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.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:65)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
      at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:102)
      at $Proxy0.getServerInfo(Unknown Source)
      at Test.main(Test.java:36)
      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:518)
      at org.jboss.remoting.transport.socket.SocketClientInvoker.getConnection(SocketClientInvoker.java:485)
      at org.jboss.remoting.transport.socket.SocketClientInvoker.transport(SocketClientInvoker.java:263)
      ... 14 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:57)
      at org.jboss.remoting.serialization.impl.java.JavaSerializationManager.createInput(JavaSerializationManager.java:52)
      at org.jboss.remoting.transport.socket.ClientSocketWrapper.createInputStream(ClientSocketWrapper.java:83)
      at org.jboss.remoting.transport.socket.ClientSocketWrapper.createStreams(ClientSocketWrapper.java:76)
      at org.jboss.remoting.transport.socket.ClientSocketWrapper.<init>(ClientSocketWrapper.java:54)
      ... 21 more


      I need help, any Idea?
      Tanks.