Question

I'm trying JBoss AS 7 wsconsume.sh, but I get compilation error on generated sources. What's wrong?

The WSDL file comes from https://isir.justice.cz:8443/isir_ws/services/IsirPub001?wsdl and it has few formal errors.

$ ./wsconsume.sh -p cz.pohlidame.clientJBoss -o fooOut -s fooSrc -t 2.2 -e ~/proj/pohlidame.cz/wsdl-consumer/IsirPub001.wsdl 
Could not find log4j.xml configuration, logging to console.

TODO! Cheek SOAP 1.2 extension
WSConsume (CXF) does not allow to setup the JAX-WS specification target, using the currently configured JAX-WS version (check your JVM version and/or endorsed libs)
Loading FrontEnd jaxws ...
Loading DataBinding jaxb ...
wsdl2java -compile -exsh false -p cz.pohlidame.clientJBoss -verbose -classdir /home/ondra/work/AS7/ozizka-git/build/target/jboss-as-7.2.0.Alpha1-SNAPSHOT/bin/fooOut  -allowElementReferences file:/home/ondra/proj/pohlidame.cz/wsdl-consumer/IsirPub001.wsdl
wsdl2java - Apache CXF 2.4.6

                                                            ^
./cz/pohlidame/clientJBoss/IsirPub001Data.java:63: cannot find symbol
symbol  : method required()
location: @interface javax.xml.bind.annotation.XmlElementRef
@XmlElementRef(name = "spisZnacka", type = JAXBElement.class, required = false)
                                                              ^
3 errors
Failed to invoke WSDLToJava
org.apache.cxf.tools.common.ToolException: Failed to compile generated code
    at org.apache.cxf.tools.common.ClassUtils.compile(ClassUtils.java:115)
    at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.processWsdl(WSDLToJavaContainer.java:265)
    at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:138)
    at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:286)
    at org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:103)
    at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:113)
    at org.jboss.wsf.stack.cxf.tools.CXFConsumerImpl.consume(CXFConsumerImpl.java:250)
    at org.jboss.ws.tools.cmd.WSConsume.importServices(WSConsume.java:279)
    at org.jboss.ws.tools.cmd.WSConsume.mainInternal(WSConsume.java:104)
    at org.jboss.ws.tools.cmd.WSConsume.main(WSConsume.java:92)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.jboss.modules.Module.run(Module.java:270)
    at org.jboss.modules.Main.main(Main.java:294)
Was it helpful?

Solution

The required property was added to @XmlElementRef in JAXB 2.2.

See "Since 2.2" under "required" element here: http://docs.oracle.com/javase/7/docs/api/javax/xml/bind/annotation/XmlElementRef.html#required().

It looks like you have generated a JAXB 2.2 model and are attempting to use it in a runtime with JAXB 2.1 APIs.

Note: Java SE 6 contains JAXB 2.0/2.1 and Java SE 7 contains JAXB 2.2.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top