JBoss Community

Re: Web service client in EJB 3.x - best practice

created by Mustafa Musaji in Beginner's Corner - View the full discussion

So I tried using wsconsume.sh directly from a JBoss + CXF and got the following stack

 

org.apache.cxf.tools.common.ToolException: Thrown by JAXB : Two declarations cause a collision in the ObjectFactory class.

    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.tools.xjc.ErrorReceiver.error(ErrorReceiver.java:82)

    at com.sun.tools.xjc.generator.bean.ObjectFactoryGeneratorImpl.populate(ObjectFactoryGeneratorImpl.java:187)

    at com.sun.tools.xjc.generator.bean.PublicObjectFactoryGenerator.populate(PublicObjectFactoryGenerator.java:55)

    at com.sun.tools.xjc.generator.bean.BeanGenerator.<init>(BeanGenerator.java:242)

    at com.sun.tools.xjc.generator.bean.BeanGenerator.generate(BeanGenerator.java:175)

    at com.sun.tools.xjc.model.Model.generateCode(Model.java:286)

    at com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerImpl.java:252)

    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:374)

    at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.generateTypes(WSDLToJavaContainer.java:576)

    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:224)

    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: com.sun.istack.SAXParseException2: Two declarations cause a collision in the ObjectFactory clas

 

It looks like the WSDL has two declarations either within a schema import or the WSDL itself that clash. Axis may ignore this which is why it's not exactly the best because this can lead to issues later when developing client side code. You can try and use databinding to rename any clashes but you need to know what they are first.

Reply to this message by going to Community

Start a new discussion in Beginner's Corner at Community