eclipse-ee4j / jaxb-ri

Jaxb RI
https://eclipse-ee4j.github.io/jaxb-ri/
BSD 3-Clause "New" or "Revised" License
205 stars 111 forks source link

JAXB returns "element is already defined" error in case of common schema imports to multiple other schemas #897

Open Tomas-Kraus opened 12 years ago

Tomas-Kraus commented 12 years ago

I have three xsd's defined, each with a different namespace.

One of the xsd is mapped to namespace "Common".

This is imported into two other xsd's with namespaces "Request" & "Response".

The xml schemas with namespaces "Request" and "Response" form the request and response of a single wsdl.

When WSDL2Java is run in Eclipse, the below error is seen -


Failed to Generate Web Service code, please check the log for more details org.eclipse.core.runtime.CoreException: TODO! Cheek SOAP 1.2 extension WSConsume (CXF) does not allow to setup the JAX-WS specification target, using JAX-WS 2.1. Loading FrontEnd jaxws ... Loading DataBinding jaxb ... wsdl2java -compile -d D:\Code\1234\src -verbose -classdir D:\Code\1234\build\classes http://127.0.0.1:8081/USOMET_Poc1/ebws/Core/CustomerService?wsdl wsdl2java - Apache CXF 2.2.12-patch-02

Failed to invoke WSDLToJava org.apache.cxf.tools.common.ToolException: Thrown by JAXB: 'BaseRequest' is already defined at org.apache.cxf.tools.wsdlto.databinding.jaxb.JAXBBindErrorListener.error(JAXBBindErrorListener.java:41) at com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.error(SchemaCompilerImpl.java:286) at com.sun.tools.xjc.util.ErrorReceiverFilter.error(ErrorReceiverFilter.java:77) at com.sun.xml.xsom.impl.parser.ParserContext$2.error(ParserContext.java:202) at com.sun.xml.xsom.impl.parser.ParserContext$1.reportError(ParserContext.java:180) at com.sun.xml.xsom.impl.parser.NGCCRuntimeEx.reportError(NGCCRuntimeEx.java:170) at com.sun.xml.xsom.impl.parser.NGCCRuntimeEx.reportError(NGCCRuntimeEx.java:173) at com.sun.xml.xsom.impl.parser.NGCCRuntimeEx.checkDoubleDefError(NGCCRuntimeEx.java:145) at com.sun.xml.xsom.impl.parser.state.Schema.action5(Schema.java:87) .......... .......... at com.sun.tools.xjc.ModelLoader.createXSOM(ModelLoader.java:516) at com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerImpl.java:236) at com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerImpl.java:85) at org.apache.cxf.tools.wsdlto.databinding.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:381) at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.generateTypes(WSDLToJavaContainer.java:573) at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.processWsdl(WSDLToJavaContainer.java:228) at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:128) at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:271) 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.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:86) at org.jboss.wsf.stack.cxf.tools.CXFConsumerImpl.consume(CXFConsumerImpl.java:232) at org.jboss.wsf.spi.tools.cmd.WSConsume.importServices(WSConsume.java:230) at org.jboss.wsf.spi.tools.cmd.WSConsume.main(WSConsume.java:81) Caused by: org.xml.sax.SAXParseException: 'BaseRequest' is already defined at com.sun.xml.xsom.impl.parser.ParserContext$1.reportError(ParserContext.java:176) ... 43 more

Environment

JBoss SOA Suite

Affected Versions

[2.1.12]

Tomas-Kraus commented 6 years ago
Tomas-Kraus commented 12 years ago

@glassfishrobot Commented Reported by shankyrams

Tomas-Kraus commented 12 years ago

@glassfishrobot Commented yaroska said: Hi, shankyrams,

can you please provide some small simple testcase for this isue. So I'll be able quickly run and fix it.

Thanks a lot.

Tomas-Kraus commented 12 years ago

@glassfishrobot Commented Was assigned to yaroska

Tomas-Kraus commented 7 years ago

@glassfishrobot Commented This issue was imported from java.net JIRA JAXB-897