|
|||||||
![]() |
|
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
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 ... 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> 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> 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 05:22 PM. |
|
#2
|
|||
|
|||
|
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
|
|||
|
|||
|
Quote:
Thank you, thank you, thank you! |
|
#4
|
|||
|
|||
|
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
|
|||
|
|||
|
Ok. the problem was that I had activemq-all.jar in my classpath. Thanks.
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|