• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Error creating bean with WebsphereMQ and jbossAS using the Spring framework

 
Greenhorn
Posts: 12
Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Folks,
I’m hoping somebody can help me here.
I’m having trouble running WebsphereMQ with jbossAS using the Spring framework.
When I send a message and reference the Queue details with values from the .properties file, everything is fine and I receive the message. My problem lies in trying to reference the ConnectionFactory via jndi (as shown below).
I have a Spring configuration file referencing the jndi name.
I have coppied wmq.jmsra.rar from Websphere to my jboss deploy directory.
In the deploy directory, my –ds.xml files configure the destination and the ConnectionFactory thus:





The jndi binding appears to be successful when using jndi given the following server.log details:



But then I get an error creating a ConfigurableMessageListenerContainer bean.



There is a lot more content in the log file but it finishes:





My Spring configuration includes the following (The references to the .properties file are commented out) :



As I’m new to this level of programming, I don’t know if there are any more .xml configuration files I should be using.
I have tried several different ways of formatting the jndi reference in the Spring configuration, ie. jndi-name="java/NMQ_CF", jndi-name="java:/NMQ_CF", etc.
Another point I’m considering is that even though I have my –ds.xml and wmq.jmsra.rar files in C:/Servers/applications/deploy my .war file is deployed to c:/Servers/jboss_MWS_ESTSVC/jboss-as/server/production/deploy.

Help appreciated.
Thanks.
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What error do you get when you change the JNDI name to



in your Spring configuration file.
 
Martin Kelly
Greenhorn
Posts: 12
Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Using that format, the error goes as follows:

2012-08-03 14:51:11,959 INFO [STDOUT] (main) ERROR ContextLoader - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.myCo.util.ConfigurableMessageListenerContainer#1': Cannot resolve reference to bean 'nfnJSMSMSConsumerConnectionFactory' while setting bean property 'connectionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'nfnJSMSMSConsumerConnectionFactory' defined in FileHandler@23[path=WEB-INF/classes/applicationContext/applicationContext-jms.xml context=file:/C:/Servers/jboss_MWS_ESTSVC/jboss-as/server/production/tmp/a1s403h-2as2x9-h5fbye1l-1-h5fc01vi-bq/MVN-notification-web-service-1.0.1-SNAPSHOT.war/ real=file:/C:/Servers/jboss_MWS_ESTSVC/jboss-as/server/production/tmp/a1s403h-2as2x9-h5fbye1l-1-h5fc01vi-bq/MVN-notification-web-service-1.0.1-SNAPSHOT.war/WEB-INF/classes/applicationContext/applicationContext-jms.xml]: Cannot resolve reference to bean 'nfnSMSJMSConnectionFactory' while setting bean property 'targetConnectionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'nfnSMSJMSConnectionFactory' defined in FileHandler@20630333[path=WEB-INF/classes/applicationContext/applicationContext-jms.xml context=file:/C:/Servers/jboss_MWS_ESTSVC/jboss-as/server/production/tmp/a1s403h-2as2x9-h5fbye1l-1-h5fc01vi-bq/MVN-notification-web-service-1.0.1-SNAPSHOT.war/ real=file:/C:/Servers/jboss_MWS_ESTSVC/jboss-as/server/production/tmp/a1s403h-2as2x9-h5fbye1l-1-h5fc01vi-bq/MVN-notification-web-service-1.0.1-SNAPSHOT.war/WEB-INF/classes/applicationContext/applicationContext-jms.xml]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'com.ibm.mq.connector.outbound.ConnectionFactoryImpl' to required type 'javax.jms.ConnectionFactory' for property 'targetConnectionFactory'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [com.ibm.mq.connector.outbound.ConnectionFactoryImpl] to required type [javax.jms.ConnectionFactory] for property 'targetConnectionFactory': no matching editors or conversion strategy found
 
Jaikiran Pai
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you packaging any jar file(s) containing javax.jms.* classes within your application? If yes, remove such jars from the application being deployed.
 
Martin Kelly
Greenhorn
Posts: 12
Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That could be the problem alright, as there are a lot of Jar files in the application.
I'll be returning to the application after the weekend and will investigate.
 
Martin Kelly
Greenhorn
Posts: 12
Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, so I've had a look through the repository and I see that there are many jms jars included directly in my repository, as well as in the following folders in the repository:



I'm reluctant to go removing so many jars from the repository all at once in case of breaking the build.

A similar thread at http://forum.springsource.org/showthread.php?34920-Problems-injecting-the-ConnectionFactory-and-Queue-into-DefaultMessageListenerContain
describes introducing a scope of "provided" for the jms jar in the POM.xml.
However including this has made no difference to my server log output.



 
Jaikiran Pai
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You shouldn't be removing it from the repository or build time configurations. All you have to ensure is that those jars don't get packaged as part of the final deployable (the .war file in this case) that you deploy to the server.
 
Martin Kelly
Greenhorn
Posts: 12
Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've had a look at the dependency graph to see what elements were dependent on the various jars containing jms.*.
I've identified two elements that are dependent on these jars and then within these elements in the pom.xml I've added exclusion tags to exclude these dependent elements from being packaged.
These jars are javax.jms, com.ibm.mqjms, geronimo-jms_1.1_spec, spring-jms

One by one, as the exclusion tags were introduced, the coresponding element disappeared from the dependency graph, with the exception of mqjms, despite defining an exclusion tag for it.


With exclusions added for all mentioned jars, I recieve the following error


When I un-exclude javax.jms element, I get the same error..
When I un-exclude geronimo-jms element, I get the same error..
Like I said, even though exclusion tags are defined for ibm.mqjms and it still displays on the dependency graph, when these exclusion tags are removed, I still get the same error.

When I un-exclude spring-jms, the server starts without error however I am not receiving the messages I drop on the queue.



Still not getting to the bottom of this..
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic