1 Reply Latest reply on Nov 24, 2010 12:14 PM by Chris Smith

    Using Weblogic JMS -- How to include the jar?

    Chris Smith Newbie



      I am attempting to use Fuse ESB to publish JMS messages to a WebLogic server. I have the following configured in my bundle-context file, based on the servicemix JMS documentation:




      My issue is that I'm not sure how to include the weblogic jar file properly. I've tried simply dropping the jar in the servicemix/lib directory as well as putting it directly in the bundle and adding it to the Bundle-ClassPath, but both of those methods result in the following exception:


      java.lang.IllegalStateException: Cannot convert value of type weblogic.jms.client.JMSConnectionFactory to required type javax.jms.ConnectionFactory for property 'connectionFactory': no matching editors or conversion strategy found


      Some research shows that this exception is usually thrown when the JMS classes are on the classpath twice. The javax.jms package is present in both the weblogic jar and the geronimo-jms bundle, so it's possible that there are some conflicts there. I tried removing the geronimo-jms bundle and replacing it with the weblogic jar wrapped as a bundle, so that this jar is the sole source of the javax.jms package, but the issue with that is that there are a very large number of packages within the weblogic jar. Hence, I'm not sure which weblogic packages are required by my bundle, and manually importing them all seems infeasible.


      Can anyone point me towards a working solution for publishing to WebLogic JMS from Fuse ESB?

        • 1. Re: Using Weblogic JMS -- How to include the jar?
          Chris Smith Newbie

          For anyone else encountering this issue, here is how I resolved it:


          1) I used the Embed-Dependency instruction within my project's pom.xml file to embed the weblogic jar file, as described here:




          2) I modified the generated MANIFEST.MF file so that the javax.jms package was no longer declared in the "Private-Package" section, meaning that my bundle would not load the javax.jms classes from the weblogic jar.


          3) I added the javax.jms package to the "Import-Package" section of the manifest file so that the bundle would know to get those classes from the OSGI container just like all of the other bundles.


          Once these steps were completed, my project has access to all of the necessary WebLogic classes without encountering conflicts with the JMS classes.


          It may also be worth nothing that when embedding the weblogic jar within my bundle, there are a large number of extraneous import-package statements that get added to the manifest file. I wound up removing many of them manually, so that the final import-package section for my simple use-case looks like this:


          Import-Package: org.apache.camel.builder, org.apache.camel.component.jms, org.apache.camel.model, org.apache.log4j, org.springframework.beans.factory;version="2.5", javax.jms, org.apache.activemq


          Hopefully this helps anyone else attempting to publish JMS messages to WebLogic Server using ServiceMix.