Results 1 to 2 of 2

Thread: JMS configuration in Jboss through Spring

  1. #1
    Join Date
    Jan 2011
    Posts
    3

    Default JMS configuration in Jboss through Spring

    Hi,

    I am new to JMS and spring. I am in my initial phase of configuring JMS (queue- point to Point) with JBoss 4.2.3 and Spring. I am facing the following exception while launching the server.

    Error creating bean with name 'jmsTransactionManager' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type [org.jboss.mq.SpyConnectionFactory] to required type [javax.jms.ConnectionFactory] for property 'connectionFactory'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [org.jboss.mq.SpyConnectionFactory] to required type [javax.jms.ConnectionFactory] for property 'connectionFactory': no matching editors or conversion strategy found



    As advised in another thread, I checked if JMS jar or activemq-all.jar exist in the class path. But, they are not.

    Please find below the code excerpts for reference.

    1. Queue defined in "jbossmq-destinations-service.xml"

    Code:
    <mbean code="org.jboss.mq.server.jmx.Queue"
    	 name="jboss.mq.destination:service=Queue,name=myjms">
        <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
      </mbean>
    2. Resource reference of ConnectionFactory and Queue in web.xml

    Code:
    <resource-ref id="ResourceRef_CF">
    		<res-ref-name>jms/QCF</res-ref-name> 
    		<res-type>javax.jms.QueueConnectionFactory</res-type>  
    		<res-auth>Container</res-auth>  
    		<res-sharing-scope>Shareable</res-sharing-scope>
    	</resource-ref>
    	
    	<resource-ref id="ResourceRef_Queue">
    		<description />
    		<res-ref-name>myjms</res-ref-name>
    		<res-type>javax.jms.Queue</res-type>
    		<res-auth>Container</res-auth>
    	</resource-ref>
    3. Resource reference of ConnectionFactory and Queue in jboss-web.xml

    Code:
    <resource-ref id="ResourceRef_CF">
    		<description></description>
    		<res-ref-name>jms/QCF</res-ref-name>
    		<res-type>javax.jms.QueueConnectionFactory</res-type>
    		<res-auth>Container</res-auth>  
    		<res-sharing-scope>Shareable</res-sharing-scope>  
    		<jndi-name>java:/ConnectionFactory</jndi-name>
    	</resource-ref>
    	
    	<resource-ref id="ResourceRef_Queue">
    		<description></description>
    		<res-ref-name>myjms</res-ref-name>
    		<res-type>javax.jms.Queue</res-type>
    		<res-auth>Container</res-auth>
    		<res-sharing-scope>Shareable</res-sharing-scope>
    		<jndi-name>queue/myjms</jndi-name>
    	</resource-ref>
    4. Bean defined for ConnectionFactory, TransactionManager and Destination

    Code:
    <!-- JMS beans -->	
    	<bean name="jmsConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
    		<property name="jndiName" value="java:/ConnectionFactory"/>		
    	</bean>
    
    	<bean id="jmsTransactionManager" class="org.springframework.jms.connection.JmsTransactionManager">
    		<property name="connectionFactory" ref="jmsConnectionFactory" />
    	</bean>
    	
    	<!-- jms destination already defined in jboss -->
    	<bean name="jmsDestination" class="org.springframework.jndi.JndiObjectFactoryBean">
    		<property name="jndiName" value="java:comp/env/queue/myjms" />
    	</bean>

    Please let me know if I have misconfigured or left out anything. Thanks.

  2. #2
    Join Date
    Jan 2011
    Posts
    3

    Default

    The problem has been solved. I have removed the javax.jms.jar from the deployed WAR, before starting the jboss server. The reason is jboss-j2ee.jar in jboss library already have the javax.jms package in it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •