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?
-
You might be getting back a 404 error from the server for that class file. See this bug report for details.
jsight : I guess that is a possibility. For the moment, I've worked around it by hardcoding the xml parser name (ugly). Why would it even try to load a class with a empty name, though?Tom Hawtin - tackline : Ah. It tries to read the web page META-INF/services/org.xml.sax.driver. Because you have a badly behaved web server it gets back a valid page with an empty first line. It use that empty line as the class name to load. Which again because of a web server fault is returned as a file starting \r\n\r\n.Tom Hawtin - tackline : So quick fix - I think you can place a completely empty file of that name on the web server (or just fix the web server). -
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
.
0 comments:
Post a Comment