5 Replies Latest reply on May 18, 2006 9:45 AM by marklittle

    distributed tx between a pojo app and an ejb

      I want to maintain the same transaction in an Pojo application and an ejb, both are accessing the same xml file. Can you please guide me in detail how can I do this using JBOSSTS? If possible please send me some sample code.

        • 1. Re: distributed tx between a pojo app and an ejb
          marklittle

           

          "master_yoda" wrote:
          I want to maintain the same transaction in an Pojo application and an ejb, both are accessing the same xml file. Can you please guide me in detail how can I do this using JBOSSTS? If possible please send me some sample code.


          Are they both in the same JBossAS instance?

          BTW, we don't have any code for this specific case, so you'll have to produce it yourself, but we'll try and help you through the steps.

          • 2. Re: distributed tx between a pojo app and an ejb

            Thnaks for your reply.

            I want to use standalone JbossTS for POJO app and JbossTS as tx manager in Jboss AS for ejb. I'm not able to get how the two app maintain the same tx? how they convey one tx to another? can you plz give me the steps?

            • 3. Re: distributed tx between a pojo app and an ejb

              Hi,
              If it is easy to use the same JbossAS instance then we'll go for that. Please explain the the steps for this scenario also.

              • 4. Re: distributed tx between a pojo app and an ejb

                Hi,
                I was waiting for your reply.
                Meanwhile I have seen something related to iiop-jboss thing and that iiop invocation configuration in ejb. Do I have to do IIOP invocation in ejb.please help, I'm not an expert, I've to study the things :((

                • 5. Re: distributed tx between a pojo app and an ejb
                  marklittle

                  In your POJO application, if a thread starts a transaction (via UserTransaction) then it will be associated with that transaction. All invocations it makes on local objects that are handled by that same thread will implicitly have the context propagated to them: you don't need to do anything.

                  If the thread that does the work on your EJB isn't the same one that started the transaction (which it won't be in the distributed case), then you need to make sure it knows about the transaction. In JTS, this happens via IIOP, where we have a set of interceptors at the client (sender) and server (receiver). The context is added to the clients invocation by the interceptor when it makes the call and stripped off the invocation by the server interceptor when it receives the call.

                  Obviously with EJB you'd need to make sure you set up the deployment right: you don't want the container starting a new transaction when the invocation happens; rather you want it to use the transaction you sent.