I am having a problem with calling WSDLTojava code in ant tasks in Eclipse
project. 

Have created an eclipse plugin project with specific ant tasks which calls
WSDLToJava api as part on simple HelloWorld task. The HelloWorld tasks calls
the following CXF api. 
         WSDLToJava cxfWSDL2Java = new WSDLToJava(args);        

On running the ant task, end up with following error : “Tools plugin
provider jaxb context init failed”.

[HelloWorld] May 3, 2012 4:14:50 PM
org.apache.cxf.tools.wsdlto.core.PluginLoader init
[HelloWorld] SEVERE: Tools plugin provider jaxb context init failed

BUILD FAILED
D:\DevTemp\Dev Temp\cli\codegen\testbuild.xml:48:
org.apache.cxf.tools.common.ToolException: Tools plugin provider jaxb
context init failed
        at 
org.apache.cxf.tools.wsdlto.core.PluginLoader.init(PluginLoader.java:81)
        at
org.apache.cxf.tools.wsdlto.core.PluginLoader.<init>(PluginLoader.java:70)
        at
org.apache.cxf.tools.wsdlto.core.PluginLoader.newInstance(PluginLoader.java:104)
        at org.apache.cxf.tools.wsdlto.WSDLToJava.<init>(WSDLToJava.java:48)


It looks like that JAXBContext is not getting linked to correct CXF jars. 
Am using following ant target to gather the jars from endorsed lib directory
and defensively adding all the jars on ant classpath.

     //Setting  cxf.home //
    <property name="cxf.home"
location="C:\apache-cxf-2.4.7\apache-cxf-2.4.7"/>

    // JAX-WS 2.2 and JAXB 2.2 jars looks to be endorsed //
    <condition property="cxf.endorsed.dir" value="${cxf.home}/lib/endorsed">
         <available file="${cxf.home}/lib/endorsed" type="dir" property=""/>
     </condition>
     <condition property="cxf.endorsed.flag"
value="-Djava.endorsed.dirs=${cxf.endorsed.dir}">
         <available file="${cxf.home}/lib/endorsed" type="dir" property=""/>
     </condition>
     <property name="cxf.endorsed.dir" location="${cxf.home}"/>
     <property name="cxf.endorsed.flag" value="-Dnone=none"/>

     //Set the classpath for the CXF libraries //
     <path id="cxf.classpath">
         <pathelement location="${cxf.home}/lib/cxf-manifest.jar"/>
                  <pathelement location="${cxf.home}/lib/cxf-2.4.7.jar"/>
         <fileset dir="${cxf.endorsed.dir}">
             <include name="*.jar"/>
         </fileset>
                 
                 <fileset dir="${cxf.home}/lib">
             <include name="*.jar"/>
         </fileset>
     </path>

    // Call custom ant task invoking CXF WSDLToJava api //
    <target name="declare">
       <taskdef name="HelloWorld"
                            classname="cxfAntPackage.HelloWorld">
                <classpath>
                    <pathelement location="C:\customBldTasks.jar"/>     // 
Add tasks jar to classpath //
                    <path refid="cxf.classpath" />                              
 // Add
CXF jar's to classpath  //
                 </classpath>            
                </taskdef>
        </target>
        
        <target name="main" depends="declare">
                  <HelloWorld/>
       </target>
        
</project>

I'm using Ant version 1.7. with the JDK v. 1.6. Any ideas on what I'm doing
incorrectly? 
Why is this error coming specifically with ant tasks in Eclipse plugin
project. Are there any additional settings needed to overcome this issue? 

Note:  Calling the CXF WSDLToJava Api from eclipse Plugin project in some UI
action works fine. It also works fine in standalone Java applications.  


        
 


--
View this message in context: 
http://cxf.547215.n5.nabble.com/Anttasks-in-Eclipse-plugin-project-throwing-Tools-plugin-provider-jaxb-context-init-failed-Exception-tp5682890.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to