Alan Ezust <[EMAIL PROTECTED]> wrote on 10/18/2005 01:08:03 AM: > On 10/17/05, Elliotte Harold <[EMAIL PROTECTED]> wrote: > > Alan Ezust wrote: > > > > > If SAXParserFactory is to be avoided, then why is it used by the > JDK 1.5 API? > > > In particular, I am wondering about this > > > > The programmers at Sun make the same mistakes everyone else does. > > Remember, they invented SAXParserFactory in the first place. > > Gads, I just realized that the sourcecode for parts of JAXP aren't > even included in the JDK 1.5 src.zip - how annoying. I was trying to > re-engineer the offending classes to use the new SAX API, but I can't > find the sourcecode for > com.sun.beans.ObjectHandler! I wonder why it's so separate from the > rest of the src.zip. > > > Why it's throwing a ClassCastException, I don't know. Sounds like a bug. > > Try printing a stack trace. However, > > java.lang.ClassCastException: > org.apache.xerces.jaxp.SAXParserFactoryImpl > at javax.xml.parsers.SAXParserFactory.newInstance(SAXParserFactory.java:107) > at java.beans.XMLDecoder.readObject(XMLDecoder.java:201) > at org.homedns.krolain.util.InstallInfo.loadInstallPath(InstallInfo.java:60) > at org.homedns.krolain.MochaJournal.JLJSettings. > LoadSettings(JLJSettings.java:172) > at livejournal.LoginPane._load(LoginPane.java:117) > at livejournal.LoginPane.initComponents(LoginPane.java:112) > at livejournal.LoginPane.<init>(LoginPane.java:50) > at livejournal.LiveJournalPanel.<init>(LiveJournalPanel.java:25) > at sun.reflect.NativeConstructorAccessorImpl.newInstance0 (Native Method) > at sun.reflect.NativeConstructorAccessorImpl. > newInstance(NativeConstructorAccessorImpl.ja > > I have, and like the originally quoted message I am quoting, I zeroed > in on some code which is in JAXP, which calls the damned > XMLParserFactory. I didn't write the MochaJournal code either, I > wonder if the MochaJournal code did something to the SAXParserFactory > so that it returns wrongly-typed parsers?
This can happen when different class loaders loaded javax.xml.parsers.SAXParserFactory and org.apache.xerces.jaxp.SAXParserFactoryImpl. > What's strange is that I can call XMLParserFactory.newInstance myself > and it doesn't throw that exception. It's only when it gets called > from JAXP that I run into this situation. > > > "com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl" refers > > specifically to the repackaged version of Xerces in the JDK. The regular > > Apache packages don't have it. > > What version of xerces is included in JDK 1.5? Given that JDK 1.5 was released before Xerces 2.7.0 (which supports JAXP 1.3), there isn't a simple mapping between the two. Whatever is in JDK 1.5 would be considerably different than any Apache Xerces version. > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > Michael Glavassevich XML Parser Development IBM Toronto Lab E-mail: [EMAIL PROTECTED] E-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
