3 Replies Latest reply on Nov 4, 2005 10:56 AM by kidjava

    Marshall / Unmarshall problem or EOF

    kidjava

      I have a java client with the following main method:

      public static void main(String[] args) {

      try {

      Context context = new InitialContext();
      t = ( Test ) context.lookup(Test.class.getName() );
      t2 = ( Test2 ) context.lookup( Test2.class.getName() );
      rm = ( RecordManager ) context.lookup( RecordManager.class.getName() );
      } catch ( NamingException e ) {

      e.printStackTrace();
      }

      System.out.println( t.callMe() );
      System.out.println( "3 + 5 = " + t.addCalc( 3, 5 ) );
      System.out.println( t2.callMe() );
      System.out.println( "3 * 5 = " + t2.calcMult( 3, 5 ) );
      System.out.println( rm.getSomeRecords() );
      System.out.println( "Calling get100Records . . . " );

      for ( SkidEntity skid : rm.get100Records() )
      {
      System.out.println( skid.getSkidId() );
      }
      }

      I have an EntityBean and Stateless Session Bean. The get100Records method is:

      public List< SkidEntity > get100Records() {

      ArrayList arrayList = new ArrayList();
      Query q = em.createQuery( "from SkidEntity" );
      for( Object o : q.getResultList() ) { arrayList.add( ( SkidEntity ) o ); };
      return arrayList;
      }

      If the body of the for loop is empty is works. If it is as is I get:

      You called TestBean.callMe().
      3 + 5 = 8
      You called Test2Bean.callMe.
      3 * 5 = 15
      RecordManagerBean.getSomeRecords - Under Construction
      Calling get100Records . . .
      Exception in thread "main" java.lang.reflect.UndeclaredThrowableException
      at $Proxy2.get100Records(Unknown Source)
      at src.client.TestClient.main(TestClient.java:41)
      Caused by: java.rmi.ConnectException: Failed to communicate. Problem during marshalling/unmarshalling; nested exception is:
      java.io.EOFException
      at org.jboss.remoting.transport.socket.SocketClientInvoker.transport(SocketClientInvoker.java:264)
      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)
      ... 2 more
      Caused by: java.io.EOFException
      at java.io.ObjectInputStream$BlockDataInputStream.peekByte(ObjectInputStream.java:2502)
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1267)
      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
      at org.jboss.remoting.marshal.serializable.SerializableUnMarshaller.read(SerializableUnMarshaller.java:73)
      at org.jboss.remoting.transport.socket.SocketClientInvoker.transport(SocketClientInvoker.java:242)
      ... 14 more

      I don't know how to solve this, can anyone help.