5 Replies Latest reply on Oct 13, 2009 4:41 PM by mike jones

    Seam unable to lookup UserTransactin

    mike jones Newbie

      I am using WebSphere 7.0.5.


      I enabled WebSphere tracing and noticing the following in the log


      Caused by: javax.naming.NameNotFoundException: Name comp/UserTransaction not found in context java:.
           at com.ibm.ws.naming.ipbase.NameSpace.lookupInternal(NameSpace.java:1095)



      For some reason on WebSphere 7 the jndi for the user Transaction


      must be something else then comp/UserTransaction.  Does anybody


      know what the correct jndi string is for WebSphere 7 and how I


      can point Seam to the right JNDI string maybe via the


      seam.properties file.

        • 1. Re: Seam unable to lookup UserTransactin
          Denis Forveille Novice

          Mike, here is the full story:


          This problem occurs when a session expire and Seam goes through all the @Destroy annotated methods to call them.


          In this situation, the @Destroy annotated method of the entity manager tries to locate the UserTransaction, sees if there is an active transaction and close it if so.


          I have patched Seam (see JIRA JBSEAM-4332) in order to catch the error and continue the cleaning processing in this case, as the entitymanager will be released anyway with the release of the session, and added a log warn message stating this:


          "could not get transaction while destroying persistence context. (called during session expiration ?)"



          It is committed in Seam 2.2.1-SNAPSHOT


          BUT, even after catching the NamingException, WAS continued to dump a traceback for the exception even if I catch all the exceptions on the invalid lookup.


          I have opened a PMR (33673.077.649) to make them remove those log-filling-but-harmless traces in a future patch. They agreed to do so and it will be included in v7.0.0.9. I also requested an eFix for v7.0.0.5 but I'm still waiting for an answer.


          Then you will hit another WAS bug: WAS doesn't conform to the EJB3.0 specs in the sense that it does not allow to perform a lookup on EJBContext in @PrePassivate annotated methods (or any other callback methods)!!


          I have opened another PMR (33753.077.649) as the specs require this (section 12.2 Interceptor Life Cycle). They agreed on the problem and they are working on it.


          You'll see the error when an SFSB expires: WAS starts a thread to do the job and call the @PrePassivate annotated method as the specs require it.


          This one is a major WAS bug indeed but I don't know exactly the consequence on the application as all our apps seem to work correctly. Will the SFSB stay in memory forever? didn't observed that. Are some important internal cleaning process not done in WAS because of this? don't know for sure. Until now, for us, the only effects we've seen is that is fills our logs...(You can search the forum for more detailed info on this one)

          • 2. Re: Seam unable to lookup UserTransactin
            mike jones Newbie
            Thanks.

            I have a question.  I am really getting confused between

            Seam Global Transactions and Container Managed Transactions.

            I think alot of developers are confused based on the

            post I have read.

            I am currently using both Seam Global Transactions and CMT is this ok?

            My setup is that I have Seam Global Transactions enabled.

            I also add the the interceptors SeamInteceptor.

            I also add the following to my components.xml

            <transaction:ejb-transaction/>

            First Question is this the correct configuration to integrate

            Container Managed transactions with Seam? Is there anything

            else I need to configure?  I also have Seam Global Transactios

            enabled.

            Second questions is it ok to have Seam Global Transactions

            and Container Managed transactions?

            Meaning if you use CMT do you have to disable Seam Global

            Transctions.

            I have read alot post and see mixed feedback.

            Many developers are confused over how Seam Global Transactions

            and Container Managed Transactions interact.

            Some state you should not use Seam Global Transactions with

            Container Managed Transactions. 

            If this is the case what is the proper way

            to integrate Container Managed Transactions.

            Basically I want to integrate Container Managed Transactions and

            what to know the right steps to ensure I have everything

            configured correctly.  I have gone through the Seam

            documentation inside and out.  I have gone through the

            seam_reference document and the Seam in Action book.

            Both state to enable Container Managed Transactions

            I need to include inteceptors and


            <transaction:ejb-transaction/>

            to the component.xml.  They make no mention of having

            to disable Seam Global Transactions.  Its my understanding

            they can co-exist.


            I have another topic I posted and I still have not gotten

            a reply.  I am really really surprised by this.

            Can you search on

            "No Active Conversation Context Error - Seam 2.2.0"

            in the forum and provide me with assistance.

            Its a big issue.
            • 3. Re: Seam unable to lookup UserTransactin
              Denis Forveille Novice

              It seems you have many different problems.


              Are you using seam v2.2.1-SNAPSHOT? If not, you should download it here and read the chapter on how to use seam with WAS v7 (I've completely rewritten the chapter for v2.2.1) in the pdf that comes with the download  and try to build/deploy the sample app as described in the doc and start from here, then compare you're own code and configuration with the ear file produces by the ant build.


              After being build with ant, the jee5/sample app works OOTB with WAS v7.0.0.5, with the exclusion of the 2 harmless  problems described in my previous post (? still to be confirmed for the second).

              • 4. Re: Seam unable to lookup UserTransactin
                mike jones Newbie
                Ok,

                I also opened a PMR with IBM on the UserTransaction issue.

                Thanks for the quick response.  I will try downloading 2.2.1

                snapshot and getting sample app to work.

                We are starting a new project and I want to use Seam by all

                means.  I will be a good test candidated for WAS 7.0.5.

                Seam is the best web integration framework but I just

                need to work through some of these issues WAS 7 issues.

                The No Conversation Context error is strange.

                I have simply back and next buttons which are basic

                Seam UI buttons.  I click for one page to the next

                and back to previous page it works no problem.

                Then all of the sudden it stops working and I get the

                No Conversation Context Error.  One thing to note is

                that when I use a regular JSF Command Buttons I do not get the

                No Conversation Context error and everything works.

                One thing is that I do have the SeamRedirectFilter enabled.

                I am using the SeamRedirectFilter in conjuction with a

                Seam UI Component.

                Not sure if the

                I am trying to get an understanding of how conversation

                and propagation works.

                1. If you use the SeamRedirectServlet do you still have

                to use Seam UI components to propagate the conversation id?

                What happens if you use a regular JSF Command button with

                the SeamRedirectServlet will the conversation still get

                propagated.

                Can you provide the approaches to propagate conversatons

                in Seam?

                The documentation is really unclear on this.

                I have gone through the entire seam_reference and SeamInAction

                book.

                Also when I enable Seam debugging in WAS 7.0.5 I can no longer

                access any page in my application. When I access a page it redirects

                to the Seam debug page.  This happens for any page I access in my

                application.

                I tried enabling Seam debugging via components.xml and web.xml

                same thing happens.  When I access any page in my application

                it redirects to the Seam debug page.  As a result, I cannot debug

                my application.

                Any ideas why this is happening?
                • 5. Re: Seam unable to lookup UserTransactin
                  mike jones Newbie

                  I was able to resolve the No Conversation Context error.
                  I was not aware but the jboss-seam.jar includes a faces-config.xml which adds the SeamPhaseListener.
                  I have a separate faces-config.xml for my application and also
                  add the SeamPhaseListener so it was getting added twice.
                  Somehow this was causing the No Conversation Context error.
                  I removed the phase listener from the faces-config.xml from
                  my application and everything is working.
                  I think this should be added to the Seam documentation somewhere
                  the fact that the SeamPhaseListener has already been added
                  to the jboss-seam.jar and developers don't need to add it
                  to the faces-config.xml that is used by their application because
                  it appears to cause strange behavior.