Spring's WebSphereUowTransactionManager & 'application class loader first'

用户在使用 Spring 的 WebSphereUowTransactionManager 类时遇到问题,在更改类加载策略后出现 java.lang.VerifyError 异常。通过调整配置及移除冲突的 JAR 文件,最终解决了该问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

In my application, I am using Spring's (version 2.5) WebSphere specific PlatformTransactionManager class. The full class name is: org.springframework.transaction.jta.WebSphereUowTransactionManager

My spring bean xml file contains the following:

+<!-- Transaction Manager when using JNDI datasource --> +
+ <bean id="transactionManager" class="org.springframework.transaction.jta.WebSphereUowTransactionManager"/> +

+ <!-- enable the configuration of transactional behavior based on annotations -->+
+ <tx:annotation-driven transaction-manager="transactionManager"/>+

When I deploy my application on WebSphere 6.1 all works well. However, when I change the class loading policy from the default '+classes loaded by parent class loader first+' to '+classes loaded by application class loader first+', I run into java.lang.VerifyError: com/ibm/websphere/uow/UOWSynchronizationRegistry.registerInterposedSynchronizat ion(Ljavax/transaction/Synchronization;)

The full exception trace is shown below:

8/08 17:19:38:953 EDT] 00000028 WebApp E Exception caught while initializing context
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pro.core.deployment_catalog' defined in class path resource http://ca/pro/ui/spring/spring-b ase.xml: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class http: //ca.pro.service.internal.impl.DatabaseXmlDeploymentCatalogue: Constructor threw exception; nested exception is org.springframework.transaction.TransactionSystemException: UOWManager transaction processing failed; nested exception is com.ibm.wsspi.uow.UOWException: java.lang.VerifyError: com/ibm/websphere/uow/UOWSynchronizationRegistry.registerInterposedSynchronizat ion(Ljavax/transaction/Synchronization;)V
+ at org.springframework.beans.factory.support.ConstructorResolver.autowireConstruct or(ConstructorResolver.java:243)+
+ at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.au towireConstructor(AbstractAutowireCapableBeanFactory.java:923)+
+ at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.cr eateBeanInstance(AbstractAutowireCapableBeanFactory.java:833)+
+ at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.do CreateBean(AbstractAutowireCapableBeanFactory.java:440)+
+ at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1. run(AbstractAutowireCapableBeanFactory.java:409)+
+ at java.security.AccessController.doPrivileged(AccessController.java:214)+
+ at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.cr eateBean(AbstractAutowireCapableBeanFactory.java:380)+
+ at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(Abstr actBeanFactory.java:264)+
+ at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingl eton(DefaultSingletonBeanRegistry.java:217)+
+ at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(Abstrac tBeanFactory.java:261)+
+ at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractB eanFactory.java:185)+
+ at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractB eanFactory.java:164)+
+ at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstant iateSingletons(DefaultListableBeanFactory.java:429)+
+ at org.springframework.context.support.AbstractApplicationContext.finishBeanFactor yInitialization(AbstractApplicationContext.java:729)+
+ at org.springframework.context.support.AbstractApplicationContext.refresh(Abstract ApplicationContext.java:381)+
+ at org.springframework.web.context.ContextLoader.createWebApplicationContext(Conte xtLoader.java:255)+
+ at org.springframework.web.context.ContextLoader.initWebApplicationContext(Context Loader.java:199)+
+ at org.springframework.web.context.ContextLoaderListener.contextInitialized(Contex tLoaderListener.java:45)+
+ at com.ibm.ws.wswebcontainer.webapp.WebApp.notifyServletContextCreated(WebApp.java :645)+
+ at com.ibm.ws.webcontainer.webapp.WebApp.commonInitializationFinish(WebApp.java:31 1)+
+ at com.ibm.ws.wswebcontainer.webapp.WebApp.initialize(WebApp.java:290)+
+ ...+
+ at com.ibm.ws.management.connector.soap.SOAPConnection.handleRequest(SOAPConnectio n.java:55)+
+ at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:680)+
+ at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:484)+
+ at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1473)+
Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class http: //ca.pro.service.internal.impl.DatabaseXmlDeploymentCatalogue: Constructor threw exception; nested exception is org.springframework.transaction.TransactionSystemException: UOWManager transaction processing failed; nested exception is com.ibm.wsspi.uow.UOWException: java.lang.VerifyError: com/ibm/websphere/uow/UOWSynchronizationRegistry.registerInterposedSynchronizat ion(Ljavax/transaction/Synchronization;)V
+ at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:99)+
+ at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantia te(SimpleInstantiationStrategy.java:87)+
+ at org.springframework.beans.factory.support.ConstructorResolver.autowireConstruct or(ConstructorResolver.java:237)+
+ ... 65 more+
Caused by: org.springframework.transaction.TransactionSystemException: UOWManager transaction processing failed; nested exception is com.ibm.wsspi.uow.UOWException: java.lang.VerifyError: com/ibm/websphere/uow/UOWSynchronizationRegistry.registerInterposedSynchronizat ion(Ljavax/transaction/Synchronization;)V
+ at org.springframework.transaction.jta.WebSphereUowTransactionManager.execute(WebS phereUowTransactionManager.java:259)+
+ at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(Trans actionInterceptor.java:123)+
+ at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Reflective MethodInvocation.java:171)+
+ at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy. java:204)+
+ at $Proxy77.getOrganizations(Unknown Source)+
+ at ca.pro.service.internal.impl.DatabaseXmlDeploymentCatalogue.<init>(DatabaseXmlD eploymentCatalogue.java:66)+
+ at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)+
+ at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessor Impl.java:67)+
+ at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructor AccessorImpl.java:45)+
+ at java.lang.reflect.Constructor.newInstance(Constructor.java:521)+
+ at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:84)+
+ ... 67 more+
Caused by: com.ibm.wsspi.uow.UOWException: java.lang.VerifyError: com/ibm/websphere/uow/UOWSynchronizationRegistry.registerInterposedSynchronizat ion(Ljavax/transaction/Synchronization;)V
+ at com.ibm.ws.uow.UOWManagerImpl.runUnderNewUOW(UOWManagerImpl.java:969)+
+ at com.ibm.ws.uow.UOWManagerImpl.runUnderUOW(UOWManagerImpl.java:509)+
+ at org.springframework.transaction.jta.WebSphereUowTransactionManager.execute(WebS phereUowTransactionManager.java:252)+
+ ... 77 more+
Caused by: java.lang.VerifyError: com/ibm/websphere/uow/UOWSynchronizationRegistry.registerInterposedSynchronizat ion(Ljavax/transaction/Synchronization;)V
+ at org.springframework.transaction.jta.WebSphereUowTransactionManager$UOWActionAda pter.run(WebSphereUowTransactionManager.java:320)+
+ at com.ibm.ws.uow.UOWManagerImpl.runUnderNewUOW(UOWManagerImpl.java:948)+
+ ... 79 more+

