1 Reply Latest reply on Feb 19, 2013 7:59 AM by Piero Uniti

    "Transaction begin not detected" when trying to persist object in Web Service method

    Piero Uniti Newbie

      Hello,

       

      I have developed a small application for hotel reservations. The method for booking is exported as a webservice but when i try to invoke it i get the following:

       

      Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: java.lang.IllegalStateException: Transaction begin not detected, try installing transaction:ejb-transaction in components.xml

                at com.sun.xml.internal.ws.fault.SOAP11Fault.getProtocolException(Unknown Source)

                at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createException(Unknown Source)

                at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(Unknown Source)

                at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(Unknown Source)

                at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(Unknown Source)

                at $Proxy30.bookRoom(Unknown Source)

      ...

       

      This is my WebService class:

      -------------------------------------------------------------------------------------------------------------------

      @Stateless

      @Name("roomServiceRemote")

      @WebService(name="RoomWS")

      public class RoomServiceRemoteImpl implements RoomServiceRemote {

       

                @In

                private EntityManager entityManager;

      ...

       

      @WebMethod

                public Long bookRoom(Booking booking) {

                               entityManager.persist(booking);

      ...

      -----------------------------------------------------------------------------------------------------------------------

       

      I tried to put <transaction:ejb-transaction> in my components.xml but nothing changed.

       

      I appreciate any help