cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Freeman Fang <freeman.f...@gmail.com>
Subject Re: WSDLToJava Error
Date Mon, 16 May 2011 09:45:12 GMT
Hi,

My comment inline
On 2011-5-16, at 下午5:22, David wrote:

> Hi,
>
> I am trying to use ant with cxf (2.3.3) to generate stub from wsdl.
>
> Here is part of my ant script:
>
>        <path id="cxf.classpath">
> 		<pathelement location="${target.classes.dir}"/>
> 		<fileset dir="${env.CXF_HOME}/lib">
> 			<include name="*.jar"/>
> 		</fileset>
> 	</path>
>
> 	<target name="generateCXFClient" depends="clean">
> 		<java classname="org.apache.cxf.tools.wsdlto.WSDLToJava"  
> fork="true">
> 			<arg value="-d"/>
> 			<arg value="${target.gen.dir}"/>
> 			<arg value="-compile"/>
> 			<arg value="-client"/>
> 			<arg value="-exsh"/>
> 			<arg value="false"/>
> 			<arg value="-dns"/>
> 			<arg value="true"/>
> 			<arg value="-dex"/>
> 			<arg value="true"/>
> 			<arg value="-verbose"/>
> 			
> 			
> 			
> 			<arg value="${wsdl.file.remote}"/>
> 			<classpath>
> 				<path refid="cxf.classpath"/>
> 			</classpath>
> 		</java>
> 	</target>
>
> And here is the error:
>
> [java] wsdl2java - Apache CXF 2.3.3
>     [java] WSDLToJava Error:  
> java.lang.reflect.UndeclaredThrowableException
>     [java] org.apache.cxf.tools.common.ToolException:
> java.lang.reflect.UndeclaredThrowableException
>     [java] 	at
> org 
> .apache 
> .cxf 
> .tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java: 
> 291)
>     [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: java.lang.reflect.UndeclaredThrowableException
>     [java] 	at $Proxy40.required(Unknown Source)
>     [java] 	at
> com 
> .sun 
> .tools 
> .xjc 
> .generator 
> .bean.field.AbstractField.annotateReference(AbstractField.java:187)
>     [java] 	at
> com 
> .sun 
> .tools 
> .xjc.generator.bean.field.AbstractField.annotate(AbstractField.java: 
> 156)
>     [java] 	at
> com 
> .sun 
> .tools 
> .xjc 
> .generator 
> .bean 
> .field.AbstractFieldWithVar.createField(AbstractFieldWithVar.java:75)
>     [java] 	at
> com 
> .sun 
> .tools.xjc.generator.bean.field.SingleField.<init>(SingleField.java: 
> 89)
>     [java] 	at
> com 
> .sun 
> .tools.xjc.generator.bean.field.SingleField.<init>(SingleField.java: 
> 76)
>     [java] 	at
> sun.reflect.GeneratedConstructorAccessor16.newInstance(Unknown Source)
>     [java] 	at
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown  
> Source)
>     [java] 	at java.lang.reflect.Constructor.newInstance(Unknown  
> Source)
>     [java] 	at
> com 
> .sun 
> .tools 
> .xjc 
> .generator 
> .bean.field.GenericFieldRenderer.generate(GenericFieldRenderer.java: 
> 64)
>     [java] 	at
> com 
> .sun 
> .tools 
> .xjc 
> .generator 
> .bean.field.DefaultFieldRenderer.generate(DefaultFieldRenderer.java: 
> 79)
>     [java] 	at
> com 
> .sun 
> .tools 
> .xjc 
> .generator.bean.BeanGenerator.generateFieldDecl(BeanGenerator.java: 
> 759)
>     [java] 	at
> com 
> .sun 
> .tools 
> .xjc 
> .generator.bean.BeanGenerator.generateClassBody(BeanGenerator.java: 
> 540)
>     [java] 	at
> com 
> .sun 
> .tools.xjc.generator.bean.BeanGenerator.<init>(BeanGenerator.java:243)
>     [java] 	at
> com 
> .sun 
> .tools.xjc.generator.bean.BeanGenerator.generate(BeanGenerator.java: 
> 161)
>     [java] 	at com.sun.tools.xjc.model.Model.generateCode(Model.java: 
> 286)
>     [java] 	at
> com 
> .sun 
> .tools 
> .xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerImpl.java:252)
>     [java] 	at
> com 
> .sun 
> .tools 
> .xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerImpl.java:85)
>     [java] 	at
> org 
> .apache 
> .cxf 
> .tools 
> .wsdlto 
> .databinding.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:392)
>     [java] 	at
> org 
> .apache 
> .cxf 
> .tools 
> .wsdlto.WSDLToJavaContainer.generateTypes(WSDLToJavaContainer.java: 
> 585)
>     [java] 	at
> org 
> .apache 
> .cxf 
> .tools 
> .wsdlto.WSDLToJavaContainer.processWsdl(WSDLToJavaContainer.java:240)
>     [java] 	at
> org 
> .apache 
> .cxf 
> .tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java: 
> 138)
>     [java] 	at
> org 
> .apache 
> .cxf 
> .tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java: 
> 283)
>     [java] 	... 4 more
>     [java] Caused by: java.lang.NoSuchMethodException:
> javax.xml.bind.annotation.XmlElementRef.required()
>     [java] 	at java.lang.Class.getDeclaredMethod(Unknown Source)
>     [java] 	at
> com 
> .sun 
> .codemodel.TypedAnnotationWriter.invoke(TypedAnnotationWriter.java: 
> 108)
>     [java] 	... 27 more
>

java.xml.bind.annotation.XmlElementRef.required() is from jaxb2.2 api,  
however java6 build-in jaxws 2.1 api which cause such error

You have 2 options to work around it

1. endorsed jaxws2.2 and jaxb2.2 api in your jdk, take a look at [1]  
to get more details
2. as you're using cxf 2.3.3, you can use a new flag for wsdl2java  
tool introuducd from cxf 2.3.3
wsdl2java -frontend jaxws21
to generate code which is jaxws2.1 api compatible.

[1]http://cxf.apache.org/docs/23-migration-guide.html

Freeman
> Any idea?
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/WSDLToJava-Error-tp4399830p4399830.html
> Sent from the cxf-user mailing list archive at Nabble.com.

---------------------------------------------
Freeman Fang

FuseSource
Email:ffang@fusesource.com
Web: fusesource.com
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com
Connect at CamelOne May 24-26
The Open Source Integration Conference









Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message