1. 程式人生 > >wsdl2java 生成程式碼報錯

wsdl2java 生成程式碼報錯

錯誤資訊: Exception in thread "main" java.lang.NoSuchMethodError: com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(Lcom/sun/xml/bind/v2/runtime/JAXBContextImpl $JAXBContextBuilder;Lcom/sun/xml/bind/v2/runtime/JAXBContextImpl$1;)V         at com.sun.xml.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1163)         at com.sun.tools.xjc.reader.xmlschema.bindinfo.BindInfo.getJAXBContext(BindInfo.java:335)         at com.sun.tools.xjc.reader.xmlschema.bindinfo.AnnotationParserFactoryImpl$1.<init>(AnnotationParserFactoryImpl.java:85)         at com.sun.tools.xjc.reader.xmlschema.bindinfo.AnnotationParserFactoryImpl.create(AnnotationParserFactoryImpl.java:84)         at com.sun.xml.xsom.impl.parser.NGCCRuntimeEx.createAnnotationParser(NGCCRuntimeEx.java:365)         at com.sun.xml.xsom.impl.parser.state.annotation.action0(annotation.java:88)         at com.sun.xml.xsom.impl.parser.state.annotation.enterElement(annotation.java:113)         at com.sun.xml.xsom.impl.parser.state.NGCCRuntime.sendEnterElement(NGCCRuntime.java:417)         at com.sun.xml.xsom.impl.parser.state.NGCCHandler.spawnChildFromEnterElement(NGCCHandler.java:113)         at com.sun.xml.xsom.impl.parser.state.complexType.enterElement(complexType.java:210)         at com.sun.xml.xsom.impl.parser.state.NGCCRuntime.sendEnterElement(NGCCRuntime.java:417)         at com.sun.xml.xsom.impl.parser.state.NGCCHandler.revertToParentFromEnterElement(NGCCHandler.java:150)         at com.sun.xml.xsom.impl.parser.state.foreignAttributes.enterElement(foreignAttributes.java:90)         at com.sun.xml.xsom.impl.parser.state.NGCCRuntime.sendEnterElement(NGCCRuntime.java:417)         at com.sun.xml.xsom.impl.parser.state.NGCCHandler.spawnChildFromEnterElement(NGCCHandler.java:113)         at com.sun.xml.xsom.impl.parser.state.complexType.enterElement(complexType.java:579)         at com.sun.xml.xsom.impl.parser.state.NGCCRuntime.sendEnterElement(NGCCRuntime.java:417)         at com.sun.xml.xsom.impl.parser.state.complexType.enterElement(complexType.java:342)         at com.sun.xml.xsom.impl.parser.state.NGCCRuntime.sendEnterElement(NGCCRuntime.java:417)         at com.sun.xml.xsom.impl.parser.state.complexType.enterElement(complexType.java:455)         at com.sun.xml.xsom.impl.parser.state.NGCCRuntime.sendEnterElement(NGCCRuntime.java:417)         at com.sun.xml.xsom.impl.parser.state.complexType.enterElement(complexType.java:238)         at com.sun.xml.xsom.impl.parser.state.NGCCRuntime.sendEnterElement(NGCCRuntime.java:417)         at com.sun.xml.xsom.impl.parser.state.complexType.enterElement(complexType.java:432)         at com.sun.xml.xsom.impl.parser.state.NGCCRuntime.sendEnterElement(NGCCRuntime.java:417)         at com.sun.xml.xsom.impl.parser.state.complexType.enterElement(complexType.java:369)         at com.sun.xml.xsom.impl.parser.state.NGCCRuntime.startElement(NGCCRuntime.java:258)         at org.xml.sax.helpers.XMLFilterImpl.startElement(XMLFilterImpl.java:527)         at com.sun.tools.xjc.util.SubtreeCutter.startElement(SubtreeCutter.java:108)         at com.sun.tools.xjc.reader.ExtensionBindingChecker.startElement(ExtensionBindingChecker.java:150)         at org.xml.sax.helpers.XMLFilterImpl.startElement(XMLFilterImpl.java:527)         at com.sun.tools.xjc.reader.xmlschema.parser.IncorrectNamespaceURIChecker.startElement(IncorrectNamespaceURIChecker.java:128)         at org.xml.sax.helpers.XMLFilterImpl.startElement(XMLFilterImpl.java:527)         at com.sun.tools.xjc.reader.xmlschema.parser.CustomizationContextChecker.startElement(CustomizationContextChecker.java:193)         at org.xml.sax.helpers.XMLFilterImpl.startElement(XMLFilterImpl.java:527)         at com.sun.tools.xjc.reader.internalizer.DOMForestScanner$LocationResolver.startElement(DOMForestScanner.java:147)         at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:224)         at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:261)         at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:230)         at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:261)         at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:230)         at com.sun.xml.bind.unmarshaller.DOMScanner.scan(DOMScanner.java:107)         at com.sun.tools.xjc.reader.internalizer.DOMForestScanner.scan(DOMForestScanner.java:92)         at com.sun.tools.xjc.reader.internalizer.DOMForestScanner.scan(DOMForestScanner.java:100)         at com.sun.tools.xjc.reader.internalizer.DOMForestParser.parse(DOMForestParser.java:104)         at com.sun.tools.xjc.ModelLoader$XMLSchemaParser.parse(ModelLoader.java:270)         at com.sun.xml.xsom.impl.parser.NGCCRuntimeEx.parseEntity(NGCCRuntimeEx.java:347)         at com.sun.xml.xsom.impl.parser.NGCCRuntimeEx.includeSchema(NGCCRuntimeEx.java:249)         at com.sun.xml.xsom.impl.parser.state.includeDecl.action0(includeDecl.java:82)         at com.sun.xml.xsom.impl.parser.state.includeDecl.leaveElement(includeDecl.java:160)         at com.sun.xml.xsom.impl.parser.state.NGCCRuntime.endElement(NGCCRuntime.java:314)         at org.xml.sax.helpers.XMLFilterImpl.endElement(XMLFilterImpl.java:546)         at com.sun.tools.xjc.util.SubtreeCutter.endElement(SubtreeCutter.java:112)         at org.xml.sax.helpers.XMLFilterImpl.endElement(XMLFilterImpl.java:546)         at org.xml.sax.helpers.XMLFilterImpl.endElement(XMLFilterImpl.java:546)         at com.sun.tools.xjc.reader.xmlschema.parser.CustomizationContextChecker.endElement(CustomizationContextChecker.java:199)         at org.xml.sax.helpers.XMLFilterImpl.endElement(XMLFilterImpl.java:546)         at com.sun.tools.xjc.reader.internalizer.DOMForestScanner$LocationResolver.endElement(DOMForestScanner.java:140)         at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:235)         at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:261)         at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:230)         at com.sun.xml.bind.unmarshaller.DOMScanner.scan(DOMScanner.java:107)         at com.sun.tools.xjc.reader.internalizer.DOMForestScanner.scan(DOMForestScanner.java:92)         at com.sun.tools.xjc.reader.internalizer.DOMForestScanner.scan(DOMForestScanner.java:100)         at com.sun.tools.xjc.reader.internalizer.DOMForestParser.parse(DOMForestParser.java:104)         at com.sun.tools.xjc.ModelLoader$XMLSchemaParser.parse(ModelLoader.java:270)         at com.sun.xml.xsom.impl.parser.NGCCRuntimeEx.parseEntity(NGCCRuntimeEx.java:347)         at com.sun.xml.xsom.impl.parser.ParserContext.parse(ParserContext.java:128)         at com.sun.xml.xsom.parser.XSOMParser.parse(XSOMParser.java:168)         at com.sun.xml.xsom.parser.XSOMParser.parse(XSOMParser.java:157)         at com.sun.tools.xjc.ModelLoader.createXSOM(ModelLoader.java:528)         at com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerImpl.java:268)         at com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerImpl.java:94)         at org.apache.cxf.tools.wsdlto.databinding.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:410)         at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.generateTypes(WSDLToJavaContainer.java:589)         at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.processWsdl(WSDLToJavaContainer.java:242)         at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:139)         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.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:86)         at org.apache.cxf.tools.wsdlto.WSDLToJava.main(WSDLToJava.java:184) C:\Users> 該問題是由於之前修改了jre,在ext中加了幾個jar包
還原後即可解決,還原後如下圖