cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Freeman Fang (Commented) (JIRA)" <>
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


Freeman Fang commented on CXF-4239:


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
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.

> WSDL2Java Task fails to generate src files Caused by: java.lang.NoSuchMethodException:
> -----------------------------------------------------------------------------------------------------------------------------------------
>                 Key: CXF-4239
>                 URL:
>             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/" />	
>    <path id="cxf.classpath">
>       <fileset dir="./lib">
>          <include name="*.jar"/>
>       </fileset>
>    </path>
>    <target name="cxfWSDLToJava">
>       <java classname="" fork="true">
>       	 <arg value="-client"/>
>          <arg value="-d"/>
>          <arg value="src"/>
>       	 <arg value="-verbose"/> 
>          <arg value=""/>
>         <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
>      [java] wsdl2java - Apache CXF 2.3.9
>      [java] WSDLToJava Error: java.lang.reflect.UndeclaredThrowableException
>      [java] java.lang.reflect.UndeclaredThrowableException
>      [java] 	at
>      [java] 	at
>      [java] 	at
>      [java] 	at
>      [java] 	at
>      [java] Caused by: java.lang.reflect.UndeclaredThrowableException
>      [java] 	at $Proxy39.required(Unknown Source)
>      [java] 	at
>      [java] 	at
>      [java] 	at
>      [java] 	at<init>(
>      [java] 	at<init>(
>      [java] 	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
>      [java] 	at sun.reflect.NativeConstructorAccessorImpl.newInstance(
>      [java] 	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(
>      [java] 	at java.lang.reflect.Constructor.newInstance(
>      [java] 	at
>      [java] 	at
>      [java] 	at
>      [java] 	at
>      [java] 	at<init>(
>      [java] 	at
>      [java] 	at
>      [java] 	at
>      [java] 	at
>      [java] 	at
>      [java] 	at
>      [java] 	at
>      [java] 	at
>      [java] 	at
>      [java] 	... 4 more
>      [java] Caused by: java.lang.NoSuchMethodException: javax.xml.bind.annotation.XmlElementRef.required()
>      [java] 	at java.lang.Class.getDeclaredMethod(
>      [java] 	at com.sun.codemodel.TypedAnnotationWriter.invoke(
>      [java] 	... 28 more
> 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:!default.jspa
For more information on JIRA, see:


View raw message