Applet 失败中的 SAX 解析器
我的源代码中有一行非常简单的代码:
XMLReader xmlReaderFactory = XMLReaderFactory.createXMLReader();
这在应用程序中完美地工作,但是,在小程序中,它尝试从服务器加载“.class”文件(没有类名,只有扩展名,正如您所看到的)然后无法给我一个解析器。
Exception in thread "Thread-13" java.lang.ClassFormatError: Incompatible magic value 218762506 in class file
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.xml.sax.helpers.NewInstance.newInstance(Unknown Source)
at org.xml.sax.helpers.XMLReaderFactory.loadClass(Unknown Source)
at org.xml.sax.helpers.XMLReaderFactory.createXMLReader(Unknown Source)
可能是什么问题呢?
I have a very simple line of code in my source:
XMLReader xmlReaderFactory = XMLReaderFactory.createXMLReader();
This works flawlessly from an application, however, from an applet, it attempts to load a ".class" file from the server (no classname, just the extension just as you see) and then fails to give me a parser.
Exception in thread "Thread-13" java.lang.ClassFormatError: Incompatible magic value 218762506 in class file
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.xml.sax.helpers.NewInstance.newInstance(Unknown Source)
at org.xml.sax.helpers.XMLReaderFactory.loadClass(Unknown Source)
at org.xml.sax.helpers.XMLReaderFactory.createXMLReader(Unknown Source)
What could be the problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看起来您似乎正在尝试配置 JRE 中以外的 SAX 实现的使用。 配置指向以至少两个空行开头的 Windows 文本文件。 SAX 实现可以通过系统属性 org.xml.sax.driver 进行配置,或者包含在名称为 META-INF/services/org.xml.sax.driver 的 jar 中的文件中。
It looks as if you are attempting to configure the use of a SAX implementation other than that in the JRE. The configuration is pointing to a Windows text files starting with at least two empty lines. SAX implementations may be configured through the system property
org.xml.sax.driver
or contained in a file within a jar of the nameMETA-INF/services/org.xml.sax.driver
.您可能会从服务器返回该类文件的 404 错误。 有关详细信息,请参阅此错误报告。
You might be getting back a 404 error from the server for that class file. See this bug report for details.