3 Replies Latest reply on Jan 14, 2009 7:39 AM by Giordano Vicoli

    Problems with EJB3 and JBossWS

    Giordano Vicoli Newbie

      Hello everybody,
      I have the following problem:

      I developed a simple EJB application using JBoss 5.0.0.GA without any upgrading. The EJB application is made by 2 Entity with oneToMany bidirectional relation. I also developed a SLSB to create, delete, get the entity beans. Due to relation Entity Bean 1 contains a list of Entity Beans 2 and Entity Bean 2 contains a reference to Entity Bean 1.
      I also developed a simple external client. Through this client I call the SLSB to create some Entity Bean 1 and some Entity Beans 2 and the relationships. Thorough the same SLSB I get all Entity Bean 1 (with all the related Entity Bean 2) and I have no problems. Now I exposed all the methods of SLSB as WS and I created another client for WS. With this client I am able to call all methods except the method that get all Entity Bean 1. I have an error due to bidirectional relationship between the Entity Bean 1 and the Entity Bean 2. I modified the relationship from bidirectional to unidirectional and now I am able to call the method get all Entity Bean 1 from WS Client. Is there one able to explain me which is the problem and if I can solve it?

      Thank you very much and bye,

        • 1. Re: Problems with EJB3 and JBossWS
          Alessio Soldano Master

          To better understand, could you please post the exception you're getting please?

          • 2. Re: Problems with EJB3 and JBossWS
            Giordano Vicoli Newbie

            This is an error I have:

            persistence.unit:unitName=#MitServer3PU -> org.hibernate.HibernateException: can
            not simultaneously fetch multiple bags

            <UNKNOWN jboss.j2ee:jar=MitServer3.jar,name=ModelManagerBean,service=EJB3> -> **
            UNRESOLVED Demands 'jndi:HdwmFacade/local-enea.d1.domain.facade.HdwmFacadeLocal
            ' ** | ** UNRESOLVED Demands 'jndi:SettoreFacade/local-enea.d1.domain.facade.Set
            toreFacadeLocal' ** | ** UNRESOLVED Demands 'jndi:SettoreDipendenteFacade/local-
            enea.d1.domain.facade.SettoreDipendenteFacadeLocal' **

            <UNKNOWN jboss.j2ee:jar=MitServer3.jar,name=ModelManagerWebService,service=EJB3>
            -> ** UNRESOLVED Demands 'jndi:ModelManagerBean/remote-enea.d1.test.ModelManage
            rRemote' **

            <UNKNOWN jboss.j2ee:jar=MitServer3.jar,name=SettoreFacade,service=EJB3> -> ** UN
            RESOLVED Demands 'persistence.unit:unitName=#MitServer3PU' **

            <UNKNOWN jboss.j2ee:jar=MitServer3.jar,name=HdwmFacade,service=EJB3> -> ** UNRES
            OLVED Demands 'persistence.unit:unitName=#MitServer3PU' **

            <UNKNOWN jboss.j2ee:jar=MitServer3.jar,name=SettoreDipendenteFacade,service=EJB3
            > -> ** UNRESOLVED Demands 'persistence.unit:unitName=#MitServer3PU' **

            at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(Dep
            at org.jboss.deployers.plugins.main.MainDeployerImpl.checkComplete(MainD
            at org.jboss.system.server.profileservice.hotdeploy.HDScanner.scan(HDSca
            at org.jboss.system.server.profileservice.hotdeploy.HDScanner.run(HDScan
            at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:44
            at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java
            at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
            at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.
            at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.
            at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.
            at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExec
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
            at java.lang.Thread.run(Thread.java:619)

            • 3. Re: Problems with EJB3 and JBossWS
              Giordano Vicoli Newbie

              This is the error I have in the client. Client access to server application via Web service.

              javax.xml.ws.soap.SOAPFaultException: org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: enea.d1.domain.model.SettoreDipendente.listaTempi, no session or session was closed
              at com.sun.xml.internal.ws.fault.SOAP11Fault.getProtocolException(SOAP11Fault.java:171)
              at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:94)
              at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:240)
              at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:210)
              at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:103)
              at $Proxy30.getSettori(Unknown Source)
              at testwsclientmitserver3.Main.getSettori(Main.java:113)
              at testwsclientmitserver3.Main.main(Main.java:44)