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

  • Spring JMS with Websphere default messaging issue

    I am facing the following issue while trying to create a Spring JMS application which uses Websphere 7.0 default messaging (EIS).

    The exception I am getting at the startup of the application is :

    [2/6/13 14:04:58:641 EST] 00000024 ContextLoader E org.springframework.web.context.ContextLoader initWebApplicationContext Context initialization failed org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'org.springframework.context.annotation.internalPe rsistenceAnnotationProcessor': Initialization of bean failed; **nested exception is java.lang.IllegalArgumentException: Method must not be null at** org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:480) at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory$1.run(AbstractAutowireC apableBeanFactory.java:409)

    Below are the pieces of my code and Spring configuration :

    Spring config file :

    Code:
    <context:component-scan base-package="com.company.poc.asynch.logging" />
        <context:annotation-config/>
    
        <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:2810
    
    
    <context:component-scan base-package="com.company.poc.asynch.logging" />
        <context:annotation-config/>
    
        <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:2810
                </prop>
            </props>
        </property>
    </bean>
    
    <bean id="jmsQueueConnectionFactory"
          class="org.springframework.jndi.JndiObjectFactoryBean">
        <property name="jndiTemplate">
            <ref bean="jndiTemplate"/>
        </property>
        <property name="jndiName">
            <value>jms/ReDConnectionFactory</value>
        </property>
    </bean>
    
    <bean id="destination"
        class="org.springframework.jndi.JndiObjectFactoryBean">
        <property name="jndiTemplate">
            <ref bean="jndiTemplate"/>
        </property>
        <property name="jndiName">
            <value>jms/ReDMessageProviderQueue</value>
        </property>
    </bean>
    
    
    <bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
            <property name="connectionFactory" ref="jmsQueueConnectionFactory" />
            <property name="defaultDestination" ref="destination" />
        </bean>
    
    
    <bean id="logListener" class="com.company.poc.asynch.logging.LogListener"/>
    
        <jms:listener-container  connection-factory="connectionFactory" container-type="default" acknowledge="auto">
            <jms:listener destination="loggingQueue" ref="logListener" method="onMessage" />
        </jms:listener-container>
    Java Sender class :

    Code:
    @Service("logSender")
    public class LogSender {
    
        @Autowired
        private JmsTemplate jmsTemplate;
    
        public void sendLog(final String logText){
            jmsTemplate.send(
            new MessageCreator() {
              public Message createMessage(Session session) throws JMSException {
                  TextMessage logMessage = session.createTextMessage();
                   logMessage.setText(logText);
                   return logMessage;
              }
            }
            );
        }
    }
    Java message listener :


    Code:
    @Component("logListener")
    public class LogListener implements MessageListener {
    
        //private static Logger regularLogger = Logger.getLogger("regularLogger");
    
        public void onMessage(Message message) {
            TextMessage msg = (TextMessage) message;
             System.out.println("Log message recieved by the listener:" + msg);
    
          }
    }

    The Configuration of the queue, connection factory and bus is setup correctly int eh websphere admin console, as I use the same configuration in my stand alone java application without any issue.
    However, this Spring application fails to initialize and throws the above said exception at the startup. I have no clue what am I missing here, any help would be greately appreciated.

    Thanks.

  • #2
    Post the full stack trace instead of a snippet...

    The method argument on the jsm:listener shouldn't be needed as you already implement MessageListener and that is automatically detected by Spring.

    Note your configuration also appears to contain a duplicate component-scan and annotation-config (you can remove the annotation-config that is already implied by the use of component-scan). I also suggest the use of the jee namespace instead of the JndiObjectFactory saves you quite some xml.

    Comment


    • #3
      Originally posted by Marten Deinum View Post
      Post the full stack trace instead of a snippet...

      The method argument on the jsm:listener shouldn't be needed as you already implement MessageListener and that is automatically detected by Spring.

      Note your configuration also appears to contain a duplicate component-scan and annotation-config (you can remove the annotation-config that is already implied by the use of component-scan). I also suggest the use of the jee namespace instead of the JndiObjectFactory saves you quite some xml.
      Thanks a lot for replying Marten.

      I tried after removing the method argument fromt he jms:listener but still getting the same error. I have also removed the annotation-config from my xml now.

      Here is the complete stack trace :


      [2/7/13 12:54:22:532 EST] 00000045 ContextLoader E org.springframework.web.context.ContextLoader initWebApplicationContext Context initialization failed
      org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'org.springframework.context.annotation.internalPe rsistenceAnnotationProcessor': Initialization of bean failed; nested exception is java.lang.IllegalArgumentException: Method must not be null
      at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:480)
      at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory$1.run(AbstractAutowireC apableBeanFactory.java:409)
      at java.security.AccessController.doPrivileged(Access Controller.java:224)
      at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:380)
      at org.springframework.beans.factory.support.Abstract BeanFactory$1.getObject(AbstractBeanFactory.java:2 64)
      at org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.getSingleton(DefaultSingleton BeanRegistry.java:222)
      at org.springframework.beans.factory.support.Abstract BeanFactory.doGetBean(AbstractBeanFactory.java:261 )
      at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:185)
      at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:164)
      at org.springframework.context.support.AbstractApplic ationContext.registerBeanPostProcessors(AbstractAp plicationContext.java:578)
      at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:365)
      at org.springframework.web.context.ContextLoader.crea teWebApplicationContext(ContextLoader.java:255)
      at org.springframework.web.context.ContextLoader.init WebApplicationContext(ContextLoader.java:199)
      at org.springframework.web.context.ContextLoaderListe ner.contextInitialized(ContextLoaderListener.java: 45)
      at com.ibm.ws.webcontainer.webapp.WebApp.notifyServle tContextCreated(WebApp.java:1588)
      at com.ibm.ws.webcontainer.webapp.WebApp.commonInitia lizationFinish(WebApp.java:350)
      at com.ibm.ws.webcontainer.webapp.WebAppImpl.initiali ze(WebAppImpl.java:292)
      at com.ibm.ws.webcontainer.webapp.WebGroupImpl.addWeb Application(WebGroupImpl.java:99)
      at com.ibm.ws.webcontainer.VirtualHostImpl.addWebAppl ication(VirtualHostImpl.java:167)
      at com.ibm.ws.webcontainer.WSWebContainer.addWebApp(W SWebContainer.java:722)
      at com.ibm.ws.webcontainer.WSWebContainer.addWebAppli cation(WSWebContainer.java:607)
      at com.ibm.ws.webcontainer.component.WebContainerImpl .install(WebContainerImpl.java:376)
      at com.ibm.ws.webcontainer.component.WebContainerImpl .start(WebContainerImpl.java:668)
      at com.ibm.ws.runtime.component.ApplicationMgrImpl.st art(ApplicationMgrImpl.java:1162)
      at com.ibm.ws.runtime.component.DeployedApplicationIm pl.fireDeployedObjectStart(DeployedApplicationImpl .java:1313)
      at com.ibm.ws.runtime.component.DeployedModuleImpl.st art(DeployedModuleImpl.java:611)
      at com.ibm.ws.runtime.component.DeployedApplicationIm pl.start(DeployedApplicationImpl.java:938)
      at com.ibm.ws.runtime.component.ApplicationMgrImpl.st artApplication(ApplicationMgrImpl.java:740)
      at com.ibm.ws.runtime.component.ApplicationMgrImpl$1. run(ApplicationMgrImpl.java:1312)
      at com.ibm.ws.security.auth.ContextManagerImpl.runAs( ContextManagerImpl.java:4279)
      at com.ibm.ws.security.auth.ContextManagerImpl.runAsS ystem(ContextManagerImpl.java:4367)
      at com.ibm.ws.security.core.SecurityContext.runAsSyst em(SecurityContext.java:255)
      at com.ibm.ws.runtime.component.ApplicationMgrImpl.st artApplicationDynamically(ApplicationMgrImpl.java: 1317)
      at com.ibm.ws.runtime.component.ApplicationMgrImpl.st art(ApplicationMgrImpl.java:2089)
      at com.ibm.ws.runtime.component.CompositionUnitMgrImp l.start(CompositionUnitMgrImpl.java:437)
      at com.ibm.ws.runtime.component.CompositionUnitImpl.s tart(CompositionUnitImpl.java:122)
      at com.ibm.ws.runtime.component.CompositionUnitMgrImp l.start(CompositionUnitMgrImpl.java:380)
      at com.ibm.ws.runtime.component.CompositionUnitMgrImp l.startCompositionUnit(CompositionUnitMgrImpl.java :644)
      at com.ibm.ws.runtime.component.CompositionUnitMgrImp l.startCompositionUnit(CompositionUnitMgrImpl.java :613)
      at com.ibm.ws.runtime.component.ApplicationMgrImpl.st artApplication(ApplicationMgrImpl.java:1215)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:45)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:37)
      at java.lang.reflect.Method.invoke(Method.java:599)
      at sun.reflect.misc.Trampoline.invoke(MethodUtil.java :36)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:45)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:37)
      at java.lang.reflect.Method.invoke(Method.java:599)
      at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java :243)
      at javax.management.modelmbean.RequiredModelMBean.inv okeMethod(RequiredModelMBean.java:1085)
      at javax.management.modelmbean.RequiredModelMBean.inv oke(RequiredModelMBean.java:966)
      at com.sun.jmx.interceptor.DefaultMBeanServerIntercep tor.invoke(DefaultMBeanServerInterceptor.java:848)
      at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxM BeanServer.java:773)
      at com.ibm.ws.management.AdminServiceImpl$1.run(Admin ServiceImpl.java:1313)
      at com.ibm.ws.security.util.AccessController.doPrivil eged(AccessController.java:118)
      at com.ibm.ws.management.AdminServiceImpl.invoke(Admi nServiceImpl.java:1206)
      at com.ibm.ws.management.connector.AdminServiceDelega tor.invoke(AdminServiceDelegator.java:181)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:45)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:37)
      at java.lang.reflect.Method.invoke(Method.java:599)
      at com.ibm.ws.management.connector.soap.SOAPConnector .invoke(SOAPConnector.java:396)
      at com.ibm.ws.management.connector.soap.SOAPConnector .service(SOAPConnector.java:229)
      at com.ibm.ws.management.connector.soap.SOAPConnectio n.handleRequest(SOAPConnection.java:62)
      at com.ibm.ws.http.HttpConnection.readAndHandleReques t(HttpConnection.java:683)
      at com.ibm.ws.http.HttpConnection.run(HttpConnection. java:487)
      at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.j ava:1527)
      Caused by: java.lang.IllegalArgumentException: Method must not be null
      at org.springframework.util.Assert.notNull(Assert.jav a:112)
      at org.springframework.core.BridgeMethodResolver.find BridgedMethod(BridgeMethodResolver.java:63)
      at org.springframework.beans.GenericTypeAwareProperty Descriptor.<init>(GenericTypeAwarePropertyDescript or.java:58)
      at org.springframework.beans.CachedIntrospectionResul ts.<init>(CachedIntrospectionResults.java:250)
      at org.springframework.beans.CachedIntrospectionResul ts.forClass(CachedIntrospectionResults.java:144)
      at org.springframework.beans.BeanWrapperImpl.getCache dIntrospectionResults(BeanWrapperImpl.java:252)
      at org.springframework.beans.BeanWrapperImpl.getPrope rtyDescriptorInternal(BeanWrapperImpl.java:282)
      at org.springframework.beans.BeanWrapperImpl.isWritab leProperty(BeanWrapperImpl.java:333)
      at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.applyPropertyValues(Abs tractAutowireCapableBeanFactory.java:1247)
      at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.populateBean(AbstractAu towireCapableBeanFactory.java:1010)
      at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:472)
      ... 67 more


      Would greatly appreciate your help here and thanks again.

      Comment


      • #4
        I was able to resolve this issue finally.

        It was a jar files mis-match issue, I ahd spring jars for various components in my classpath.

        I removed all of them and put the spring jars fromt eh same release in the classpath and now my application is no longer throwing this error.

        I appreciate your response Marten.

        Comment

        Working...
        X