Results 1 to 9 of 9

Thread: Problems injecting the ConnectionFactory and Queue into DefaultMessageListenerContain

  1. #1
    Join Date
    Feb 2006
    Posts
    115

    Default Problems injecting the ConnectionFactory and Queue into DefaultMessageListenerContain

    I am trying to get a JMS queue to work in JBoss, but I keep getting an error.

    I am working off of the example here, but when I start up JBoss I get the following:
    Code:
    4:26:28,464 INFO  [STDOUT] 14:26:28,459 ERROR [ContextLoader] Context initialization failed
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'listenerContainer' defined in class path resource [applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (2) are:
    PropertyAccessException 1: 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
    PropertyAccessException 2: org.springframework.beans.TypeMismatchException: Failed to convert property value of type [org.jboss.mq.SpyQueue] to required type [javax.jms.Destination] for property 'destination'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [org.jboss.mq.SpyQueue] to required type [javax.jms.Destination] for property 'destination': no matching editors or conversion strategy found
    Caused by: 
    org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessException details (2) are:
    PropertyAccessException 1:
    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
    ...
    The AppCtx defining the beans in question look like:
    Code:
    	<bean id="connectionFactory"
    		class="org.springframework.jndi.JndiObjectFactoryBean">
    		<property name="jndiTemplate">
    			<ref bean="jndiTemplate" />
    		</property>
    		<property name="jndiName">
    			<value>UIL2ConnectionFactory</value>
    		</property>
    	</bean>
    
    	<!-- JMS Destination -->
    	<bean id="destination"
    		class="org.springframework.jndi.JndiObjectFactoryBean">
    		<property name="jndiTemplate">
    			<ref bean="jndiTemplate" />
    		</property>
    		<property name="jndiName">
    			<value>queue/HashGrabberQueue</value>
    		</property>
    	</bean>
    
    	<!-- this is the Message Driven POJO (MDP) -->
    	<bean id="messageListener" class="com.codechimp.hashgrabber.HashProcessor" />
    
    	<!-- and this is the message listener container -->
    	<bean id="listenerContainer"
    		class="org.springframework.jms.listener.DefaultMessageListenerContainer102">
    		<property name="concurrentConsumers" value="1" />
    		<property name="connectionFactory" ref="connectionFactory" />
    		<property name="destination" ref="destination" />
    		<property name="messageListener" ref="messageListener" />
    	</bean>
    And the Queue is defined as such:
    Code:
    <server>
    	<!-- Destination without a configured SecurityManager or without a 
    		a SecurityConf will default to role guest with read=true, write=true,
    		create=false.
    	-->
    	<mbean code="org.jboss.mq.server.jmx.Queue"
    		name="jboss.mq.destination:service=Queue,name=HashGrabberQueue">
    		<depends optional-attribute-name="DestinationManager">
    			jboss.mq:service=DestinationManager
    		</depends>
    	</mbean>
    </server>
    I am not sure what I am doing wrong here, but I would like to understand.

    Edit: If someone could just point me in the direction of a better guide for doing JMS in JBoss 4.x using Spring 2.0 that would be awesome.

    Edit 2:
    I have tried SEVERAL things, and was hoping someone could point me in the right direction by now. Obviously the problem I am having stems from the fact the "ConnectionFactory" I am getting from JNDI is not of the right class type...this I know. What I don't know is how/where to get the right type. So far I have tried the following:
    - I changed the JndiObjectFactoryBean to lookup "java:/JmsXA", which identifies itself as class type org.jboss.resource.adapter.jms.JmsConnectionFactor yImpl. This throws the same sort of conversion exception as before.
    - I tried copying the Bean setup in a different post that used a org.springframework.jms.connection.SingleConnectio nFactory, but it complains with the same error about conversion.
    - I tried looking up all things in JNDI named ConnectionFactory or with ConnectionFactory as part of its classname somewhere, and the only ones I have is either the org.jboss.mq.SpyConnectionFactory, org.jboss.mq.SpyXAConnectionFactory, or org.jboss.resource.adapter.jms.JmsConnectionFactor yImpl. Nothing else seems to identify its class type as a "ConnectionFactory" thats not one of those 3 things.

    I am really getting desparate here. I will take any leads anyone can give me, but I honestly feel I have expended all my possibilities up to this point.
    Last edited by mbabauer; Feb 16th, 2007 at 04:22 PM.

  2. #2
    Join Date
    Aug 2004
    Location
    Linz, Austria
    Posts
    391

    Default

    This looks like a class loading problem: You seem to have the JMS API jar on your classpath at multiple levels. Make sure that you do not include the JMS API jar in any of your application deployment units; it should only be loaded from the server's bootstrap class loader.

    Juergen

  3. #3
    Join Date
    Feb 2006
    Posts
    115

    Default

    Quote Originally Posted by Juergen Hoeller View Post
    This looks like a class loading problem: You seem to have the JMS API jar on your classpath at multiple levels.
    Juergen
    That was absolutely it! I was using Maven to build the JARs/WARs, and it was pulling in the JMS stuff automagically. Once I added a dependecy for JMS with a scope of "provided", everything started up like magic!

    Thank you, thank you, thank you!

  4. #4
    Join Date
    Dec 2007
    Posts
    10

    Default

    Hi,

    I have encountered the same exception. i have tried the above solution, removed the jms jar file from my application, but the problem is still there. Any help?

    org.springframework.beans.TypeMismatchException: Failed to convert property value of type [org.jboss.jms.client.JBossConnectionFactory] to required type [javax.jms.ConnectionFactory] for property 'connectionFactory'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [org.jboss.jms.client.JBossConnectionFactory] to required type [javax.jms.ConnectionFactory] for property 'connectionFactory': no matching editors or conversion strategy found
    Caused by:
    java.lang.IllegalArgumentException: Cannot convert value of type [org.jboss.jms.client.JBossConnectionFactory] to required type [javax.jms.ConnectionFactory] for property 'connectionFactory': no matching editors or conversion strategy found
    at org.springframework.beans.TypeConverterDelegate.co nvertIfNecessary(TypeConverterDelegate.java:231)

  5. #5
    Join Date
    Dec 2007
    Posts
    10

    Default

    Ok. the problem was that I had activemq-all.jar in my classpath. Thanks.

  6. #6
    Join Date
    Jan 2011
    Posts
    3

    Default

    Hi, I am facing the same problem. There is neither JMS jar nor activemq-all.jar in the classpath. But still getting the below exception. Please help.

    org.springframework.beans.factory.BeanCreationExce ption: 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

  7. #7
    Join Date
    Apr 2011
    Posts
    1

    Default Jms classLoader problem

    Hi,
    The problem is that jboss includes jms in jboss-j2ee.jar. If you are using maven just change the scope of jms dependecy to provided.

    regards,
    carlos

  8. #8

    Default

    Hi ,
    i am also getting same kind of error .

    ConversionNotSupportedException: Failed to convert property value of type 'javax.naming.Reference' to required type 'javax.jms.ConnectionFactory' for property 'connectionFactory'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [javax.naming.Reference] to required type [javax.jms.ConnectionFactory] for property 'connectionFactory': no matching editors or conversion strategy found
    at org.springframework.beans.BeanWrapperImpl.convertF orProperty(BeanWrapperImpl.java:471)

    Any pointers for this please.

    Thanks,
    Rajesh

  9. #9
    Join Date
    Aug 2007
    Posts
    5

    Default

    Hi,

    I got the same problem with JONAS 5 and Mq series.
    I removed all jms jar file dependency but i still got:
    java.lang.IllegalStateException: Cannot convert value of type [com.ibm.mq.connector.inbound.ActivationSpecImpl] to required type [javax.jms.Destination] for property 'destination': no matching editors or conversion strategy found

    Thanks,

Posting Permissions

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