All,
I¹ve been trying to leverage some JAXB plugins via XJC options upon use of
wsdl2java. Specifically, I want to use some of the jaxb2-commons plugins
like equals and hashcode ( https://jaxb2-commons.dev.java.net/). I have
been unable to get this to work, so I decided to simplify the problem, and
noticed CXF appears to ship with a ³toString² plugin, so I tried to get that
to work. It did not (see below). I followed the instructions from the bug
report here: https://issues.apache.org/jira/browse/CXF-787
Specifically, I edited the common_build.xml wsdl2java macro, by adding this:
<arg value="-xjc-Xts"/>
When I run ant from the wsdl_first project in the samples, it generates a
ClassNotFound exception (it worked fine before adding the xjc flag).
Attached is the output of ³ant diagnostics² for information about my
environment. Any ideas?
[meadowgrain:apache-cxf-2.2.3/samples/wsdl_first] oster% ant
Buildfile: build.xml
[mkdir] Created dir:
/Users/oster/Desktop/wsi-testing/apache-cxf-2.2.3/samples/wsdl_first/build
maybe.generate.code:
generate.code:
[echo] Generating code using wsdl2java...
[mkdir] Created dir:
/Users/oster/Desktop/wsi-testing/apache-cxf-2.2.3/samples/wsdl_first/build/c
lasses
[mkdir] Created dir:
/Users/oster/Desktop/wsi-testing/apache-cxf-2.2.3/samples/wsdl_first/build/s
rc
[java] Loading FrontEnd jaxws ...
[java] Loading DataBinding jaxb ...
[java] wsdl2java -verbose -xjc-Xts -d
/Users/oster/Desktop/wsi-testing/apache-cxf-2.2.3/samples/wsdl_first/build/s
rc
/Users/oster/Desktop/wsi-testing/apache-cxf-2.2.3/samples/wsdl_first/wsdl/he
llo_world.wsdl
[java] wsdl2java - Apache CXF 2.2.3
[java]
[java]
[java] WSDLToJava Error: XJC reported 'BadCommandLineException' for
-xjc argument:-extension -Xts
[java]
[java] avaliable plugin options:
[java] -Xts : Activate plugin to add a toString()
method to generated classes
[java] -Xts:style:multiline : Have toString produce multi line output
[java] -Xts:style:simple : Have toString produce single line terse
output
[java]
[java] -Xinject-code : inject specified Java code fragments
into the generated code
[java] -Xlocator : enable source location support for
generated code
[java] -Xsync-methods : generate accessor methods with the
'synchronized' keyword
[java] -mark-generated : mark the generated code as
@javax.annotation.Generated
[java] -episode <FILE> : generate the episode file for separate
compilation
[java] -Xbug671 : Activate plugin to map package names
that contain keywords
[java]
[java]
[java]
[java] org.apache.cxf.tools.common.ToolException: XJC reported
'BadCommandLineException' for -xjc argument:-extension -Xts
[java]
[java] avaliable plugin options:
[java] -Xts : Activate plugin to add a toString()
method to generated classes
[java] -Xts:style:multiline : Have toString produce multi line output
[java] -Xts:style:simple : Have toString produce single line terse
output
[java]
[java] -Xinject-code : inject specified Java code fragments
into the generated code
[java] -Xlocator : enable source location support for
generated code
[java] -Xsync-methods : generate accessor methods with the
'synchronized' keyword
[java] -mark-generated : mark the generated code as
@javax.annotation.Generated
[java] -episode <FILE> : generate the episode file for separate
compilation
[java] -Xbug671 : Activate plugin to map package names
that contain keywords
[java]
[java]
[java] at
org.apache.cxf.tools.wsdlto.databinding.jaxb.JAXBDataBinding.initialize(JAXB
DataBinding.java:303)
[java] at
org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.generateTypes(WSDLToJavaCont
ainer.java:568)
[java] at
org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.processWsdl(WSDLToJavaContai
ner.java:219)
[java] at
org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.
java:127)
[java] at
org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.
java:263)
[java] at
org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:103)
[java] at
org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:113)
[java] at
org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:86)
[java] at
org.apache.cxf.tools.wsdlto.WSDLToJava.main(WSDLToJava.java:184)
[java] Caused by: com.sun.tools.xjc.BadCommandLineException: Failure to
load a plugin: "java.lang.ClassNotFoundException:
[java] at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
[java] at java.security.AccessController.doPrivileged(Native
Method)
[java] at
java.net.URLClassLoader.findClass(URLClassLoader.java:188)
[java] at java.lang.ClassLoader.loadClass(ClassLoader.java:316)
[java] at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
[java] at com.sun.tools.xjc.Options.findServices(Options.java:962)
[java] at com.sun.tools.xjc.Options.getAllPlugins(Options.java:351)
[java] at com.sun.tools.xjc.Options.parseArgument(Options.java:650)
[java] at
com.sun.tools.xjc.Options.parseArguments(Options.java:760)
[java] at
org.apache.cxf.tools.wsdlto.databinding.jaxb.JAXBDataBinding.initialize(JAXB
DataBinding.java:286)
[java] at
org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.generateTypes(WSDLToJavaCont
ainer.java:568)
[java] at
org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.processWsdl(WSDLToJavaContai
ner.java:219)
[java] at
org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.
java:127)
[java] at
org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.
java:263)
[java] at
org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:103)
[java] at
org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:113)
[java] at
org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:86)
[java] at
org.apache.cxf.tools.wsdlto.WSDLToJava.main(WSDLToJava.java:184)
[java] ". Use the system property
'-Dcom.sun.tools.xjc.Options.findServices=true' to diagnose it further
[java] at
com.sun.tools.xjc.Options.parseArguments(Options.java:807)
[java] at
org.apache.cxf.tools.wsdlto.databinding.jaxb.JAXBDataBinding.initialize(JAXB
DataBinding.java:286)
[java] ... 8 more
BUILD FAILED
/Users/oster/Desktop/wsi-testing/apache-cxf-2.2.3/samples/common_build.xml:1
07: The following error occurred while executing this line:
/Users/oster/Desktop/wsi-testing/apache-cxf-2.2.3/samples/wsdl_first/build.x
ml:57: The following error occurred while executing this line:
/Users/oster/Desktop/wsi-testing/apache-cxf-2.2.3/samples/common_build.xml:2
30: Java returned: 1
Scott
Scott Oster
Co-Director
Software Research Institute
Center for IT Innovations in Healthcare
Senior Researcher
Department of Biomedical Informatics
The Ohio State University
Phone: (614) 293-9590