JDK8的WebService客户端生成错误 [英] WebService Client Generation Error with JDK8
问题描述
我需要在我的项目中使用Web服务。我使用NetBeans,所以我右键单击我的项目,并尝试添加一个新的Web服务客户端。上次我检查时,这是创建Web服务客户端的方法。但它导致了一个AssertionError,说:
I need to consume a web service in my project. I use NetBeans so I right-clicked on my project and tried to add a new "Web Service Client". Last time I checked, this was the way to create a web service client. But it resulted in an AssertionError, saying:
java.lang.AssertionError:org.xml.sax.SAXParseException; systemId:jar:file:/path/to/glassfish/modules/jaxb-osgi.jar!/com/sun/tools/xjc/reader/xmlschema/bindinfo/binding.xsd; lineNumber:52; columnNumber:88; schema_reference:无法读取架构文档 xjc.xsd ,因为 accessExternalSchema 属性设置了限制,因此不允许文件访问。
java.lang.AssertionError: org.xml.sax.SAXParseException; systemId: jar:file:/path/to/glassfish/modules/jaxb-osgi.jar!/com/sun/tools/xjc/reader/xmlschema/bindinfo/binding.xsd; lineNumber: 52; columnNumber: 88; schema_reference: Failed to read schema document 'xjc.xsd', because 'file' access is not allowed due to restriction set by the accessExternalSchema property.
NetBeans的默认Java平台是JDK8(Oracle的正式版),所以当我更改我的netbeans.conf文件并制作JDK7时(也来自Oracle)作为我的默认,一切正常。所以我认为问题出在JDK8上。这是我的 java -version
输出:
The default Java platform for NetBeans was JDK8 (Oracle's official version), so when I changed my netbeans.conf file and made JDK7 (from Oracle, as well) as my default, everything worked fine. So I think the problem is with JDK8. Here is my java -version
output:
java version1.8.0
Java(TM)SE运行时环境(版本1.8.0-b132)
Java HotSpot(TM)64位服务器VM(版本25.0-b70,混合模式)
java version "1.8.0"
Java(TM) SE Runtime Environment (build 1.8.0-b132)
Java HotSpot(TM) 64-Bit Server VM (build 25.0-b70, mixed mode)
目前,我将JDK7作为我的默认Java平台。如果有办法使JDK8工作,请分享。
For now, I'm keeping JDK7 as my default Java platform. If there is a way to make JDK8 work please share.
推荐答案
好吧,我找到了解决方案。 (基于 http://docs.oracle。 com / javase / 7 / docs / api / javax / xml / XMLConstants.html#ACCESS_EXTERNAL_SCHEMA )
Well, I found the solution. (based on http://docs.oracle.com/javase/7/docs/api/javax/xml/XMLConstants.html#ACCESS_EXTERNAL_SCHEMA)
创建名为的文件jaxp .properties
(如果它不存在)在 /path/to/jdk1.8.0/jre/lib
下,然后在其中写入此行:
Create a file named jaxp.properties
(if it doesn't exist) under /path/to/jdk1.8.0/jre/lib
and then write this line in it:
javax.xml.accessExternalSchema = all
这就是全部。享受JDK 8。
That's all. Enjoy JDK 8.
这篇关于JDK8的WebService客户端生成错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!