Announcement Announcement Module
Collapse
No announcement yet.
Spring AOP + Quartz + WebSphere issue Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring AOP + Quartz + WebSphere issue

    Hi there,
    We have a bunch of spring beans that we are running under WebSphere 6.1. We are also using AOP for transaction advice, and things are running well. The issue that we do have is with trying to implement a simple scheduling. We have tried quartz as well as java native timer and both with the same result.
    Essentially, we want to use MethodInvokingJobDetailFactoryBean to periodically invoke a method on a bean. As long as that bean does NOT have any transaction advice (and thus does not access a db, but rather just does some println) things work fine. As soon as I wrap the bean into txAdvice so that I may do some db actions as required (or access another bean) I get the following exception:
    org.quartz.core.JobRunShell run Job DEFAULT.synchronizerJobDetail threw a JobExecutionException:
    org.quartz.JobExecutionException: Invocation of method 'doIt' on target class [class hr.combis.comcon.scheduler.Syncer$$EnhancerByCGLIB $$18bdc41d] failed [See nested exception: java.lang.NullPointerException]
    at org.springframework.scheduling.quartz.MethodInvoki ngJobDetailFactoryBean$MethodInvokingJob.executeIn ternal(MethodInvokingJobDetailFactoryBean.java:287 )
    at org.springframework.scheduling.quartz.QuartzJobBea n.execute(QuartzJobBean.java:86)
    at org.quartz.core.JobRunShell.run(JobRunShell.java:2 02)
    at org.springframework.scheduling.commonj.DelegatingW ork.run(DelegatingWork.java:61)
    at com.ibm.ws.asynchbeans.J2EEContext.run(J2EEContext .java:1114)
    at com.ibm.ws.asynchbeans.WorkWithExecutionContextImp l.go(WorkWithExecutionContextImpl.java:195)
    at com.ibm.ws.asynchbeans.CJWorkItemImpl.run(CJWorkIt emImpl.java:187)
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.j ava:1469)
    Caused by: java.lang.NullPointerException
    at com.ibm.ejs.container.EJSContainer.processTxContex tChange(EJSContainer.java:2062)
    at com.ibm.ejs.container.UserTransactionWrapper.begin (UserTransactionWrapper.java:181)
    at org.springframework.transaction.jta.JtaTransaction Manager.doJtaBegin(JtaTransactionManager.java:885)
    at org.springframework.transaction.jta.JtaTransaction Manager.doBegin(JtaTransactionManager.java:842)
    at org.springframework.transaction.support.AbstractPl atformTransactionManager.getTransaction(AbstractPl atformTransactionManager.java:350)
    at org.springframework.transaction.interceptor.Transa ctionAspectSupport.createTransactionIfNecessary(Tr ansactionAspectSupport.java:261)
    at org.springframework.transaction.interceptor.Transa ctionInterceptor.invoke(TransactionInterceptor.jav a:101)
    at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :171)
    at org.springframework.aop.interceptor.ExposeInvocati onInterceptor.invoke(ExposeInvocationInterceptor.j ava:89)
    at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :171)
    at org.springframework.aop.framework.Cglib2AopProxy$D ynamicAdvisedInterceptor.intercept(Cglib2AopProxy. java:631)
    at hr.combis.comcon.scheduler.Syncer$$EnhancerByCGLIB $$18bdc41d.doIt(<generated>)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:79)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:618)
    at org.springframework.util.MethodInvoker.invoke(Meth odInvoker.java:283)
    at org.springframework.scheduling.quartz.MethodInvoki ngJobDetailFactoryBean$MethodInvokingJob.executeIn ternal(MethodInvokingJobDetailFactoryBean.java:272 )
    At first I thought this is because of quartz using it's own thread pool, but I have since added taskExecutor which uses WebSphere threadPool, but that did not result in improvements.

    Here's our spring config relevant to scheduling:
    <bean id="syncer" class="hr.combis.comcon.scheduler.Syncer" parent="baseService">
    <property name="actionManager" ref="actionManagerImpl"/>
    </bean>

    <bean id="synchronizerJobDetail" class="org.springframework.scheduling.quartz.Metho dInvokingJobDetailFactoryBean">
    <property name="targetObject" ref="syncer" />
    <property name="targetMethod" value="doIt" />
    <property name="concurrent" value="false" />
    </bean>

    <bean id="synchronizerTrigger" class="org.springframework.scheduling.quartz.Simpl eTriggerBean">
    <property name="jobDetail" ref="synchronizerJobDetail" />
    <!--10 seconds-->
    <property name="startDelay" value="60000" />
    <!-- repeat every 50 seconds -->
    <property name="repeatInterval" value="50000" />
    </bean>

    <bean class="org.springframework.scheduling.quartz.Sched ulerFactoryBean">
    <property name="triggers">
    <list>
    <ref bean="synchronizerTrigger" />
    </list>
    </property>
    <property name="taskExecutor" ref="taskExecutor"></property>
    </bean>

    <bean id="taskExecutor" class="org.springframework.scheduling.commonj.Work ManagerTaskExecutor">
    <property name="workManagerName" value="wm/default"/>
    <property name="resourceRef" value="false"/>
    </bean>
    And here's our txManager definition:

    <bean id="txManager" class="org.springframework.transaction.jta.JtaTran sactionManager">
    <property name="autodetectTransactionManager" value="false"/>

    </bean>
    Any help is appreciated. Thanks!

  • #2
    Can you

    1. Post your transaction configuration (you only posted your transactionmanager!).
    2. Post the code for your service bean.

    Comment


    • #3
      More data

      My apologies. Here's more info:

      <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSes sionFactoryBean">
      <property name="dataSource" ref="dataSource"/>
      <property name="mappingResources">
      <list>
      ...list of tables here...
      </list>
      </property>
      <property name="hibernateProperties">
      <props>
      <prop key="hibernate.dialect">org.hibernate.dialect.Orac leDialect</prop>
      <prop key="hibernate.show_sql">true</prop>
      <prop key="hibernate.default_schema">some schema</prop>
      <prop key="hibernate.jdbc.use_scrollable_resultset">true </prop>
      <prop key="hibernate.transaction.factory_class">org.hibe rnate.transaction.JTATransactionFactory</prop>
      <prop key="hibernate.transaction.manager_lookup_class">o rg.hibernate.transaction.WebSphereTransactionManag erLookup</prop>
      <prop key="jta.UserTransaction">java:comp/UserTransaction</prop>
      <prop key="hibernate.cache.provider_class">com.opensymph ony.oscache.hibernate.OSCacheProvider</prop>
      <prop key="hibernate.generate_statistics">true</prop>
      <prop key="hibernate.cache.use_structured_entries">true</prop>
      <prop key="hibernate.cache.use_query_cache">true</prop>
      </props>
      </property>
      </bean>

      <jee:jndi-lookup id="dataSource" jndi-name="jdbc/dsname"
      proxy-interface="javax.sql.DataSource" resource-ref="true"/>

      <aop:config>
      <aopointcut id="syncerMethodsPointcut" expression="execution(* example.scheduler.*.*(..))"/>
      <aop:advisor advice-ref="txAdvice" pointcut-ref="syncerMethodsPointcut"/>

      <bean id="baseService" abstract="true" class="example.AbstractTransactionalService">
      <property name="sessionFactory" ref="sessionFactory"/>
      </bean>
      </aop:config>

      <bean id="syncer" class="example.Syncer" parent="baseService">
      </bean>
      The method doIt inside Syncer just does a println. If I remove the pointcut, all is fine, with pointcut, we get the exception listed before.

      Thanks again.

      Comment


      • #4
        At least your transaction manager looks off.. You are mixing hibernate transaction management and the spring transaction management.

        Judging by your stacktrace and configuration the problem is your transaction configuration. You don't specify anything on your bean, you disabled automatic lookup, but don't specify a UserTransaction to use...

        Comment


        • #5
          I am not sure what you mean here. I agree that the problem seems to be a transaction configuration. The problem, however, is only present while running a scheduler. Scheduler inevitably does access the thread pool and that makes it different than the other beans in the system.
          I do not specify anything on the bean as it is but a sample bean, and it does inherit all session info via baseService, like all our other beans.

          Thanks.

          Comment


          • #6
            Code:
            <bean id="txManager" class="org.springframework.transaction.jta.JtaTransactionManager">
              <property name="autodetectTransactionManager" value="false"/>
            </bean>
            No autodetecting but also no explicit configuration so what to use?

            Code:
            <property name="hibernateProperties">
              <props>
                <prop key="hibernate.dialect">org.hibernate.dialect.Orac leDialect</prop>
                <prop key="hibernate.show_sql">true</prop>
                <prop key="hibernate.default_schema">some schema</prop>
                <prop key="hibernate.jdbc.use_scrollable_resultset">true </prop>
                <prop key="hibernate.transaction.factory_class">org.hibe rnate.transaction.JTATransactionFactory</prop>
                <prop key="hibernate.transaction.manager_lookup_class">o rg.hibernate.transaction.WebSphereTransactionManagerLookup</prop>
                <prop key="jta.UserTransaction">java:comp/UserTransaction</prop>
                <prop key="hibernate.cache.provider_class">com.opensymph ony.oscache.hibernate.OSCacheProvider</prop>
                <prop key="hibernate.generate_statistics">true</prop>
                <prop key="hibernate.cache.use_structured_entries">true</prop>
                <prop key="hibernate.cache.use_query_cache">true</prop>
              </props>
            </property>
            Hibernate is accessing the transaction stuff here, not spring...

            Your Syncer, doesn't use hibernate, no transaction, no transaction configuration, no transaction... Error...

            You seem to be using Websphere, change the JtaTransactionManager to WebSphereTransactionManagerFactoryBean and remove the transactional stuff from hibernate. If you are using spring 2.5 you might want to use the WebsphereUowTransactionManager instead.
            Last edited by Marten Deinum; Jan 2nd, 2008, 09:00 AM.

            Comment


            • #7
              Many thanks Marten. Your suggestion worked.

              To recap, the session now looks like this:

              Code:
              <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
              		<property name="dataSource" ref="dataSource"/>
              		<property name="mappingResources">
              			<list>
                                      ...list of tables here...
              			</list>
              		</property>
              		<property name="hibernateProperties">
              			<props>
              				<prop key="hibernate.dialect">org.hibernate.dialect.OracleDialect</prop>
              				<prop key="hibernate.show_sql">true</prop>
              				<prop key="hibernate.default_schema">some schema</prop>
              				<prop key="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</prop>
                         		<prop key="hibernate.transaction.manager_lookup">org.hibernate.transaction.WebSphereExtendedJTATransactionLookup</prop>
              				<prop key="hibernate.cache.provider_class">com.opensymphony.oscache.hibernate.OSCacheProvider</prop>
              				<prop key="hibernate.generate_statistics">true</prop>
              				<prop key="hibernate.cache.use_structured_entries">true</prop>
              				<prop key="hibernate.cache.use_query_cache">true</prop>
              			</props>
              		</property>
              	</bean>
              And the txManager is now:

              Code:
              <bean id="txManager" class="org.springframework.transaction.jta.WebSphereUowTransactionManager">
              		<property name="autodetectTransactionManager" value="false"/>
              	</bean>
              Thanks again.

              Comment


              • #8
                Your welcome. Glad it is working now.

                Comment


                • #9
                  Similar error

                  Hi,

                  We are getting similar problem.

                  We are invoking a spring bean through webservice skeleton and getting the below exception. But when invoking the same spring bean through stateless session EJB the call works fine.

                  Below is the error trace:

                  java.lang.NullPointerException
                  at com.ibm.ws.webservices.engine.WebServicesFault.mak eFault(WebServicesFault.java:281)
                  at com.ibm.ws.webservices.engine.dispatchers.java.Ses sionDispatcher.invoke(SessionDispatcher.java:213)
                  at com.ibm.ws.webservices.engine.PivotHandlerWrapper. invoke(PivotHandlerWrapper.java:227)
                  at com.ibm.ws.webservices.engine.handlers.jaxrpc.JAXR PCHandler.invoke(JAXRPCHandler.java:152)
                  at com.ibm.ws.webservices.engine.handlers.WrappedHand ler.invoke(WrappedHandler.java:64)
                  at com.ibm.ws.webservices.engine.PivotHandlerWrapper. invoke(PivotHandlerWrapper.java:227)
                  at com.ibm.ws.webservices.engine.PivotHandlerWrapper. invoke(PivotHandlerWrapper.java:227)
                  at com.ibm.ws.webservices.engine.WebServicesEngine.in voke(WebServicesEngine.java:336)
                  at com.ibm.ws.webservices.engine.transport.http.WebSe rvicesServlet.doPost(WebServicesServlet.java:761)
                  at javax.servlet.http.HttpServlet.service(HttpServlet .java:763)
                  at com.ibm.ws.webservices.engine.transport.http.WebSe rvicesServletBase.service(WebServicesServletBase.j ava:341)
                  at javax.servlet.http.HttpServlet.service(HttpServlet .java:856)
                  at com.ibm.ws.webcontainer.servlet.ServletWrapper.ser vice(ServletWrapper.java:989)
                  at com.ibm.ws.webcontainer.servlet.ServletWrapper.han dleRequest(ServletWrapper.java:501)
                  at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.h andleRequest(ServletWrapper.java:464)
                  at com.ibm.ws.webcontainer.servlet.CacheServletWrappe r.handleRequest(CacheServletWrapper.java:90)
                  at com.ibm.ws.webcontainer.WebContainer.handleRequest (WebContainer.java:744)
                  at com.ibm.ws.wswebcontainer.WebContainer.handleReque st(WebContainer.java:1455)
                  at com.ibm.ws.webcontainer.channel.WCChannelLink.read y(WCChannelLink.java:113)
                  at com.ibm.ws.http.channel.inbound.impl.HttpInboundLi nk.handleDiscrimination(HttpInboundLink.java:454)
                  at com.ibm.ws.http.channel.inbound.impl.HttpInboundLi nk.handleNewInformation(HttpInboundLink.java:383)
                  at com.ibm.ws.http.channel.inbound.impl.HttpInboundLi nk.ready(HttpInboundLink.java:263)
                  at com.ibm.ws.tcp.channel.impl.NewConnectionInitialRe adCallback.sendToDiscriminators(NewConnectionIniti alReadCallback.java:214)
                  at com.ibm.ws.tcp.channel.impl.NewConnectionInitialRe adCallback.complete(NewConnectionInitialReadCallba ck.java:113)
                  at com.ibm.ws.tcp.channel.impl.AioReadCompletionListe ner.futureCompleted(AioReadCompletionListener.java :165)
                  at com.ibm.io.async.AbstractAsyncFuture.invokeCallbac k(AbstractAsyncFuture.java:217)
                  at com.ibm.io.async.AsyncChannelFuture$1.run(AsyncCha nnelFuture.java:205)
                  at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.j ava:1469)
                  Caused by: java.lang.NullPointerException
                  at com.ibm.ejs.container.EJSContainer.processTxContex tChange(EJSContainer.java:2062)
                  at com.ibm.ejs.container.UserTransactionWrapper.begin (UserTransactionWrapper.java:181)
                  at org.springframework.transaction.jta.JtaTransaction Manager.doJtaBegin(JtaTransactionManager.java:642)
                  at org.springframework.transaction.jta.JtaTransaction Manager.doBegin(JtaTransactionManager.java:600)
                  at org.springframework.transaction.support.AbstractPl atformTransactionManager.getTransaction(AbstractPl atformTransactionManager.java:293)
                  at org.springframework.transaction.interceptor.Transa ctionAspectSupport.createTransactionIfNecessary(Tr ansactionAspectSupport.java:226)
                  at org.springframework.transaction.interceptor.Transa ctionInterceptor.invoke(TransactionInterceptor.jav a:89)
                  at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :169)
                  at org.springframework.aop.framework.JdkDynamicAopPro xy.invoke(JdkDynamicAopProxy.java:169)
                  at $Proxy28.saveReportInitial(Unknown Source)
                  at com.inbound.VidaImpl.createReport(Unknown Source)
                  at namespace.webservice._new.VidaInteractionServiceIm pl.createReportOrTjs(Unknown Source)
                  at sun.reflect.GeneratedMethodAccessor469.invoke(Unkn own Source)
                  at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:43)
                  at java.lang.reflect.Method.invoke(Method.java:618)
                  at com.ibm.ws.webservices.engine.dispatchers.java.Jav aDispatcher.invokeMethod(JavaDispatcher.java:178)
                  at com.ibm.ws.webservices.engine.dispatchers.java.Jav aDispatcher.invokeOperation(JavaDispatcher.java:14 1)
                  at com.ibm.ws.webservices.engine.dispatchers.SoapRPCP rocessor.processRequestResponse(SoapRPCProcessor.j ava:448)
                  at com.ibm.ws.webservices.engine.dispatchers.SoapRPCP rocessor.processMessage(SoapRPCProcessor.java:413)
                  at com.ibm.ws.webservices.engine.dispatchers.BasicDis patcher.processMessage(BasicDispatcher.java:134)
                  at com.ibm.ws.webservices.engine.dispatchers.java.Ses sionDispatcher.invoke(SessionDispatcher.java:204)
                  ... 26 more


                  Below is the minimized version of Spring configuration file entries:

                  <bean id="IVida"
                  class="com.inbound.VidaImpl">
                  <property name="createReportService" ref="iCreateReportService"></property>
                  </bean>

                  <bean id="iCreateReportService"
                  class="com.handlereports.bs.CreateReportServiceImp l">
                  <property name="createReport" ref="iCreateReportDao"></property>
                  </bean>


                  <bean id="autoProxyCreator" class="org.springframework.aop.framework.autoproxy .BeanNameAutoProxyCreator">
                  <property name="interceptorNames">
                  <value>transactionInterceptor</value>
                  </property>
                  <property name="beanNames"><value>*Service</value>
                  </property>
                  </bean>

                  <bean id="transactionAttributeSource" class="org.springframework.transaction.interceptor .MethodMapTransactionAttributeSource">
                  <property name="methodMap">
                  <map>
                  <entry key="com.handlereports.bs.interfaces.CreateReportS ervice.save*"><value>PROPAGATION_REQUIRED,-ResourceException</value></entry>
                  </map>
                  </property>
                  </bean>


                  <bean id="transactionInterceptor" class="org.springframework.transaction.interceptor .TransactionInterceptor">
                  <property name="transactionManager">
                  <ref bean="transactionManager"/>
                  </property>
                  <property name="transactionAttributeSource">
                  <ref bean="transactionAttributeSource"/>
                  </property>
                  </bean>

                  <bean id="wsJtaTm" class="org.springframework.transaction.jta.WebSphe reTransactionManagerFactoryBean" />

                  <bean id="transactionManager" class="org.springframework.transaction.jta.JtaTran sactionManager">
                  <property name="transactionManager" ref="wsJtaTm" />
                  </bean>

                  Any pointers on what might the cause of this will be a big help.
                  Thanks in advance.

                  Comment


                  • #10
                    Well I had the same config, everything was working OK with
                    spring 2.5.2 and hibernate 3.2.6GA (spring commonj websphere 6.1.0.13 UOW tasks) .
                    Moving to spring 2.5.5 and hibernate 3.3.0GA, it cannot seem to find comp/UserTransaction even though the error still seems to be originating from webspheres j2ee context.

                    Anybody out there able to confirm this?

                    Code:
                    [28-8-08 16:29:30:171 CEST] 0000002c javaURLContex E   NMSV0310E: A JNDI operation on a "java:" name cannot be completed because the server runtime is not able to associate the operation's thread with any J2EE application component. This condition can occur when the JNDI client using the "java:" name is not executed on the thread of a server application request. Make sure that a J2EE application does not execute JNDI operations on "java:" names within static code blocks or in threads created by that J2EE application. Such code does not necessarily run on the thread of a server application request and therefore is not supported by JNDI operations on "java:" names. Exception stack trace: 
                    javax.naming.ConfigurationException [Root exception is javax.naming.NameNotFoundException: Name "comp/UserTransaction" not found in context "java:".]
                    	at com.ibm.ws.naming.java.javaURLContextImpl.throwConfigurationExceptionWithDefaultJavaNS(javaURLContextImpl.java:411)
                    	at com.ibm.ws.naming.java.javaURLContextImpl.lookup(javaURLContextImpl.java:388)
                    	at com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:204)
                    	at com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:144)
                    	at javax.naming.InitialContext.lookup(InitialContext.java:363)
                    	at org.hibernate.transaction.JTATransactionFactory.getUserTransaction(JTATransactionFactory.java:162)
                    	at org.hibernate.transaction.JTATransactionFactory.createTransaction(JTATransactionFactory.java:149)
                    	at org.hibernate.jdbc.JDBCContext.registerSynchronizationIfPossible(JDBCContext.java:195)
                    	at org.hibernate.impl.SessionImpl.checkTransactionSynchStatus(SessionImpl.java:1904)
                    	at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:902)
                    	at org.hibernate.impl.SessionImpl.get(SessionImpl.java:842)
                    	at org.springframework.orm.hibernate3.HibernateTemplate$2.doInHibernate(HibernateTemplate.java:547)
                    	at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:419)
                    	at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)
                    	at org.springframework.orm.hibernate3.HibernateTemplate.get(HibernateTemplate.java:541)
                    	at org.springframework.orm.hibernate3.HibernateTemplate.get(HibernateTemplate.java:535)
                    	at mycompany.myexample.model.generated.dao.impl.ProcessTypeBaseDAOImpl.findById(ProcessTypeBaseDAOImpl.java:110)
                    	at mycompany.myexample.notifier.MailNotifierImpl.performNotifications(MailNotifierImpl.java:69)
                    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
                    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                    	at java.lang.reflect.Method.invoke(Method.java:615)
                    	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
                    	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
                    	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
                    	at org.springframework.transaction.interceptor.TransactionInterceptor$1.doInTransaction(TransactionInterceptor.java:128)
                    	at org.springframework.transaction.jta.WebSphereUowTransactionManager$UOWActionAdapter.run(WebSphereUowTransactionManager.java:306)
                    	at com.ibm.ws.uow.UOWManagerImpl.runUnderNewUOW(UOWManagerImpl.java:948)
                    	at com.ibm.ws.uow.UOWManagerImpl.runUnderUOW(UOWManagerImpl.java:509)
                    	at org.springframework.transaction.jta.WebSphereUowTransactionManager.execute(WebSphereUowTransactionManager.java:252)
                    	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:123)
                    	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
                    	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
                    	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
                    	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
                    	at $Proxy144.performNotifications(Unknown Source)
                    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
                    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                    	at java.lang.reflect.Method.invoke(Method.java:615)
                    	at org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:276)
                    	at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal(MethodInvokingJobDetailFactoryBean.java:260)
                    	at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:86)
                    	at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
                    	at org.springframework.scheduling.commonj.DelegatingWork.run(DelegatingWork.java:61)
                    	at com.ibm.ws.asynchbeans.J2EEContext$RunProxy.run(J2EEContext.java:257)
                    	at java.security.AccessController.doPrivileged(AccessController.java:214)
                    	at javax.security.auth.Subject.doAs(Subject.java:495)
                    	at com.ibm.websphere.security.auth.WSSubject.doAs(WSSubject.java:118)
                    	at com.ibm.ws.asynchbeans.J2EEContext$DoAsProxy.run(J2EEContext.java:328)
                    	at java.security.AccessController.doPrivileged(AccessController.java:241)
                    	at com.ibm.ws.asynchbeans.J2EEContext.run(J2EEContext.java:1111)
                    	at com.ibm.ws.asynchbeans.WorkWithExecutionContextImpl.go(WorkWithExecutionContextImpl.java:195)
                    	at com.ibm.ws.asynchbeans.CJWorkItemImpl.run(CJWorkItemImpl.java:187)
                    	at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1469)
                    Caused by: javax.naming.NameNotFoundException: Name "comp/UserTransaction" not found in context "java:".
                    	at com.ibm.ws.naming.ipbase.NameSpace.lookupInternal(NameSpace.java:1095)
                    	at com.ibm.ws.naming.ipbase.NameSpace.lookup(NameSpace.java:991)
                    	at com.ibm.ws.naming.urlbase.UrlContextImpl.lookup(UrlContextImpl.java:1263)
                    	at com.ibm.ws.naming.java.javaURLContextImpl.lookup(javaURLContextImpl.java:384)
                    	... 53 more
                    Last edited by faizal; Aug 29th, 2008, 02:48 AM. Reason: hide real company

                    Comment


                    • #11
                      Can you post your configuration, especially the hibernate one.

                      Comment


                      • #12
                        my config

                        Sure, here is the hibernate part.

                        Code:
                               
                           <jee:jndi-lookup id="datasource" jndi-name="jdbc/datasource"/> 
                         	
                        	<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
                                <property name="dataSource">
                                    <ref local="datasource"/>
                                </property>
                            </bean>
                        
                        	<!-- audit interceptor to set the audit fields-->    
                           	<bean id="auditInterceptor" class="mycompany.myexample.hibernate.AuditInterceptor"/>
                           	
                           	<!-- merge transfer listener that copies the id on newly saved by merge object -->
                           	<bean id="idTransferringMergeEventListener" class="mycompany.myexample.hibernate.IdTransferringMergeEventListener"/>
                        
                        	<!-- Hibernate Template Defintion -->
                        	<bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
                        		<property name="sessionFactory" ref="hibernateSessionFactory" />
                        	</bean>
                        
                        	<bean id="txManager" class="org.springframework.transaction.jta.WebSphereUowTransactionManager"/>
                        
                        	<!-- jta.UserTransaction=java:comp/UserTransaction   -->
                        	<bean id="hibernateSessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
                        		<property name="dataSource" ref="datasource" />
                        		<property name="mappingLocations" value="classpath*:mycompany/myexample/generated/**/*.hbm.xml" />
                        		<property name="hibernateProperties">
                        			<value>
                        				hibernate.dialect=org.hibernate.dialect.Oracle9Dialect
                        				hibernate.cache.provider_class=org.hibernate.cache.EhCacheProvider
                        				hibernate.cache.use_query_cache=true
                        			    hibernate.cache.use_second_level_cache=true
                        				hibernate.transaction.factory_class=org.hibernate.transaction.JTATransactionFactory
                        				hibernate.transaction.manager_lookup_class=org.hibernate.transaction.WebSphereExtendedJTATransactionLookup
                        
                        			</value>
                        		</property>
                        		<property name="entityInterceptor" ref="auditInterceptor"/>
                        		<property name="eventListeners">
                        			<map>
                        				<entry key="merge"><ref local="idTransferringMergeEventListener" /></entry>
                        			</map>
                        		</property>
                        	</bean>
                        
                        	<!-- advice to continue the current transaction -->
                        	<tx:advice id="currentTxAdvice" transaction-manager="txManager">
                        		<tx:attributes>
                        		    <tx:method name="get*" propagation="REQUIRED" read-only="true" rollback-for="java.lang.Throwable"/>
                        			<tx:method name="*" propagation="REQUIRED" rollback-for="java.lang.Throwable"/>
                            	</tx:attributes>
                        	</tx:advice>
                        	
                        	<!--  advice to create a new independent transaction -->
                        	<tx:advice id="newTxAdvice" transaction-manager="txManager">
                        		<tx:attributes>
                        		    <tx:method name="get*" propagation="REQUIRES_NEW" read-only="true" rollback-for="java.lang.Throwable"/>
                        			<tx:method name="*" propagation="REQUIRES_NEW" rollback-for="java.lang.Throwable"/>
                            	</tx:attributes>
                        	</tx:advice>
                        	
                        	<!--  specific advice for the exporter service -->
                        	<tx:advice id="exportTxAdvice" transaction-manager="txManager">
                        		<tx:attributes>
                        			<tx:method name="get*" propagation="REQUIRED" isolation="SERIALIZABLE" read-only="true" rollback-for="java.lang.Throwable"/>
                        			<tx:method name="export*" propagation="REQUIRED" isolation="SERIALIZABLE" read-only="true" rollback-for="java.lang.Throwable"/>
                        			<tx:method name="*" propagation="REQUIRED" rollback-for="java.lang.Throwable"/>
                            	</tx:attributes>
                        	</tx:advice>
                        	
                        	<aop:config>
                                <aop:pointcut id="currentServiceOperation"
                                            expression="execution(* mycompany.myexample.services.HierarchyService.*(..))                    
                        									or execution(* mycompany.myexample.services.ImportDeliveryResultDTO.*(..))
                                            				or execution(* mycompany.myexample.services.ImporterService.*(..))                    				
                                            				or execution(* mycompany.myexample.services.MarketService.*(..))                    				                    				
                                            				or execution(* mycompany.myexample.services.PeriodService.*(..))    
                                            				or execution(* mycompany.myexample.services.SDMService.*(..))                        				
                                            				or execution(* mycompany.myexample.services.UserGroupService.*(..))                            				
                                            				or execution(* mycompany.myexample.services.UserPreferenceService.*(..))                            				                    				
                                            				or execution(* mycompany.myexample.delivery..*.*(..))
                                            				or execution(* mycompany.myexample.notifier.*.*(..)) 
                                            				or execution(* mycompany.myexample.model.dao.*.*(..))"/>
                                            				
                        	 	<aop:pointcut id="newServiceOperation"
                                            expression="execution(* mycompany.myexample.services.ExportHistoryService.*(..))
                                            				or execution(* mycompany.myexample.services.NotificationService.*(..))
                                            				or execution(* mycompany.myexample.services.ProcessInfoService.*(..))"/>
                        
                        	 	<aop:pointcut id="exporterServiceOperation"
                                            expression="execution(* mycompany.myexample.services.ExporterService.*(..))"/>
                                            				
                               	<aop:advisor pointcut-ref="currentServiceOperation" advice-ref="currentTxAdvice"/>
                        	    <aop:advisor pointcut-ref="newServiceOperation" advice-ref="newTxAdvice"/>
                        	    <aop:advisor pointcut-ref="exporterServiceOperation" advice-ref="exportTxAdvice"/>	    
                        
                            </aop:config>
                        and here are the tasks:


                        Code:
                               
                        	<bean id="notifierTask" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
                        		<property name="targetObject" ref="mailNotifier" />
                        		<property name="targetMethod" value="performNotifications" />
                        		<property name="concurrent" value="false" />
                        	</bean>
                        	<bean id="notifierScheduledTask" class="org.springframework.scheduling.quartz.CronTriggerBean">
                        		<property name="jobDetail" ref="notifierTask" />
                        		<property name="cronExpression">
                        			<bean class="mycompany.myexample.util.setting.SettingFactoryBean">
                        				<property name="setting" ref="databaseSetting" />
                        				<property name="settingName" value="crontrigger.notifier" />
                        			</bean>
                        		</property>
                        	</bean>
                        	<bean id="fileSystemDeliveryDetectorTask" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
                        		<property name="targetObject" ref="fileSystemDeliveryDetector" />
                        		<property name="targetMethod" value="detectDelivery" />
                        		<property name="concurrent" value="false" />
                        	</bean> 
                        	<bean id="fileSystemDeliveryDetectorScheduledTask" class="org.springframework.scheduling.quartz.CronTriggerBean">
                        		<property name="jobDetail" ref="fileSystemDeliveryDetectorTask" />
                        		<property name="cronExpression">
                        			<bean class="mycompany.myexample.util.setting.SettingFactoryBean">
                        				<property name="setting" ref="databaseSetting" />
                        				<property name="settingName" value="crontrigger.filedetector" />
                        			</bean>
                        		</property>
                        		
                        	</bean>
                        	<bean id="dailyGmdbJob" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
                        		<property name="targetObject" ref="gmdbReader" />
                          		<property name="targetMethod" value="importDailyData" />
                          		<property name="concurrent" value="false" />
                        	</bean>
                        	<bean id="weeklyGmdbJob" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
                        		<property name="targetObject" ref="gmdbReader" />
                          		<property name="targetMethod" value="importWeeklyData" />
                          		<property name="concurrent" value="false" />
                        	</bean>
                        	<bean id="dailyMarketTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
                        	    <property name="jobDetail" ref="dailyGmdbJob" />
                        		<property name="cronExpression">
                        			<bean class="mycompany.myexample.util.setting.SettingFactoryBean">
                        				<property name="setting" ref="databaseSetting" />
                        				<property name="settingName" value="crontrigger.dailygmdbreader" />
                        			</bean>
                        		</property>
                        	</bean>
                        	<bean id="weeklyMarketTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
                        	    <property name="jobDetail" ref="weeklyGmdbJob" />
                        	    <property name="cronExpression" >
                        	    	<bean class="mycompany.myexample.util.setting.SettingFactoryBean">
                        				<property name="setting" ref="databaseSetting" />
                        				<property name="settingName" value="crontrigger.weeklygmdbreader" />
                        			</bean>
                        	    </property>
                        	</bean>
                        	<bean id="commonjTaskExecutor" class="org.springframework.scheduling.commonj.WorkManagerTaskExecutor" autowire-candidate="false">
                        		<property name="workManagerName" value="DefaultWorkManagerRef"/>
                        		<property name="resourceRef" value="true"/>
                        	</bean>
                        	<bean id="timerFactory" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
                        		<property name="taskExecutor" ref="commonjTaskExecutor"/>
                        		<property name="triggers">
                        			<list>
                        				<ref bean="dailyMarketTrigger" />
                        				<ref bean="weeklyMarketTrigger" />
                        				<ref bean="notifierScheduledTask" />
                        				<ref bean="fileSystemDeliveryDetectorScheduledTask" />
                        			</list>
                        		</property>
                        	</bean>
                        Last edited by faizal; Aug 29th, 2008, 02:51 AM. Reason: .. typo

                        Comment


                        • #13
                          infinite loop

                          I am still looking into this..
                          It gets into infinit loop at around this point:


                          Code:
                          com.ibm.ws.naming.java.javaURLContextImpl.lookup(javaURLContextImpl.java:388)
                          	at com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:204)
                          	at com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:144)
                          	at javax.naming.InitialContext.lookup(InitialContext.java:363)
                          	at org.hibernate.transaction.JTATransactionFactory.getUserTransaction(JTATransactionFactory.java:162)
                          	at org.hibernate.transaction.JTATransactionFactory.getUserTransaction(JTATransactionFactory.java:172)
                          	at org.hibernate.transaction.JTATransactionFactory.getUserTransaction(JTATransactionFactory.java:172)
                          	at org.hibernate.transaction.JTATransactionFactory.getUserTransaction(JTATransactionFactory.java:172)
                          	at org.hibernate.transaction.JTATransactionFactory.getUserTransaction(JTATransactionFactory.java:172)
                          	at org.hibernate.transaction.JTATransactionFactory.getUserTransaction(JTATransactionFactory.java:172)
                          	at org.hibernate.transaction.JTATransactionFactory.getUserTransaction(JTATransactionFactory.java:172)
                          	at org.hibernate.transaction.JTATransactionFactory.getUserTransaction(JTATransactionFactory.java:172)
                          	at org.hibernate.transaction.JTATransactionFactory.getUserTransaction(JTATransactionFactory.java:172)
                          	at org.hibernate.transaction.JTATransactionFactory.getUserTransaction(JTATransactionFactory.java:172)
                          	at org.hibernate.transaction.JTATransactionFactory.getUserTransaction(JTATransactionFactory.java:172)
                          	at org.hibernate.transaction.JTATransactionFactory.getUserTransaction(JTATransactionFactory.java:172)
                          	at org.hibernate.transaction.JTATransactionFactory.getUserTransaction(JTATransactionFactory.java:172)
                          	at org.hibernate.transaction.JTATransactionFactory.getUserTransaction(JTATransactionFactory.java:172)
                          	at org.hibernate.transaction.JTATransactionFactory.getUserTransaction(JTATransactionFactory.java:172)
                          	at org.hibernate.transaction.JTATransactionFactory.getUserTransaction(JTATransactionFactory.java:172)
                          	at org.hibernate.transaction.JTATransactionFactory.getUserTransaction(JTATransactionFactory.java:172)
                          	at org.hibernate.transaction.JTATransactionFactory.getUserTransaction(JTATransactionFactory.java:172)
                          	at org.hibernate.transaction.JTATransactionFactory.getUserTransaction(JTATransactionFactory.java:172)
                          	at org.hibernate.transaction.JTATransactionFactory.getUserTransaction(JTATransactionFactory.java:172)
                          	at org.hibernate.transaction.JTATransactionFactory.getUserTransaction(JTATransactionFactory.java:172)
                          	at org.hibernate.transaction.JTATransactionFactory.getUserTransaction(JTATransactionFactory.java:172)
                          	at org.hibernate.transaction.JTATransactionFactory.getUserTransaction(JTATransactionFactory.java:172)
                          	at org.hibernate.transaction.JTATransactionFactory.getUserTransaction(JTATransactionFactory.java:172)
                          	at org.hibernate.transaction.JTATransactionFactory.createTransaction(JTATransactionFactory.java:149)
                          	at org.hibernate.jdbc.JDBCContext.registerSynchronizationIfPossible(JDBCContext.java:195)
                          	at org.hibernate.impl.SessionImpl.checkTransactionSynchStatus(SessionImpl.java:1904)
                          	at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:902)
                          	at org.hibernate.impl.SessionImpl.get(SessionImpl.java:842)

                          Comment


                          • #14
                            quartz 1.6.0 related

                            This is most probably quartz 1.6.0 related, which I upgraded to from 1.5.2 as it was included with the spring 2.5.5 - with - dependencies - jar.
                            I've seen similar reports about losing the j2ee context.

                            [Edit] swapping quartz 1.6.0 for 1.5.2, 1.5.1, 1.6.1RC3 gives the same issue. Hibernate 3.3.0 SP1 doesn't help either.
                            This leaves spring 2.5.5 or hibernate 3.3.0 to be at fault here.
                            Last edited by faizal; Sep 2nd, 2008, 08:30 AM. Reason: more testing done

                            Comment


                            • #15
                              Actually I guess it never worked properly.
                              As soon as I bring quartz into the equation I cannot gain access to the java:comp namespace. Eventhough commonj is being used through spring.
                              I have dropped a comment asking for explanation at opensymphony.

                              Comment

                              Working...
                              X