<bean id="transactionManager"
class="org.springframework.transaction.jta.WebLogicJtaTransactionManager">
</bean>
Weblogic启动报错:org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager' defined in URL [bundleentry://169.fwk1838762963/config/persistence.xml]: Invocation of init method failed;nested exception is
org.springframework.transaction.TransactionSystemException: Could not initialize WebLogicJtaTransactionManager because WebLogic API classes are not available; nested exception is java.lang.ClassNotFoundException: weblogic.transaction.TransactionHelper
错误原因:无法正常加载weblogic API里的类weblogic.transaction.TransactionHelper。
我们是基于OSGi的,所以解决方法是修改模块依赖:WebContent/WEB-INF/configuration/compatible/weblogic 文件修改为:(红色是关键)
Import-Package=&database#dbdrivers
Export-Package=weblogic.jndi,weblogic.jndi.internal,weblogic.xml.jaxp,weblogic.jdbc.vendor.oracle,weblogic.transaction,weblogic.transaction.internal,javax.jms,javax.transaction;version="1.2.0",javax.transaction.xa;version="1.2.0"
dm-need-import-package=&Export-Package
如果你也遇到这个问题,建议你检查你的类加载和依赖相关的内容。