0 Replies Latest reply on Jun 29, 2005 3:47 AM by Thomas Roosen

    EJB, Lomboz and collection

    Thomas Roosen Newbie

      Hello everyone.

      I'm using Lomboz for a few time, and I can't get through this problem. I am sure that some people know how to solve it but I didn't manage to find a solution on the net.

      I'm using Eclipse 3.0.1, Lomboz 3.0.1 and JBoss 3.2.1

      The problem I encounter is that when I create an EJB that contains a method that returns a complex type (i.e : a Collection), the method just doesn't work...
      I am using a TestClient created thanks to one of Lomboz's wizards.

      In the TestClient, I only write :

      Collection test = myBean.getListeVentes()

      And when I run the TestClient, "Before" is written, but "After" isn't.

      Moreover, the EJB method I wrote seems to work since I made some System.out.println(...) that appears.
      I made several tests and it appears that when the method return nothing or a simple type (int or String) it works peferctly.

      Here is the code of my class that stands for the business part of my EJB :
      package serviceCommercial;
      import java.sql.ResultSet;
      import java.util.Collection;
      import java.util.HashSet;
      import javax.ejb.SessionBean;
      import odbc.ODBCConnect;
      * <!-- begin-user-doc --> A generated session bean <!-- end-user-doc --> *
      <!-- lomboz.beginDefinition -->
      <?xml version="1.0" encoding="UTF-8"?>
      <lomboz:EJB xmlns:j2ee="http://java.sun.com/xml/ns/j2ee"; xmlns:lomboz="http://lomboz.objectlearn.com/xml/lomboz";>
      <!-- lomboz.endDefinition -->
      * <!-- begin-xdoclet-definition -->
      * @ejb.bean name="Lister"
      * jndi-name="Lister"
      * type="Stateless"
      * transaction-type="Container"
      * This is needed for JOnAS.
      * If you are not using JOnAS you can safely remove the tags below.
      * @jonas.bean ejb-name="Lister"
      * jndi-name="Lister"
      * <!-- end-xdoclet-definition -->
      * @generated
      public abstract class ListerBean implements SessionBean {
      * @ejb.interface-method
      * view-type="remote"
      public Collection getListe(){
      Collection listeVentes = new HashSet();
      //create a connection to the DB
      odbc.ODBCConnect baseServiceComm = new ODBCConnect();
      System.out.println("avant GS");
      ResultSet res = baseServiceComm.ExecuteQ("SELECT * FROM VENTES");
      System.out.println("avant while");
      while (res.next())
      VenteBean uneVente = new VenteBean();
      System.out.println("après boucle");
      System.out.println("taille = " + listeVentes.size());
      catch (Exception e)
      return listeVentes;

      I really don't see what can be wrong...
      The error I get is :

      at $Proxy1.getVenteBean(Unknown Source)
      at serviceCommercial.Test14.testBean(Test14.java:55)
      at serviceCommercial.Test14.main(Test14.java:68)
      Caused by: java.io.NotSerializableException: serviceCommercial.VenteBean
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1054)
      at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:278)
      at java.rmi.MarshalledObject.<init>(MarshalledObject.java:92)
      at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:363)
      at sun.reflect.GeneratedMethodAccessor77.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
      at sun.rmi.transport.Transport$1.run(Transport.java:148)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
      at java.lang.Thread.run(Thread.java:536)
      at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
      at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
      at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:133)
      at org.jboss.invocation.jrmp.server.JRMPInvoker_Stub.invoke(Unknown Source)
      at org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInvokerProxy.java:135)
      at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:87)
      at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:46)
      at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:45)
      at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:100)
      at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:85)
      ... 3 more
      Exception in thread "main"

      Last thing, here is the code of the class "VenteBean.java" I use in my EJB

      * Created on 2 juin 2005
      * TODO To change the template for this generated file go to
      * Window - Preferences - Java - Code Style - Code Templates
      package serviceCommercial;
      import java.io.Serializable;
      * @author Administrateur
      * TODO To change the template for this generated type comment go to
      * Window - Preferences - Java - Code Style - Code Templates
      public class VenteBean implements Serializable{
      private int nVendeur;
      private int trimestre;
      private int annee;
      private int CAHT;
      public VenteBean()
      public void setNVendeur(int _vendeur)
      nVendeur = _vendeur;
      public void setTrimestre(int _trimestre)
      trimestre = _trimestre;
      public void setAnnee(int _annee)
      annee = _annee;
      public void setCAHT(int _CAHT)
      CAHT = _CAHT;
      public int getNVendeur()
      return nVendeur;
      public int getTrimestre()
      return trimestre;
      public int getAnnee()
      return annee;
      public int getCAHT()
      return CAHT;

      Does anybody know how to slove this problem?
      Thanks for helping.