1 Reply Latest reply on May 11, 2005 9:00 AM by piero

    error when calling remote method

      the method in the stateless session bean:

      public Iterator findByName(String firstName, String lastName) {
       return manager.createQuery("from Customer c where c.person.firstName = :firstName and c.person.lastName = :lastName")
       .setParameter("firstName", firstName)
       .setParameter("lastName", lastName)
       .getResultList()
       .iterator();
      }
      


      the error:
      Exception in thread "main" java.lang.reflect.UndeclaredThrowableException
       at $Proxy0.findByName(Unknown Source)
       at de.lechner.test.client.Client.main(Client.java:38)
      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:266)
       at org.jboss.remoting.RemoteClientInvoker.invoke(RemoteClientInvoker.java:117)
       at org.jboss.remoting.Client.invoke(Client.java:201)
       at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:39)
      ..
      ..
      ..
      


      the client:
      public class Client
      {
       public static void main(String[] args) throws Exception {
       if (System.getSecurityManager() == null) {
       System.setSecurityManager(new RMISecurityManager());
       }
      
       InitialContext ctx = new InitialContext();
       CustomerDAORemote customerDAO = (CustomerDAORemote) ctx.lookup(CustomerDAORemote.class.getName());
       Customer cust = customerDAO.create();
       cust.getPerson().setFirstName("test");
       cust.getPerson().setLastName("jboss");
       cust.getLoginData().setLogin("blah");
       customerDAO.persist(cust);
       Iterator it = customerDAO.findByName("test","jboss"); // LINE 38: the error
       while (it.hasNext()) {
       cust = (Customer) it.next();
       System.out.println(cust.getId()+
       " "+cust.getPerson().getFirstName()+
       " "+cust.getPerson().getLastName()+
       " "+cust.getLoginData().getLogin());
       }
       }
      }
      



      using jboss 4.0.2 and preview 5
      any ideas? i just cant find the error - it worked when i used the person object directly.