Search code examples
wsdlmuleesb

WSDL Endpoint example throwing errors in Mule


Posting here is always my last resort, but I'm going crazy here. I'm a Mule ESB beginner. I've been trying to do some simple examples to get me on the right track. But I've encountered a problem with one of the examples I've seen on the mule website... http://www.mulesoft.org/documentation/display/current/WSDL+Connectors

I'm trying to set up a generic WSDL endpoint, which invokes a web service without generating a client.

The WSDL I'm trying to access... http://www.webservicex.net/CurrencyConvertor.asmx?WSDL&method=ConversionRate

The problem is, I keep getting the following error

[ERROR] IOException during exec() of compiler "javac". Check your path environment variable.
ERROR 2013-04-19 09:27:07,920 [[soap].soapFlow1.stage1.02] org.apache.cxf.endpoint.dynamic.DynamicClientFactory: Could not compile java files for http://www.webservicex.net/CurrencyConvertor.asmx?WSDL&method=ConversionRate?wsdl.
ERROR 2013-04-19 09:27:07,934 [[soap].soapFlow1.stage1.02] org.mule.exception.DefaultMessagingExceptionStrategy: 
********************************************************************************
Message               : Unable to create JAXBContext for generated packages: Provider com.sun.xml.bind.v2.ContextFactory could not be instantiated: javax.xml.bind.JAXBException: "net.webservicex" doesnt contain ObjectFactory.class or jaxb.index (java.lang.IllegalStateException)
Code                  : MULE_ERROR--2
--------------------------------------------------------------------------------
Exception stack is:
1. "net.webservicex" doesnt contain ObjectFactory.class or jaxb.index (javax.xml.bind.JAXBException)
  com.sun.xml.bind.v2.ContextFactory:183 (http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/xml/bind/JAXBException.html)
2. Provider com.sun.xml.bind.v2.ContextFactory could not be instantiated: javax.xml.bind.JAXBException: "net.webservicex" doesnt contain ObjectFactory.class or jaxb.index (javax.xml.bind.JAXBException)
  javax.xml.bind.ContextFinder:-1 (http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/xml/bind/JAXBException.html)
3. Unable to create JAXBContext for generated packages: Provider com.sun.xml.bind.v2.ContextFactory could not be instantiated: javax.xml.bind.JAXBException: "net.webservicex" doesnt contain ObjectFactory.class or jaxb.index (java.lang.IllegalStateException)
  org.apache.cxf.endpoint.dynamic.DynamicClientFactory:363 (null)
4. Unable to create JAXBContext for generated packages: Provider com.sun.xml.bind.v2.ContextFactory could not be instantiated: javax.xml.bind.JAXBException: "net.webservicex" doesnt contain ObjectFactory.class or jaxb.index (java.lang.IllegalStateException) (org.mule.api.DefaultMuleException)
  org.mule.module.cxf.builder.AbstractOutboundMessageProcessorBuilder:96 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/DefaultMuleException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
javax.xml.bind.JAXBException: "net.webservicex" doesnt contain ObjectFactory.class or jaxb.index
    at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:183)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    + 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************

And yes, I've hunted around the internet for hours looking for a solution.

Things I've done to try fix the problem.

  • Make sure the javac path is set in the environment variables. (%JAVA_HOME%\bin)
  • Make sure that mule studio has the correct path to JRE


I know it's a simple problem, but I need to figure it out to tackle a larger project that I have in mind.
If anyone could shed some light on a solution this problem, then I'd be extremely grateful.

Thanks :)

Other info:

  • Using Java 1.7
  • Using MuleStudio 3.4

Solution

  • Ok, after trying and failing at many different solutions, I've figured it out. I've seen a lot of people asking the same question as me, with very few solutions.
    Here is mine...

    The JRE was incorrect.
    My java directory consisted of..
    enter image description here
    And Mule studio was using the folder jre7
    So I changed it to use the JRE in the directory jdk1.7.0_17/jre
    Ran it again and.. OMG it worked!!
    Here is how to do it in mule studio/eclipse...

    Right Click on your Project --> Properties --> Java Build Path --> Libraries Tab
    --> Click JRE System Library --> Press Edit --> Click Alternate JRE --> Click Installed JREs..
    --> Then Add the JRE from the correct directory like I stated above.

    Hope this helps anyone with the same problem! :)