0

I have developed a custom cloud connector for Mule. I have developed it in IntelliJ using Maven. I generated code from a 3rd party WSDL using Axis2 and XMLBeans. I have developed test cases that pass and show the expected results after interacting with the web service. "mvn clean package" successfully passes all tests and builds the site.

The problem I am having is using it in anypoint building out a Mule project. I have added the Axis2 1.6.3 libs to the classpath root of the jvm created by Anypoint when launching the application. When I submit a request that interacts with my connector, I get the following error:


Message : null (java.lang.ExceptionInInitializerError). Message payload is of type: String Type : org.mule.api.MessagingException Code : MULE_ERROR--2 JavaDoc : http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/MessagingException.html Payload : Testing ******************************************************************************** Exception stack is: 1. null (java.lang.NullPointerException) org.apache.axiom.locator.DefaultOMMetaFactoryLocator:72 (null) 2. null (java.lang.ExceptionInInitializerError) org.apache.axis2.description.AxisDescription:72 (null) 3. null (java.lang.ExceptionInInitializerError). Message payload is of type: String (org.mule.api.MessagingException)
org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor:32 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/MessagingException.html) ******************************************************************************** Root Exception stack trace: java.lang.NullPointerException at org.apache.axiom.locator.DefaultOMMetaFactoryLocator.(DefaultOMMetaFactoryLocator.java:72)

Looking at DefaultOMMetaFactoryLocator, for axiom-api1.2.14, I see the following at line 72:

Enumeration e = classLoader.getResources(ImplementationFactory.DESCRIPTOR_RESOURCE);

The static reference is to an axiom.xml file. I have tried adding the file manually but continue to get the null pointer error. This code is used by the generated code to make a connection via the client but not impacted by my code directly. Is there something I am missing with being able to use Axis2 within a Cloud Connector in Mule ESB? Why would it work in the maven test but not in anypoint?

Additional Info:

Axis2 1.6.3 Axiom* 1.2.14 Mule ESB 3.7

MonomiDev
  • 301
  • 2
  • 8

1 Answers1

0

The error indicates that Axiom is loaded by the bootstrap classloader of the JVM. I doubt that doing this is the recommended way to deploy things on Anypoint.

Andreas Veithen
  • 8,868
  • 3
  • 25
  • 28
  • You are right, I intentionally loaded it in the bootstrap class loader. Mule ESB 3.7 references an older version of Axiom. If I do not load it in the bootstrap, I get a method not found error because of the older version of Axiom. – MonomiDev Dec 07 '15 at 21:38
  • I think the right way to do this is to add the JARs to $MULE_HOME/lib/user. – Andreas Veithen Dec 07 '15 at 22:44
  • If I switch to the way you mention, I get the following (at least I think I am doing it right, I added Axis2 1.6.3 to use libraries in the run config): Message : org.apache.axiom.om.OMAbstractFactory.getMetaFactory()Lorg/apache/axiom/om/OMMetaFactory; (java.lang.NoSuchMethodError). Message payload is of type: String Type : org.mule.api.MessagingException Code : MULE_ERROR--2 JavaDoc : – MonomiDev Dec 07 '15 at 23:22
  • correction to above, I added Axis2 1.6.3 libs to the "user entries" under classpath, in the run configs – MonomiDev Dec 07 '15 at 23:27
  • What I'm referring to is item 2 in https://docs.mulesoft.com/mule-user-guide/v/3.7/classloader-control-in-mule. – Andreas Veithen Dec 08 '15 at 07:35
  • Accepting your answer because technically, you are right but it is not solving the issue I am running into. I opened a new one that is more accurate on what the issue is: http://stackoverflow.com/questions/34164577/classloader-overrides-not-working-in-mule – MonomiDev Dec 08 '15 at 19:40