WebSphere中的Spring应用程序。 JMS消息侦听器调用程序的设置失败

时间:2017-06-08 14:45:26

标签: java spring jms websphere

我在WebSphere容器中有一个spring应用程序,我需要配置JMS,但是我遇到了问题。发送消息的工作正常,但MessageListener不使用消息。

这是我的jms配置:

@Bean
public PlatformTransactionManager transactionManager() {
    return new WebSphereUowTransactionManager();
}

@Bean
public ConnectionFactory jmsConnectionFactory() throws NamingException {
    return jndi().lookup(CONNECTION_FACTORY_ADDRESS, ConnectionFactory.class);
}

@Bean(name = "queue")
public Queue jmsQueue() throws NamingException {
    return jndi().lookup(QUEUE_ADDRESS, Queue.class);
}

@Bean(name = "replyQueue")
public Queue jmsReplyQueue() throws NamingException {
    return jndi().lookup(REPLY_QUEUE_ADDRESS, Queue.class);
}

@Bean
public DestinationResolver jmsDestinationResolver() {
    return new JndiDestinationResolver();
}

@Bean
public DefaultJmsListenerContainerFactory jmsListenerContainerFactory() throws NamingException {
    final DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
    factory.setConnectionFactory(jmsConnectionFactory());
    factory.setDestinationResolver(jmsDestinationResolver());
    factory.setTransactionManager(transactionManager());
    factory.setSessionTransacted(true);
    factory.setConcurrency("3-10");
    factory.setTaskExecutor(threadPoolTaskExecutor());
    return factory;
}

@Bean
public TaskExecutor threadPoolTaskExecutor() {
    ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
    executor.setCorePoolSize(5);
    executor.setMaxPoolSize(10);
    executor.setQueueCapacity(50);
    executor.setKeepAliveSeconds(20);

    return executor;
}

我在启动时遇到此异常:

[08.06.17 18:23:38:765 MSK] 00000409 DefaultMessag W org.springframework.jms.listener.DefaultMessageListenerContainer handleListenerSetupFailure Setup of JMS message listener invoker failed for destination 'jms/test_queue' - trying to recover. Cause: No JTA UserTransaction available - programmatic PlatformTransactionManager.getTransaction usage not supported

我读到它可能是与hibernate传递依赖冲突的原因。我试图从hibernate-core中排除jboss-transaction-api_1.1_spec依赖,但它没有帮助。

我也尝试过使用WorkManagerTaskExecutor:

@Bean
public TaskExecutor taskExecutor() {
    WorkManagerTaskExecutor executor = new WorkManagerTaskExecutor();
    executor.setWorkManagerName("wm/default");
    return executor;
}

但例外情况仍然存在。

可能是什么问题?

0 个答案:

没有答案