Ошибка при использовании IBM WAS ConnectionFactory и Spring

Я пытаюсь сделать простое приложение WAS/Spring/JMS. Я получаю фабрику соединений и место назначения для JMS из WAS, используя JNDI. Я пытаюсь использовать эти объекты с Spring JMS, но я не могу правильно выполнить приведение. Я попытался привести фабрику соединений к javax.jms.ConnectionFactory и javax.jms.QueueConnectionFactory. Должен ли я использовать какой-либо тип фабрики соединений Spring? Любая помощь приветствуется. WAS 8.5 и Spring 4.2.4.RELEASE.

@Bean
public ConnectionFactory jndiConnectionFactory() throws NamingException {
    JndiObjectFactoryBean jndiObjectFactoryBean = new JndiObjectFactoryBean();
    jndiObjectFactoryBean.setJndiName("jms/qcfBindingsXa");
    jndiObjectFactoryBean.setLookupOnStartup(true);
    jndiObjectFactoryBean.setCache(true);
    jndiObjectFactoryBean.setResourceRef(true);
    jndiObjectFactoryBean.setProxyInterface(javax.jms.ConnectionFactory.class);
    jndiObjectFactoryBean.afterPropertiesSet();
    return (ConnectionFactory) jndiObjectFactoryBean.getObject();
}


@Bean
public Destination destination() throws NamingException {
    JndiObjectFactoryBean jndiObjectFactoryBean = new JndiObjectFactoryBean();
    jndiObjectFactoryBean.setJndiName("jms/app/insertQ");
    jndiObjectFactoryBean.setLookupOnStartup(true);
    jndiObjectFactoryBean.setCache(true);
    jndiObjectFactoryBean.setResourceRef(true);
    jndiObjectFactoryBean.setProxyInterface(javax.jms.Destination.class);
    jndiObjectFactoryBean.afterPropertiesSet();
    return (Destination) jndiObjectFactoryBean.getObject();
}

@Bean
public DefaultMessageListenerContainer messageListenerContainter() throws NamingException{
    DefaultMessageListenerContainer messageListenerContainter = new DefaultMessageListenerContainer();
    messageListenerContainter.setDestination(destination());
    messageListenerContainter.setConnectionFactory(jndiConnectionFactory());
    //messageListenerContainter.setMessageConverter(messageConverter());
    messageListenerContainter.setMessageListener(messageListener());
    messageListenerContainter.setSessionTransacted(true);
    messageListenerContainter.setDestinationResolver(destinationResolver());
    messageListenerContainter.afterPropertiesSet();
    return messageListenerContainter;
} 

Ошибка:

2016-02-12 09:51:03,493 ERROR o.s.j.l.DefaultMessageListenerContainer - Could not refresh JMS Connection for destination 'queue:///APP.INPUT.OC' - retrying using FixedBackOff{interval=5000, currentAttempts=0, maxAttempts=unlimited}. Cause: AOP configuration seems to be invalid: tried calling method [public abstract javax.jms.Connection javax.jms.ConnectionFactory.createConnection() throws javax.jms.JMSException] on target 
[com.ibm.ejs.jms.JMSQueueConnectionFactoryHandle@18fbbd2_   
managed connection factory = com.ibm.ejs.jms.WMQJMSRAManagedConnectionFactory@c51fdbc4_ 
connection manager = com.ibm.ejs.j2c.ConnectionManager@199d9f8f_    
restricted methods enabled = false]; 
nested exception is java.lang.IllegalArgumentException: object is not an instance of declaring class +[]

person gonzo    schedule 12.02.2016    source источник


Ответы (1)


Догадаться. Чувак, я чувствую себя глупо. :/ Имел банку javax.jms как на пути к классу сервера, так и на пути к классу приложения. Spring смотрел на банку приложения, а WAS смотрел на банку сервера. Я не контролирую и не вижу, что находится на пути к классу сервера, поэтому я не понял дублирования. Спасибо всем, кто хотя бы прочитал вопрос.

person gonzo    schedule 12.02.2016
comment
Привет... Не могли бы вы рассказать мне, как вы решили проблему? - person greencheese; 12.01.2020