tsc

Posts: 9
Registered: Jul 11, 2008 06:08:20 PM
Re: Spring's WebSphereUowTransactionManager & 'application class loader fir
Posted: Jul 29, 2008 03:10:48 PM in response to: tsc in response to: tsc's post
I realized that the spring configuration in my previous post was not displayed correctly. So here it is again.

My spring beans xml file contains the following:

.....

<!-- enable the configuration of transactional behavior based on annotations -->
<tx:annotation-driven transaction-manager="transactionManager"/>

<!-- Transaction Manager when using JNDI datasource -->
<bean id="transactionManager" class="org.springframework.transaction.jta.WebSphereUowTransactionManager"/>

thanks,
tsc

Posts: 9
Registered: Jul 11, 2008 06:08:20 PM
Re: Spring's WebSphereUowTransactionManager & 'application class loader fir
Posted: Jul 29, 2008 03:11:10 PM in response to: tsc in response to: tsc's post
I realized that the spring configuration in my previous post was not displayed correctly. So here it is again.

My spring beans xml file contains the following:

.....

<tx:annotation-driven transaction-manager="transactionManager"/>

<bean id="transactionManager" class="org.springframework.transaction.jta.WebSphereUowTransactionManager"/>

thanks,
tsc

Posts: 9
Registered: Jul 11, 2008 06:08:20 PM
Re: Spring's WebSphereUowTransactionManager & 'application class loader fir
Posted: Jul 29, 2008 03:14:12 PM in response to: tsc in response to: tsc's post
Apologies for the previous posts. In the preview tab, all seems to be ok but when I post the message, I noticed that the characters were replayed with plus symbols.

