4 Replies Latest reply on Jan 28, 2006 11:58 AM by pmn92

    Portal 2.2 - Transaction - CMT

      in portlet configuration I can define a transaction tag:

      <portlet>
       <transaction>
       <trans-attribute>Required</trans-attribute>
       </transaction>
      ...
      


      Does this mean I can consider to be in a CMT environment (JTA Transaction already started) and call
      SessionFactory.getCurrentSession();
      ?


      Philippe

        • 1. Re: Portal 2.2 - Transaction - CMT

          Yes, this will propage but this will propage the portal transaction (i.e the one that the portal uses to load its objects).

          Otherwise you should put RequiresNew

          • 2. Re: Portal 2.2 - Transaction - CMT

            Thanks for the answer.

            Now that I have a choice what should I read to understand what choice to make?

            All portlets in the page should use the same user transaction - at least in my application -, is there any reason I should not use the portal transaction?

            (besides, any good documentation to understand transaction specifics?)

            • 3. Re: Portal 2.2 - Transaction - CMT

              well... it's J2EE :-)

              most of the time the transaction demarcation used in REQUIRED.

              we don't propagate it by default because we assume that the user could start its transaction and that would conflict with the already start portal tx.

              • 4. Re: Portal 2.2 - Transaction - CMT

                It does not seem to be working with 2.0.
                My hibernate service is implemented as a org.hibernate.jmx.HibernateService;




                type Exception report
                
                message
                
                description The server encountered an internal error () that prevented it from fulfilling this request.
                
                exception
                
                javax.servlet.ServletException: Unable to locate current JTA transaction
                 org.jboss.portal.server.servlet.PortalServlet.doGet(PortalServlet.java:214)
                 javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
                 javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
                 org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
                
                root cause
                
                org.hibernate.HibernateException: Unable to locate current JTA transaction
                 org.hibernate.context.JTASessionContext.currentSession(JTASessionContext.java:61)
                 org.hibernate.impl.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:604)
                 org.jboss.portal.core.impl.model.portal.PersistentPortalObjectContainer.getObject(PersistentPortalObjectContainer.java:129)
                 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                 java.lang.reflect.Method.invoke(Method.java:324)
                 org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
                 org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
                 org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:118)
                 org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
                 org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:127)
                 org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
                 org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
                 org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
                 org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
                 $Proxy51.getObject(Unknown Source)
                 org.jboss.portal.core.command.WindowCommand.create(WindowCommand.java:94)
                 org.jboss.portal.core.command.CommandContext.execute(CommandContext.java:81)
                 org.jboss.portal.core.command.CommandContext.chain(CommandContext.java:128)
                 org.jboss.portal.core.command.RenderPageCommand.renderPortlets(RenderPageCommand.java:218)
                 org.jboss.portal.core.command.RenderPageCommand.execute(RenderPageCommand.java:151)
                 org.jboss.portal.core.command.ControllerCommand.dispatch(ControllerCommand.java:65)
                 org.jboss.portal.server.invocation.Invocation.invokeNext(Invocation.java:127)
                 org.jboss.portal.core.aspects.controller.EventBroadcasterInterceptor.invoke(EventBroadcasterInterceptor.java:72)
                 org.jboss.portal.core.command.CommandInterceptor.invoke(CommandInterceptor.java:25)
                 org.jboss.portal.server.invocation.Invocation.invokeNext(Invocation.java:117)
                 org.jboss.portal.core.aspects.controller.PolicyEnforcementInterceptor.invoke(PolicyEnforcementInterceptor.java:156)
                 org.jboss.portal.core.command.CommandInterceptor.invoke(CommandInterceptor.java:25)
                 org.jboss.portal.server.invocation.Invocation.invokeNext(Invocation.java:117)
                 org.jboss.portal.core.aspects.controller.PortalNodeInterceptor.invoke(PortalNodeInterceptor.java:48)
                 org.jboss.portal.core.command.CommandInterceptor.invoke(CommandInterceptor.java:25)
                 org.jboss.portal.server.invocation.Invocation.invokeNext(Invocation.java:117)
                 org.jboss.portal.core.aspects.controller.NavigationInterceptor.invoke(NavigationInterceptor.java:45)
                 org.jboss.portal.core.command.CommandInterceptor.invoke(CommandInterceptor.java:25)
                 org.jboss.portal.server.invocation.Invocation.invokeNext(Invocation.java:117)
                 org.jboss.portal.server.invocation.Invocation.invoke(Invocation.java:162)
                 org.jboss.portal.core.command.CommandContext.execute(CommandContext.java:94)
                 org.jboss.portal.core.command.ExecutionContext.execute(ExecutionContext.java:80)
                 org.jboss.portal.core.command.ExecutionContext.execute(ExecutionContext.java:64)
                 org.jboss.portal.core.CoreController.handle(CoreController.java:177)
                 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                 java.lang.reflect.Method.invoke(Method.java:324)
                 org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
                 org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
                 org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:118)
                 org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
                 org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:127)
                 org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
                 org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
                 org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
                 org.jboss.mx.util.JMXInvocationHandler.invoke(JMXInvocationHandler.java:273)
                 $Proxy138.handle(Unknown Source)
                 org.jboss.portal.server.ServerInvocation.dispatch(ServerInvocation.java:63)
                 org.jboss.portal.server.invocation.Invocation.invokeNext(Invocation.java:127)
                 org.jboss.portal.core.aspects.server.SubjectAssociationInterceptor.invoke(SubjectAssociationInterceptor.java:35)
                 org.jboss.portal.server.ServerInterceptor.invoke(ServerInterceptor.java:25)
                 org.jboss.portal.server.invocation.Invocation.invokeNext(Invocation.java:117)
                 org.jboss.portal.core.aspects.server.PolicyAssociationInterceptor.invoke(PolicyAssociationInterceptor.java:40)
                 org.jboss.portal.server.ServerInterceptor.invoke(ServerInterceptor.java:25)
                 org.jboss.portal.server.invocation.Invocation.invokeNext(Invocation.java:117)
                 org.jboss.portal.server.aspects.server.ContentTypeInterceptor.invoke(ContentTypeInterceptor.java:55)
                 org.jboss.portal.server.ServerInterceptor.invoke(ServerInterceptor.java:25)
                 org.jboss.portal.server.invocation.Invocation.invokeNext(Invocation.java:117)
                 org.jboss.portal.core.aspects.server.LocaleInterceptor.invoke(LocaleInterceptor.java:56)
                 org.jboss.portal.server.ServerInterceptor.invoke(ServerInterceptor.java:25)
                 org.jboss.portal.server.invocation.Invocation.invokeNext(Invocation.java:117)
                 org.jboss.portal.core.aspects.server.UserInterceptor.invoke(UserInterceptor.java:171)
                 org.jboss.portal.server.ServerInterceptor.invoke(ServerInterceptor.java:25)
                 org.jboss.portal.server.invocation.Invocation.invokeNext(Invocation.java:117)
                 org.jboss.portal.server.aspects.server.SessionInvalidatorInterceptor.invoke(SessionInvalidatorInterceptor.java:74)
                 org.jboss.portal.server.ServerInterceptor.invoke(ServerInterceptor.java:25)
                 org.jboss.portal.server.invocation.Invocation.invokeNext(Invocation.java:117)
                 org.jboss.portal.core.aspects.server.TransactionInterceptor.invoke(TransactionInterceptor.java:62)
                 org.jboss.portal.server.ServerInterceptor.invoke(ServerInterceptor.java:25)
                 org.jboss.portal.server.invocation.Invocation.invokeNext(Invocation.java:117)
                 org.jboss.portal.server.invocation.Invocation.invoke(Invocation.java:162)
                 org.jboss.portal.server.servlet.PortalServlet.doGet(PortalServlet.java:208)
                 javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
                 javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
                 org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
                
                note The full stack trace of the root cause is available in the Apache Tomcat/5.5 logs.
                


                Every portlet has the folowing attribute in the jboss-portlet.xml file

                <transaction>
                 <trans-attribute>Required</trans-attribute>
                 </transaction>