Announcement Announcement Module
Collapse
No announcement yet.
Websphere v6, Spring JMS Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Websphere v6, Spring JMS

    Worked for quite a while on IBM forum to figure out how to get JMS working from a servlet under WebSphere, but I finally got it working.

    The code below is now working in a servlet:
    Code:
            InitialContext context = new InitialContext();
            ConnectionFactory cf = (ConnectionFactory) context
                    .lookup("java:comp/env/jms/MyConnectionFactoryRef");
    
            Destination dest = (Destination) context
                    .lookup("java:comp/env/jms/MyMDBQueueRef");
    
            Connection conn = cf.createConnection();
    
            Session jmsSession = conn.createSession(false,
                    Session.AUTO_ACKNOWLEDGE);
    
            MessageProducer producer = jmsSession.createProducer(dest);
    
            TextMessage message = jmsSession.createTextMessage();
            message.setText(messageString);
            producer.send(message);
            producer.close();
            jmsSession.close();
            conn.close();
    Now I am trying to get it working from Spring JMS. I have the following configuration:

    Code:
        <!-- JNDI Environment Template -->
        <bean id="jndiTemplate"
            class="org.springframework.jndi.JndiTemplate">
            <property name="environment">
                <props>
                    <prop key="java.naming.factory.initial">
                        com.ibm.websphere.naming.WsnInitialContextFactory
                    </prop>
                    <prop key="java.naming.provider.url">
                        iiop://localhost:2809
                    </prop>
                </props>
            </property>
        </bean>
    
        <!-- JMS Queue Connection Factory -->
        <bean id="internalJmsQueueConnectionFactory"
            class="org.springframework.jndi.JndiObjectFactoryBean">
            <property name="jndiTemplate">
                <ref bean="jndiTemplate" />
            </property>
            <property name="jndiName">
                <value>jms/MyConnectionFactoryRef</value>
            </property>
            <property name="resourceRef" value="true"/>
            
            <property name="proxyInterface" 
                value="javax.jms.QueueConnectionFactory"/>        
        </bean>
    But when the beans are being initialized, I get:

    [10/31/07 10:05:45:195 EDT] 00000029 ServletWrappe E SRVE0068E:
    Uncaught exception thrown in one of the service methods of the servlet: MySpringServlet. Exception thrown : org.springframework.aop.AopInvocationException: AOP configuration seems to be invalid:

    tried calling method [public abstract javax.jms.QueueConnection javax.jms.QueueConnectionFactory.createQueueConnec tion() throws javax.jms.JMSException] on target [com.ibm.ws.sib.api.jms.impl.JmsManagedConnectionFa ctoryImpl@fce7ba06]; nested exception is java.lang.IllegalArgumentException

    Caused by: java.lang.IllegalArgumentException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:64)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:615)
    at org.springframework.aop.support.AopUtils.invokeJoi npointUsingReflection(AopUtils.java:296)
    at org.springframework.aop.framework.JdkDynamicAopPro xy.invoke(JdkDynamicAopProxy.java:198)
    at $Proxy2.createQueueConnection(Unknown Source)
    at org.springframework.jms.connection.SingleConnectio nFactory102.doCreateConnection(SingleConnectionFac tory102.java:123
    )

    I am lost from here. Any suggestions?
    Ed

  • #2
    Found it!

    I think the issue was my use of JMSTemplate102. Incompatible with WebSphere v6.1

    Comment

    Working...
    X