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

    Problems with EJB3 and JBossWS

      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,
      Giordano

        • 1. Re: Problems with EJB3 and JBossWS
          asoldano

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

          • 2. Re: Problems with EJB3 and JBossWS

            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
            loyersImpl.java:863)
            at org.jboss.deployers.plugins.main.MainDeployerImpl.checkComplete(MainD
            eployerImpl.java:665)
            at org.jboss.system.server.profileservice.hotdeploy.HDScanner.scan(HDSca
            nner.java:293)
            at org.jboss.system.server.profileservice.hotdeploy.HDScanner.run(HDScan
            ner.java:221)
            at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:44
            1)
            at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java
            :317)
            at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
            at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.
            access$101(ScheduledThreadPoolExecutor.java:98)
            at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.
            runPeriodic(ScheduledThreadPoolExecutor.java:181)
            at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.
            run(ScheduledThreadPoolExecutor.java:205)
            at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExec
            utor.java:886)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
            .java:908)
            at java.lang.Thread.run(Thread.java:619)

            • 3. Re: Problems with EJB3 and JBossWS

              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)