用CXF中的wsdl2java工具时抛出SAXParseException,提示accessExternalS

J2EE 码拜 3年前 (2017-04-17) 954次浏览
用CXF中的wsdl2java工具时抛出SAXParseException,提示accessExternalSchema属性设置的限制而不允许file访问
具体的信息如下, 请教web-service高手, 本人改怎么样解决, 百度了一圈都没能找到答案

G:\myeclipseworkspace\WS-client\src>wsdl2java http://192.168.1.4/server?wsdl
Exception in thread "main" java.lang.AssertionError: org.xml.sax.SAXParseExcepti
on; systemId: jar:file:/F:/apache-cxf-3.0.0/lib/jaxb-xjc-2.2.7.jar!/com/sun/tool
s/xjc/reader/xmlschema/bindinfo/binding.xsd; lineNumber: 52; columnNumber: 88; s
chema_reference: 由于 accessExternalSchema 属性设置的限制而不允许 "file" 访问,
因此无法读取方案文档 "xjc.xsd"。
        at com.sun.tools.xjc.SchemaCache.newValidator(SchemaCache.java:80)
        at com.sun.tools.xjc.reader.internalizer.SCDBasedBindingSet.apply(SCDBas
edBindingSet.java:237)
        at com.sun.tools.xjc.ModelLoader.createXSOM(ModelLoader.java:541)
        at com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompiler
Impl.java:269)
        at com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompiler
Impl.java:95)
        at org.apache.cxf.tools.wsdlto.databinding.jaxb.JAXBDataBinding.initiali
ze(JAXBDataBinding.java:460)
        at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.generateTypes(WSDLToJ
avaContainer.java:714)
        at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.processWsdl(WSDLToJav
aContainer.java:270)
        at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaCon
tainer.java:164)
        at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaCon
tainer.java:412)
        at org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.ja
va: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)
Caused by: org.xml.sax.SAXParseException; systemId: jar:file:/F:/apache-cxf-3.0.
0/lib/jaxb-xjc-2.2.7.jar!/com/sun/tools/xjc/reader/xmlschema/bindinfo/binding.xs
d; lineNumber: 52; columnNumber: 88; schema_reference: 由于 accessExternalSchema
 属性设置的限制而不允许 "file" 访问, 因此无法读取方案文档 "xjc.xsd"。
        at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAX
ParseException(ErrorHandlerWrapper.java:203)
        at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalErro
r(ErrorHandlerWrapper.java:177)
        at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(
XMLErrorReporter.java:441)
        at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.repo
rtSchemaErr(XSDHandler.java:4162)
        at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.repo
rtSchemaFatalError(XSDHandler.java:4141)
        at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.getS
chemaDocument(XSDHandler.java:2168)
        at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reso
lveSchema(XSDHandler.java:2078)
        at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.cons
tructTrees(XSDHandler.java:1008)
        at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.pars
eSchema(XSDHandler.java:620)
        at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadSchema
(XMLSchemaLoader.java:616)
        at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGramma
r(XMLSchemaLoader.java:574)
        at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGramma
r(XMLSchemaLoader.java:540)
        at com.sun.org.apache.xerces.internal.jaxp.validation.XMLSchemaFactory.n
ewSchema(XMLSchemaFactory.java:255)
        at javax.xml.validation.SchemaFactory.newSchema(SchemaFactory.java:638)
        at javax.xml.validation.SchemaFactory.newSchema(SchemaFactory.java:670)
        at com.sun.tools.xjc.SchemaCache.newValidator(SchemaCache.java:77)
        ... 13 more
解决方案

50

刚好也遇到这个问题,看到这个才知道原因用CXF中的wsdl2java工具时抛出SAXParseException,提示accessExternalS

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明用CXF中的wsdl2java工具时抛出SAXParseException,提示accessExternalS
喜欢 (0)
[1034331897@qq.com]
分享 (0)