Quantcast
Channel: Spring Community Forums - JMS
Viewing all articles
Browse latest Browse all 51

Spring-JMS with Glassfish Exception

$
0
0
Hi,

I have an application which is built using spring-jms and I am trying to get it to work with Glassfish.

When I deploy my app I get the following exception:

Code:

Caused by: javax.jms.JMSException: MQJMSRA_DC2001: Unsupported:setExceptionListener():inACC=false:connectionId=7397227676621758721
        at com.sun.messaging.jms.ra.DirectConnection._unsupported(DirectConnection.java:982)
        at com.sun.messaging.jms.ra.DirectConnection.setExceptionListener(DirectConnection.java:505)
        at org.springframework.jms.connection.SingleConnectionFactory.prepareConnection(SingleConnectionFactory.java:364)
        at org.springframework.jms.connection.SingleConnectionFactory.initConnection(SingleConnectionFactory.java:289)
        at org.springframework.jms.connection.SingleConnectionFactory.createConnection(SingleConnectionFactory.java:225)
        at org.springframework.jms.support.JmsAccessor.createConnection(JmsAccessor.java:184)
        at org.springframework.jms.listener.AbstractJmsListeningContainer.createSharedConnection(AbstractJmsListeningContainer.java:404)
        at org.springframework.jms.listener.AbstractJmsListeningContainer.establishSharedConnection(AbstractJmsListeningContainer.java:372)
        at org.springframework.jms.listener.AbstractJmsListeningContainer.doStart(AbstractJmsListeningContainer.java:279)
        at org.springframework.jms.listener.SimpleMessageListenerContainer.doStart(SimpleMessageListenerContainer.java:224)
        at org.springframework.jms.listener.AbstractJmsListeningContainer.start(AbstractJmsListeningContainer.java:264)

I have defined my beans as follows:

Code:

<bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
        <property name="environment">
            <props>
                <prop key="java.naming.factory.initial">com.sun.enterprise.naming.SerialInitContextFactory</prop>
                <prop key="java.naming.factory.url.pkgs">com.sun.enterprise.naming</prop>
                <prop key="java.naming.factory.state">com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl</prop>
            </props>
        </property>
    </bean>

    <bean id="queueConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
        <property name="jndiTemplate" ref="jndiTemplate"/>
        <property name="jndiName" value="jms/QueueConnectionFactory"/>
        <property name="lookupOnStartup" value="false"/>
        <property name="cache" value="false"/>
        <property name="proxyInterface" value="javax.jms.QueueConnectionFactory"/>
    </bean>

    <bean id="cachingConnectionFactory" class="org.springframework.jms.connection.CachingConnectionFactory" destroy-method="destroy">
        <property name="targetConnectionFactory" ref="queueConnectionFactory"/>
        <property name="reconnectOnException" value="true"/>
        <property name="sessionCacheSize" value="100"/>
    </bean>

    <bean id="singleConnectionFactory" class="org.springframework.jms.connection.SingleConnectionFactory" destroy-method="destroy">
        <property name="targetConnectionFactory" ref="queueConnectionFactory"/>
        <property name="reconnectOnException" value="true"/>
    </bean>

    <bean id="receiveQueue" class="org.springframework.jndi.JndiObjectFactoryBean">
        <property name="jndiTemplate" ref="jndiTemplate"/>
        <property name="jndiName" value="jms/ReceiveQueue"/>
    </bean>

    <bean id="sendQueue" class="org.springframework.jndi.JndiObjectFactoryBean">
        <property name="jndiTemplate" ref="jndiTemplate"/>
        <property name="jndiName" value="jms/SendQueue"/>
    </bean>

    <bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
        <property name="connectionFactory" ref="singleConnectionFactory"/>
        <property name="defaultDestination" ref="sendQueue"/>
    </bean>

    <bean id="jmsMessageListener" class="example1.JmsMessageListener"/>

    <bean id="container" class="org.springframework.jms.listener.SimpleMessageListenerContainer">
        <property name="connectionFactory" ref="singleConnectionFactory"/>
        <property name="messageListener" ref="jmsMessageListener"/>
        <property name="exceptionListener" ref="jmsMessageListener"/>
        <property name="destination" ref="receiveQueue"/>
    </bean>

I seem to see some information about the "reconnectOnException" property mentioned in a few places, but the information I find is loose and vague. I have tried setting true and false on it with little effect.

Can anyone help out?

Many Thanks

Viewing all articles
Browse latest Browse all 51

Trending Articles