Once last time, I'll try it again. I have removed the angle brackets just in case.

My spring beans xml file contains the following:

.....

tx:annotation-driven transaction-manager="transactionManager"

bean id="transactionManager" class="org.springframework.transaction.jta.WebSphereUowTransactionManager"

thanks,
Erik-Berndt.Sch...

Posts: 3
Registered: Jan 19, 2005 07:12:25 AM
Re: Spring's WebSphereUowTransactionManager & 'application class loader first'
Posted: Sep 03, 2008 05:32:19 AM in response to: tsc in response to: tsc's post
Hi,

The fact that you have to change the classloader strategy to application-first is a good hint towards the solution. Most probably you have a jar in your ear / war that is causing the conflict.
I had the same problem and it was caused by jta.jar (1.1 in my case) in the ear file.

Regards,
Erik-Berndt
LockDog

Posts: 10
Registered: Apr 01, 2009 12:13:58 PM
Re: Spring's WebSphereUowTransactionManager & 'application class loader first'
Posted: Dec 30, 2009 09:57:43 AM in response to: Erik-Berndt.Scheper in response to: Erik-Berndt.Scheper's post
Hello.
We have the same problem.:confused:

[B]Websphere Application Server 7.0.3 (2-cells cluster)
Spring 2.5.6[/B]

CODE<tx:jta-transaction-manager/>[/CODE]
CODE
<property name="hibernate.transaction.manager_lookup_class"
value="org.hibernate.transaction.WebSphereExtendedJTATransactionLookup"/>[/CODE]

ear application hasn't libraries
all libraries are placed in shared library with isolated classloader

there are many shared libraries except our, but they are isolated too, and they don't used in our application

QUOTE[I] 12/30/09 14:58:01:987 EET 00000071 LoggingHandle E org.springframework.integration.handler.LoggingHandler handleMessageInternal org.springframework.transaction.TransactionSystemException: UOWManager transaction processing failed; nested exception is com.ibm.wsspi.uow.UOWException: java.lang.VerifyError: com/ibm/websphere/uow/UOWSynchronizationRegistry.registerInterposedSynchronization(Ljavax/transaction/Synchronization;)V
at org.springframework.transaction.jta.WebSphereUowTransactionManager.execute(WebSphereUowTransactionManager.java:259)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:122)
at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller.innerPoll(AbstractPollingEndpoint.java:226)
at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller.poll(AbstractPollingEndpoint.java:216)
at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller.run(AbstractPollingEndpoint.java:209)
at org.springframework.integration.scheduling.SimpleTaskScheduler$ErrorHandlingRunnableWrapper.run(SimpleTaskScheduler.java:307)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:452)
at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:328)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:161)
at org.springframework.integration.scheduling.SimpleTaskScheduler$TriggeredTask.run(SimpleTaskScheduler.java:256)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:896)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:735)
Caused by: com.ibm.wsspi.uow.UOWException: java.lang.VerifyError: com/ibm/websphere/uow/UOWSynchronizationRegistry.registerInterposedSynchronization(Ljavax/transaction/Synchronization;)V
at com.ibm.ws.uow.UOWManagerImpl.runUnderNewUOW(UOWManagerImpl.java:1086)
at com.ibm.ws.uow.UOWManagerImpl.runUnderUOW(UOWManagerImpl.java:626)
at org.springframework.transaction.jta.WebSphereUowTransactionManager.execute(WebSphereUowTransactionManager.java:252)
... 12 more
Caused by: java.lang.VerifyError: com/ibm/websphere/uow/UOWSynchronizationRegistry.registerInterposedSynchronization(Ljavax/transaction/Synchronization;)V
at org.springframework.transaction.jta.WebSphereUowTransactionManager$UOWActionAdapter.run(WebSphereUowTransactionManager.java:320)
at com.ibm.ws.uow.UOWManagerImpl.runUnderNewUOW(UOWManagerImpl.java:1065)
... 14 more[/I][/QUOTE]

320 string is
CODEuowManager.registerInterposedSynchronization(new JtaAfterCompletionSynchronization(synchronizations));[/CODE]

I changed different configurations with classloaders, but there is no solution.
Help please


I need to update the class loading policy to application-first due to the an issue with Commons logging.

Any help is much appreciated!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值