webservice生成客户端文件报错
Posted 丶柚子
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了webservice生成客户端文件报错相关的知识,希望对你有一定的参考价值。
E:softJavaJDK1.8injava.exe -classpath E:code estoutproduction est;E:code estlibha-api.jar;E:code estlibjavax.annotation.jar;E:code estlibgmbal-api-only.jar;E:code estlibFastInoset.jar;E:code estlibjaxb-api.jar;E:code estlibjaxb-impl.jar;E:code estlibjaxws-api.jar;E:code estlibjsr181-api.jar;E:code estlibjaxws-tools.jar;E:code estlibjaxb-xjc.jar;E:code estlibjaxws-rt.jar;E:code estlibmanagement-api.jar;E:code estlibmail.jar;E:code estlibpolicy.jar;E:code estlibsaaj-api.jar;E:code estlibmimepull.jar;E:code estlibstax2-api.jar;E:code estlibsaaj-impl.jar;E:code estlibstax-ex.jar;E:code estlibstreambuffer.jar;E:code estlibwoodstox-core-asl.jar;E:softJavaJDK1.8lib ools.jar;E:/code/test/out/production/test -Xmx128M com.sun.tools.ws.WsImport -p com -d E:code estsrc -s E:code estsrc -extension -wsdllocation http://zjjtest.sz.gov.cn/message/construct-platform/service/SMSService?wsdl http://zjjtest.sz.gov.cn/message/construct-platform/service/SMSService?wsdl
??????? WSDL...
Exception in thread "main" java.lang.AssertionError: org.xml.sax.SAXParseException; systemId: jar:file:/E:/code/test/lib/jaxb-xjc.jar!/com/sun/tools/xjc/reader/xmlschema/bindinfo/binding.xsd; lineNumber: 52; columnNumber: 88; schema_reference: ???? accessExternalSchema 由于 accessExternalSchema 属性设置的限制而不允许 ‘file‘ 访问, 因此无法读取方案文档 ‘xjc.xsd‘。
at com.sun.tools.xjc.SchemaCache.newValidator(SchemaCache.java:80)
at com.sun.tools.xjc.reader.internalizer.SCDBasedBindingSet.apply(SCDBasedBindingSet.java:237)
at com.sun.tools.xjc.ModelLoader.createXSOM(ModelLoader.java:541)
at com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerImpl.java:269)
at com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerImpl.java:95)
at com.sun.tools.ws.processor.modeler.wsdl.JAXBModelBuilder.bind(JAXBModelBuilder.java:142)
at com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.buildJAXBModel(WSDLModeler.java:2244)
at com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.internalBuildModel(WSDLModeler.java:191)
at com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.buildModel(WSDLModeler.java:137)
at com.sun.tools.ws.wscompile.WsimportTool.buildWsdlModel(WsimportTool.java:391)
at com.sun.tools.ws.wscompile.WsimportTool.run(WsimportTool.java:204)
at com.sun.tools.ws.wscompile.WsimportTool.run(WsimportTool.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.sun.tools.ws.Invoker.invoke(Invoker.java:135)
at com.sun.tools.ws.WsImport.main(WsImport.java:57)
Caused by: org.xml.sax.SAXParseException; systemId: jar:file:/E:/code/test/lib/jaxb-xjc.jar!/com/sun/tools/xjc/reader/xmlschema/bindinfo/binding.xsd; lineNumber: 52; columnNumber: 88; schema_reference: ???? accessExternalSchema ???????õ???????????? ‘file‘ ????, ???????????????? ‘xjc.xsd‘??
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:177)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:400)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaErr(XSDHandler.java:4154)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaFatalError(XSDHandler.java:4133)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.getSchemaDocument(XSDHandler.java:2174)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.resolveSchema(XSDHandler.java:2084)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.constructTrees(XSDHandler.java:1014)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.parseSchema(XSDHandler.java:625)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadSchema(XMLSchemaLoader.java:610)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:569)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:535)
at com.sun.org.apache.xerces.internal.jaxp.validation.XMLSchemaFactory.newSchema(XMLSchemaFactory.java:254)
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)
... 17 more
Done
问题描述
配置JDK版本和JRE版本为1.8.0_151。
使用IDEA开发WebService客户端时遇到这个问题。
在终端使用命令java -version
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=gasp
java version "1.8.0_151"
Java(TM) SE Runtime Environment (build 1.8.0_151-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode)
可以看到第一行有设置_JAVA_OPTIONS,按照其他教程中所说的配置/etc/profile文件,追加一行unset JAVA_TOOL_OPTIONS并不能起到作用。(很可能是操作系统的原因)
问题原因
使用JDK和JRE1.8版本时,有这样一个BUG。
详情见https://bugs.openjdk.java.net/browse/JDK-8020999
解决方案
在jdk的安装路径下的jrelib下(我的路径为/usr/local/jdk1.8.0_151/jre/lib),添加一个属性文件jaxp.properties,并写上如下内容javax.xml.accessExternalSchema = all
以上是关于webservice生成客户端文件报错的主要内容,如果未能解决你的问题,请参考以下文章