cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Freeman Fang (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CXF-4239) WSDL2Java Task fails to generate src files Caused by: java.lang.NoSuchMethodException: javax.xml.bind.annotation.XmlElementRef.required()
Date Thu, 12 Apr 2012 11:59:19 GMT

    [ https://issues.apache.org/jira/browse/CXF-4239?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13252362#comment-13252362
] 

Freeman Fang commented on CXF-4239:
-----------------------------------

Hi,

This is a known issue.
Since CXF 2.3 by default wsdl2java will generate jaxws 2.2 spec code which need use jaxb 2.2,

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 several options to resolve 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.9, 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.
3. use jdk5 instead

I personally prefer option 1. If you use wsdl2java script shipped with kit or maven cxf codegen
plugin, it's already setup for you.

Btw, you really should post this kind issue on CXF users mailing list first before you create
a jira.
[1]http://cxf.apache.org/docs/23-migration-guide.html

Freeman
                
> WSDL2Java Task fails to generate src files Caused by: java.lang.NoSuchMethodException:
javax.xml.bind.annotation.XmlElementRef.required()
> -----------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CXF-4239
>                 URL: https://issues.apache.org/jira/browse/CXF-4239
>             Project: CXF
>          Issue Type: Task
>          Components: Tooling
>    Affects Versions: 2.3.9
>         Environment: Windows XP, Eclipse Helios, Java 1.6 version
>            Reporter: SAURABH NIGAM
>            Assignee: Freeman Fang
>            Priority: Critical
>   Original Estimate: 48h
>  Remaining Estimate: 48h
>
> We have a webservice up and running, currently exposed through CXF Simple frontend. But
when we try to generate proxy jar for it using WSDL2Java utility provided by CXF 2.3,9 version
, we are getting some exceptions, which we are unable to debug further. Please find below
the ant build.xml used for generating the src java files :-
> <?xml version="1.0"?>
> <project name="cxf wsdl2java" basedir=".">   
>    <property file="./../src/antbuild/eflow_project_windows.properties" />	
>    <path id="cxf.classpath">
>       <fileset dir="./lib">
>          <include name="*.jar"/>
>       </fileset>
>    </path>
>       
>    <target name="cxfWSDLToJava">
>       <java classname="org.apache.cxf.tools.wsdlto.WSDLToJava" fork="true">
>       	 <arg value="-client"/>
>          <arg value="-d"/>
>          <arg value="src"/>
>       	 <arg value="-verbose"/> 
>          <arg value="http://z1dnd83a.dev.qintra.com:40400/eflow/services/EflowProvisioningServices?wsdl"/>
>         <classpath>
>             <path refid="cxf.classpath"/>
>          </classpath>
>       </java>
>    </target>
> </project>
> The lib directory here being used for cxf classpath has all the libraries from the CXF
2.3.9 distribution binary.
> The exception stack trace we are experiencing is as follows :-
> Buildfile: C:\eflow_workspace_GWT\EFLOW_AUG\wsdl2java\build_webservices_client.xml
> cxfWSDLToJava:
>      [java] Loading FrontEnd jaxws ...
>      [java] Loading DataBinding jaxb ...
>      [java] wsdl2java -client -d src -verbose http://z1dnd83a.dev.qintra.com:40400/eflow/services/EflowProvisioningServices?wsdl
>      [java] wsdl2java - Apache CXF 2.3.9
>      [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:301)
>      [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 $Proxy39.required(Unknown Source)
>      [java] 	at com.sun.tools.xjc.generator.bean.field.AbstractField.annotateReference(AbstractField.java:192)
>      [java] 	at com.sun.tools.xjc.generator.bean.field.AbstractField.annotate(AbstractField.java:161)
>      [java] 	at com.sun.tools.xjc.generator.bean.field.AbstractFieldWithVar.createField(AbstractFieldWithVar.java:80)
>      [java] 	at com.sun.tools.xjc.generator.bean.field.SingleField.<init>(SingleField.java:94)
>      [java] 	at com.sun.tools.xjc.generator.bean.field.SingleField.<init>(SingleField.java:81)
>      [java] 	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
>      [java] 	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
>      [java] 	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
>      [java] 	at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
>      [java] 	at com.sun.tools.xjc.generator.bean.field.GenericFieldRenderer.generate(GenericFieldRenderer.java:69)
>      [java] 	at com.sun.tools.xjc.generator.bean.field.DefaultFieldRenderer.generate(DefaultFieldRenderer.java:82)
>      [java] 	at com.sun.tools.xjc.generator.bean.BeanGenerator.generateFieldDecl(BeanGenerator.java:774)
>      [java] 	at com.sun.tools.xjc.generator.bean.BeanGenerator.generateClassBody(BeanGenerator.java:555)
>      [java] 	at com.sun.tools.xjc.generator.bean.BeanGenerator.<init>(BeanGenerator.java:258)
>      [java] 	at com.sun.tools.xjc.generator.bean.BeanGenerator.generate(BeanGenerator.java:166)
>      [java] 	at com.sun.tools.xjc.model.Model.generateCode(Model.java:290)
>      [java] 	at com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerImpl.java:283)
>      [java] 	at com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerImpl.java:94)
>      [java] 	at org.apache.cxf.tools.wsdlto.databinding.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:393)
>      [java] 	at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.generateTypes(WSDLToJavaContainer.java:598)
>      [java] 	at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.processWsdl(WSDLToJavaContainer.java:250)
>      [java] 	at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:138)
>      [java] 	at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:293)
>      [java] 	... 4 more
>      [java] Caused by: java.lang.NoSuchMethodException: javax.xml.bind.annotation.XmlElementRef.required()
>      [java] 	at java.lang.Class.getDeclaredMethod(Class.java:1937)
>      [java] 	at com.sun.codemodel.TypedAnnotationWriter.invoke(TypedAnnotationWriter.java:112)
>      [java] 	... 28 more
> BUILD SUCCESSFUL
> Total time: 6 seconds
> Please guide us as to how to get this issue resolved as we are kind of stuck due to this
issue. It seems that some method is missing while trying to call through reflection, but since
we don't have any java source file as of now, I am unable to debug it further. This exception
we are getting while trying to generate java proxy src files using WSDL2Java utility from
CXF version 2.3.9.
> Any help of any sort will be highly appreciated. Please take it as a high priority, as
its blocking our production delivery schedule.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message