Я развернул WAR-файл, созданный из приложения с пружинной загрузкой 1.5.16, в JBoss версии 6.4.20, но возникают следующие проблемы:
2018-09-27 11:57:00,012 ERROR [org.springframework.scheduling.support.TaskUtils$LoggingErrorHandler] (pool-5-thread-1) Unexpected error occurred in scheduled task.:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager' defined in class path resource
[ch/migrosbank/otv/infrastructure/database/DatabaseConfiguration.class]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/springframework/transaction/jta/UserTransactionAdapter at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1708)
[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:581) [spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:503) [spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317)
[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315)
[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:224)
[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveNamedBean(DefaultListableBeanFactory.java:1015)
[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:339)
[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:334)
[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE] at org.springframework.transaction.interceptor.TransactionAspectSupport.determineTransactionManager(TransactionAspectSupport.java:394)
[spring-tx-5.0.7.RELEASE.jar:5.0.7.RELEASE] at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:284)
[spring-tx-5.0.7.RELEASE.jar:5.0.7.RELEASE] at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:98)
[spring-tx-5.0.7.RELEASE.jar:5.0.7.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
[spring-aop-5.0.7.RELEASE.jar:5.0.7.RELEASE] at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688)
[spring-aop-5.0.7.RELEASE.jar:5.0.7.RELEASE] at ch.migrosbank.otv.infrastructure.job.RemoveNotConfirmedAppointmentsJob$$EnhancerBySpringCGLIB$$5e5892a1.run()
[otv-infrastructure-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT] at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)
[spring-context-5.0.7.RELEASE.jar:5.0.7.RELEASE] at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:93)
[spring-context-5.0.7.RELEASE.jar:5.0.7.RELEASE] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[rt.jar:1.8.0_172] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[rt.jar:1.8.0_172] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
[rt.jar:1.8.0_172] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
[rt.jar:1.8.0_172] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[rt.jar:1.8.0_172] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[rt.jar:1.8.0_172] at java.lang.Thread.run(Thread.java:748)
[rt.jar:1.8.0_172] Caused by: java.lang.NoClassDefFoundError: org/springframework/transaction/jta/UserTransactionAdapter at org.springframework.transaction.jta.JtaTransactionManager.buildUserTransaction(JtaTransactionManager.java:562)
[spring-tx-5.0.7.RELEASE.jar:5.0.7.RELEASE] at org.springframework.transaction.jta.JtaTransactionManager.initUserTransactionAndTransactionManager(JtaTransactionManager.java:488)
[spring-tx-5.0.7.RELEASE.jar:5.0.7.RELEASE] at org.springframework.transaction.jta.JtaTransactionManager.afterPropertiesSet(JtaTransactionManager.java:446)
[spring-tx-5.0.7.RELEASE.jar:5.0.7.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1767)
[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1704)
[spring-beans-5.0.7.RELEASE.jar:5.0.7.RELEASE] ... 24 more
Как описано в документации по загрузочной пружине (https://docs.spring.io/spring-boot/docs/1.5.16.RELEASE/reference/html/boot-features-jta.html#boot-features-jta-javaee) Мне не нужно добавлять никаких зависимостей.
Источник данных и Jta настроены так:
@Configuration
@EnableTransactionManagement
public class DatabaseConfiguration {
@Bean(name = "dataSource")
public DataSource dataSourceForProd(@Value("${datasource.appointment}") final String dataSourceName) {
return new JndiDataSourceLookup().getDataSource(dataSourceName);
}
@Bean(name = "transactionManager")
public PlatformTransactionManager transactionManagerForProd() {
return new JtaTransactionManager();
}
@Bean(name = "namedParameterJdbcTemplate")
public NamedParameterJdbcTemplate namedParameterJdbcTemplate(final DataSource dataSource) {
return new NamedParameterJdbcTemplate(dataSource);
}
}
Есть идеи, что случилось?