Mule 3.4: java.lang.ClassNotFoundException: com.ib

2019-06-28 01:18发布

问题:

I am trying to use WMQ as inbound endpoint, I have imported the sample from the sample catalog.

When I run the flow, I am getting the error as class not found.

I added the required jar files to the build path, but still getting the error.

Please let me know, what is the issue.

nested exception is java.lang.NoClassDefFoundError: com/ibm/mq/jms/MQConnectionFactory
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:412)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:174)
    at org.mule.config.spring.MuleApplicationContext.loadBeanDefinitions(MuleApplicationContext.java:113)
    at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130)
    at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:537)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:451)
    at org.mule.config.spring.SpringRegistry.doInitialise(SpringRegistry.java:89)
    at org.mule.registry.AbstractRegistry.initialise(AbstractRegistry.java:109)
    ... 13 more
Caused by: java.lang.NoClassDefFoundError: com/ibm/mq/jms/MQConnectionFactory
    at com.mulesoft.mule.transport.wmq.WebSphereMQConnector.<clinit>(WebSphereMQConnector.java:42)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:266)
    at org.apache.commons.lang.ClassUtils.getClass(ClassUtils.java:629)
    at org.apache.commons.lang.ClassUtils.getClass(ClassUtils.java:677)
    at org.apache.commons.lang.ClassUtils.getClass(ClassUtils.java:660)
    at org.mule.config.spring.parsers.assembly.DefaultBeanAssembler.methodExists(DefaultBeanAssembler.java:568)
    at org.mule.config.spring.parsers.assembly.DefaultBeanAssembler.bestGuessName(DefaultBeanAssembler.java:537)
    at org.mule.config.spring.parsers.assembly.DefaultBeanAssembler.extendBean(DefaultBeanAssembler.java:116)
    at org.mule.config.spring.parsers.AbstractMuleBeanDefinitionParser.processProperty(AbstractMuleBeanDefinitionParser.java:204)
    at org.mule.config.spring.parsers.AbstractMuleBeanDefinitionParser.doParse(AbstractMuleBeanDefinitionParser.java:424)
    at org.mule.config.spring.parsers.AbstractMuleBeanDefinitionParser.parseInternal(AbstractMuleBeanDefinitionParser.java:297)
    at org.mule.config.spring.parsers.generic.MuleOrphanDefinitionParser.parseInternal(MuleOrphanDefinitionParser.java:41)
    at org.springframework.beans.factory.xml.AbstractBeanDefinitionParser.parse(AbstractBeanDefinitionParser.java:59)
    at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:73)
    at org.mule.config.spring.MuleHierarchicalBeanDefinitionParserDelegate.parseCustomElement(MuleHierarchicalBeanDefinitionParserDelegate.java:88)
    at org.mule.config.spring.MuleHierarchicalBeanDefinitionParserDelegate.parseCustomElement(MuleHierarchicalBeanDefinitionParserDelegate.java:130)
    at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1428)
    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:190)
    at org.mule.config.spring.MuleBeanDefinitionDocumentReader.parseBeanDefinitions(MuleBeanDefinitionDocumentReader.java:55)
    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:140)
    at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:111)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:493)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390)
    ... 22 more
Caused by: java.lang.ClassNotFoundException: com.ibm.mq.jms.MQConnectionFactory
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
    ... 46 more

回答1:

This is a known issue with studio, where the IBM library are needed as part of the system classloader.

Please copy them into the

${studio.home}/plugins/org.mule.tooling.server.${mule.version}.ee_${mule.version}.${release.date}/mule/user 

folder to work around it.