11 Replies Latest reply on Jan 6, 2006 8:30 AM by Gavin King

    Seam & Tomcat

    Deniss Parhomenko Newbie

      Hi

      I have My own application that work under tomcat(it's also use Pracle ADF)

      after migration to Seam b2 I receive folowinf exception at save operation

      ERROR [http-8080-Processor24] JTATransaction - Could not find UserTransaction in JNDI
      javax.naming.NameNotFoundException: UserTransaction not bound
       at org.jnp.server.NamingServer.getBinding(NamingServer.java:516)
       at org.jnp.server.NamingServer.getBinding(NamingServer.java:524)
       at org.jnp.server.NamingServer.getObject(NamingServer.java:530)
       at org.jnp.server.NamingServer.lookup(NamingServer.java:282)
       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:610)
       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572)
       at javax.naming.InitialContext.lookup(Unknown Source)
       at org.hibernate.transaction.JTATransaction.<init>(JTATransaction.java:60)
       at org.hibernate.transaction.JTATransactionFactory.createTransaction(JTATransactionFactory.java:53)
       at org.hibernate.jdbc.JDBCContext.getTransaction(JDBCContext.java:185)
       at org.hibernate.impl.SessionImpl.getTransaction(SessionImpl.java:1254)
       at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1261)
       at com.jds.ppd.Utils.addAuditEvent(Utils.java:252)
       at com.jds.ppd.web.jsf.EditObject.audit(EditObject.java:65)
       at com.jds.ppd.web.jsf.EditObject.saveNew(EditObject.java:140)
       at com.jds.ppd.action.freelancer.EditFreelancer$$EnhancerByCGLIB$$4de2cc2b.CGLIB$saveNew$52(<generated>)
       at com.jds.ppd.action.freelancer.EditFreelancer$$EnhancerByCGLIB$$4de2cc2b$$FastClassByCGLIB$$4c5159e7.invoke(<generated>)
       at net.sf.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:167)
       at org.jboss.seam.interceptors.JavaBeanInterceptor$1.proceed(JavaBeanInterceptor.java:86)
       at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:62)
       at org.jboss.seam.interceptors.ValidationInterceptor.validateTargetComponent(ValidationInterceptor.java:43)
       at sun.reflect.GeneratedMethodAccessor62.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
       at java.lang.reflect.Method.invoke(Unknown Source)
       at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
       at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:87)
       at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:66)
       at org.jboss.seam.interceptors.OutcomeInterceptor.interceptOutcome(OutcomeInterceptor.java:21)
       at sun.reflect.GeneratedMethodAccessor61.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
       at java.lang.reflect.Method.invoke(Unknown Source)
       at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
       at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:87)
       at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:66)
       at org.jboss.seam.interceptors.RollbackInterceptor.rollbackIfNecessary(RollbackInterceptor.java:28)
       at sun.reflect.GeneratedMethodAccessor60.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
       at java.lang.reflect.Method.invoke(Unknown Source)
       at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
       at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:87)
       at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:66)
       at org.jboss.seam.interceptors.BijectionInterceptor.bijectTargetComponent(BijectionInterceptor.java:32)
       at sun.reflect.GeneratedMethodAccessor59.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
       at java.lang.reflect.Method.invoke(Unknown Source)
       at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
       at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:87)
       at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:66)
       at org.jboss.seam.interceptors.ConversationInterceptor.endOrBeginLongRunningConversation(ConversationInterceptor.java:58)
       at sun.reflect.GeneratedMethodAccessor58.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
       at java.lang.reflect.Method.invoke(Unknown Source)
       at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
       at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:87)
       at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:66)
       at org.jboss.seam.interceptors.BusinessProcessInterceptor.manageBusinessProcessContext(BusinessProcessInterceptor.java:60)
       at sun.reflect.GeneratedMethodAccessor57.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
       at java.lang.reflect.Method.invoke(Unknown Source)
       at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
       at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:87)
       at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:66)
       at org.jboss.seam.interceptors.RemoveInterceptor.removeIfNecessary(RemoveInterceptor.java:31)
       at sun.reflect.GeneratedMethodAccessor56.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
       at java.lang.reflect.Method.invoke(Unknown Source)
       at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
       at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:87)
       at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:66)
       at org.jboss.seam.ejb.SeamInterceptor.aroundInvoke(SeamInterceptor.java:41)
       at org.jboss.seam.interceptors.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:52)
       at org.jboss.seam.interceptors.JavaBeanInterceptor.intercept(JavaBeanInterceptor.java:40)
       at com.jds.ppd.action.freelancer.EditFreelancer$$EnhancerByCGLIB$$4de2cc2b.saveNew(<generated>)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
       at java.lang.reflect.Method.invoke(Unknown Source)
       at com.sun.el.parser.AstValue.invoke(AstValue.java:130)
       at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:274)
       at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
       at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:69)
       at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:63)
       at oracle.adf.view.faces.component.UIXCommand.broadcast(UIXCommand.java:211)
       at javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:90)
       at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:164)
       at org.apache.myfaces.lifecycle.LifecycleImpl.invokeApplication(LifecycleImpl.java:316)
       at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:86)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:106)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._invokeDoFilter(AdfFacesFilterImpl.java:356)
       at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._doFilterImpl(AdfFacesFilterImpl.java:325)
       at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl.doFilter(AdfFacesFilterImpl.java:190)
       at oracle.adf.view.faces.webapp.AdfFacesFilter.doFilter(AdfFacesFilter.java:87)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:122)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:44)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at com.jds.ppd.UTF8Filter.doFilter(UTF8Filter.java:38)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
       at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
       at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
       at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
       at java.lang.Thread.run(Unknown Source)
      ERROR [http-8080-Processor24] SeamExceptionFilter - uncaught exception handled by Seam
      javax.servlet.ServletException: Error calling action method of component with id _tagId130
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:121)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._invokeDoFilter(AdfFacesFilterImpl.java:356)
       at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._doFilterImpl(AdfFacesFilterImpl.java:325)
       at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl.doFilter(AdfFacesFilterImpl.java:190)
       at oracle.adf.view.faces.webapp.AdfFacesFilter.doFilter(AdfFacesFilter.java:87)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:122)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:44)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at com.jds.ppd.UTF8Filter.doFilter(UTF8Filter.java:38)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
       at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
       at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
       at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
       at java.lang.Thread.run(Unknown Source)



      My Hibernate.cfg (taken from tomcat sample)
       <property name="transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
       <property name="transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
      


        • 1. Re: Seam & Tomcat
          Thomas Heute Master

          You need the seam-jndi.properties file, take a look at the booking example.

          • 2. Re: Seam & Tomcat
            Deniss Parhomenko Newbie

            Hi

            I already has this file in my classpath

            java.naming.factory.initial org.jnp.interfaces.LocalOnlyContextFactory
            java.naming.factory.url.pkgs org.jboss.naming:org.jnp.interfaces
            


            but code that throw this exception is :


             Session session = s.getSessionFactory().openSession();
             Transaction tr = session.beginTransaction();
             try {
             ...
            
             session.save(a);
             tr.commit();
             } catch (Exception ex){
             tr.rollback();
             } finally {
             session.close();
             }
            


            if I comment in hibernate.xml properties that define JBossTransactionManagerLookup , then evrything works

            • 3. Re: Seam & Tomcat
              Gavin King Master

              I know that we currently have an issue with UserTransaction not being bound to JNDI in JBoss embeddable EJB3. This will be fixed in the next release of embeddable EJB3.

              However, we *do* bind it to JNDI when using microcontainer with org.jboss.seam.microcontainer.TransactionManagerFactory.

              So it should work, as long as you have specified the right stuff in seam-jndi.properties.

              Are you starting Hibernate via org.jboss.seam.microcontainer.HibernateFactory or some other way?

              If some other way, you also need these properties in hibernate.cfg.xml or hibernate.properties.

              Do you see in your log that Seam find seam-jndi.properties?

              • 4. Re: Seam & Tomcat
                Deniss Parhomenko Newbie

                After ading to hibernate.cfg evrything is ok

                 <property name="jndi.java.naming.factory.initial">org.jnp.interfaces.NamingContextFactory</property>
                 <property name="jndi.java.naming.factory.url.pkgs">org.jboss.naming:org.jnp.interfaces</property>
                 <property name="jta.UserTransaction">java:comp/UserTransaction</property>
                


                • 5. Re: Seam & Tomcat
                  Gavin King Master

                  Out of curiosity, were you bootstrapping HB via HibernateFactory, or some other way?

                  • 6. Re: Seam & Tomcat
                    Deniss Parhomenko Newbie

                    Same as noEjb sample do it

                    My application are based on noEjb sample for tomcat
                    I only add Oracle ADF support

                    • 7. Re: Seam & Tomcat
                      Gavin King Master

                      That's strange. The noejb example is working without needing this is current CVS.

                      Are you working off of CVS or off of beta 1?

                      • 8. Re: Seam & Tomcat
                        Deniss Parhomenko Newbie

                        I work with latest CVS version, but i have folowing code:



                         Session session = bockingDatabase.getSessionFactory().openSession();
                         Transaction tr = session.beginTransaction();
                         try {
                         ...
                        
                         session.save(a);
                         tr.commit();
                         } catch (Exception ex){
                         tr.rollback();
                         } finally {
                         session.close();
                         }


                        • 9. Re: Seam & Tomcat
                          Gavin King Master

                          Well, it should still work. I think it is not finding seam-jndi.properties.

                          • 10. Re: Seam & Tomcat
                            Deniss Parhomenko Newbie

                            As I see probleam are in UserTransaction JNDI name

                            Hibernate look for UserTransaction, but in Context in binded as java:comp/UserTransaction

                            • 11. Re: Seam & Tomcat
                              Gavin King Master

                              Ohyes, you are right.

                              Shit this is a problem. I have hardcoded "java:comp/UserTransaction" into SeamExceptionFilter and into TransactionManagerFactory.

                              But in fact, "java:comp/UserTransaction" is only truly correct inside the context of a "component" ie. an EJB.

                              Hibernate actually knows this, so Hibernate knows to look for the thing in "UserTransaction" when it is running in a JBoss-like environment. Except in this case, said JBoss-like environment is not really JBoss but actually my hacked-together microcontainer components, with the other value hardcoded.

                              Well, this is actually a bug, since it means Seam transaction-management will actually break in other appservers. So I need a config switch. I'll add it to JIRA.