Java 5 不验证 DTD
我正在使用供应商小程序,该小程序在 JRE 1.4.2_X 和 1.6.X 上工作正常,但在 1.5.X 的每个版本上都失败。使用 1.6 运行不是一个选项,因为另一个应用程序冲突与 Java 6 不能很好地配合。
我认为问题是 DTD 没有得到验证。这导致了“未声明”问题和产生的空指针。
Error: Fri Aug 28 11:21:29 EDT 2009 org.xml.sax.SAXParseException:
Element type "UserSessionList" is not declared.
java.lang.NullPointerException
我尝试更改默认验证类,但问题仍然存在。
-Djavax.xml.validation.SchemaFactory:http://relaxng.org/ns/structure
/1.0=org.apache.xerces.jaxp.validation.XMLSchemaFactory
我可以使用其他验证吗?
我确实无法选择修改该小程序的代码,该小程序已超出供应商的生命周期,因此不太可能获得他们的支持。因此,任何解决方法都不能涉及更改代码,因为我们不拥有它。
I am working with a vendor applet, The applet works fine with JRE 1.4.2_X and 1.6.X but fails on every version of 1.5.X. Running with 1.6 is not an option due to another application conflict that does not play nice with Java 6.
The issue I believe is that the DTD is not being validated. This is causing the "not declared" problem and the resulting nullpointer.
Error: Fri Aug 28 11:21:29 EDT 2009 org.xml.sax.SAXParseException:
Element type "UserSessionList" is not declared.
java.lang.NullPointerException
I tried changing the default validation class but the problem remains unchanged.
-Djavax.xml.validation.SchemaFactory:http://relaxng.org/ns/structure
/1.0=org.apache.xerces.jaxp.validation.XMLSchemaFactory
Is there another validation I can use for this?
I don't really have the option of modifying the code the applet is beyond end of life from the vendor so getting support from them is unlikely. So any workarounds cannot involve changing code since we do not own it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
尝试将当前版本的 Xerces 放入类路径中,并删除所有这些 -D。 Xerces 中的 SPI 将接管所有这一切并且可能表现得更好。
Try putting a current version of Xerces into the classspath, and get rid of all of those -D's. The SPI in Xerces will take over all of this and might behave better.
您可以在不修改所有现有代码的情况下部署小程序,并指定它在哪个版本的 Java 下执行。您可以通过使用小程序声明
classid
参数来实现此目的,如下所示:的最后四个主要版本使用不同的
classid
Java 1.3 CAFEEFAC-0013-0001-FFFF-ABCDEFFEDDCBA
1.4 使用 CAFEEFAC-0014-0002-FFFF-ABCDEFFEDCBA
1.5 使用 CAFEEFAC-0015-0000-FFFF-ABCDEFFEDCBA
1.6 使用 CAFEEFAC-0016-0000-FFFF-ABCDEFFEDCBA
需要注意的是,客户端计算机必须安装该版本的 Java,但 JRE 仍然可以在 Sun 的站点上找到。更多信息请参见:http://java.sun.com/javase/ 6/webnotes/family-clsid.html
因此,您可以强制您的小程序仅运行 1.4,并且最终用户是否安装了其他版本的 Java 并不重要,只要他们有 1.4 来运行您的应用程序即可。小程序。
You can deploy the applet with all the existing code unmodified and specify which version of Java it executes under. You do this by declaring a
classid
parameter with the applet, like so:There are different
classids
for the last four major releases of Java1.3 use CAFEEFAC-0013-0001-FFFF-ABCDEFFEDCBA
1.4 use CAFEEFAC-0014-0002-FFFF-ABCDEFFEDCBA
1.5 use CAFEEFAC-0015-0000-FFFF-ABCDEFFEDCBA
1.6 use CAFEEFAC-0016-0000-FFFF-ABCDEFFEDCBA
The caveat is that the client machine must have that version of Java installed, but the JREs are still available on Sun's site. More information here: http://java.sun.com/javase/6/webnotes/family-clsid.html
You can therefore mandate that your applet runs only 1.4, and it will not matter if the end user has another version of Java installed, as long as they have a 1.4 to run your applet.
看起来 Xerces 与 Java 1.5 一起使用时可能存在错误。请参阅对此 Tomcat 错误的最后评论。
It looks like there might have been a bug present in Xerces when used with Java 1.5. See the last comment on this Tomcat bug.