XML.loadString in WebSphere throws java.lang.VerifyError
I'm calling XML.loadString(...)
in a MDB in WebSphere 6.1 ND. I'm getting java.lang.VerifyError
, similar to that described in this question.
The stacktrace is:
java.lang.VerifyError: class loading constraint violated (class: scala/collection/mutable/StringBuilder method: toSeq()Lscala/collection/Seq;) at pc: 0
at java.lang.J9VMInternals.verifyImpl(Native Method)
at java.lang.J9VMInternals.verify(J9VMInternals.java:59)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:120)
at scala.xml.parsing.FactoryAdapter.<init>(FactoryAdapter.scala:40)
at scala.xml.parsing.NoBindingFactoryAdapter.<init>(NoBindingFactoryAdapter.scala:18)
at scala.xml.factory.XMLLoader$class.adapter(XMLLoader.scala:24)
at scala.xml.XML$.adapter(XML.scala:40)
at scala.xml.factory.XMLLoader$class.loadXML(XMLLoader.scala:37)
at scala.xml.XML$.loadXML(XML.scala:40)
at scala.xml.factory.XMLLoader$class.loadString(XMLLoader.scala:59)
at scala.xml.XML$.loadString(XML.scala:40)
at my code
It happens if I use ConstructingParser
too:
java.lang.VerifyError: class loading constraint violated (class: scala/collection/mutable/StringBuilder method: toSeq()Lscala/collection/Seq;) at pc: 0
at java.lang.J9VMInternals.verifyImpl(Native Method)
at java.lang.J9VMInternals.verify(J9VMInternals.java:59)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:120)
at scala.xml.parsing.MarkupParser$class.$init$(MarkupParser.scala:102)
at scala.xml.parsing.ConstructingParser.<init>(ConstructingParser.scala:47)
at scala.xml.parsing.ConstructingParser$.fromSource(ConstructingParser.scala:22)
I'm us开发者_C百科ing Scala v2.9.0.1
How can I diagnose this class linkage problem?
Edit #1
On some reflection I realised that the problem occured after an unrelated change. On a hunch I fully uninstalled the application from WAS and then reinstalled it. The problem was gone. The problem recurred after the next application update (i.e. overwrite).
After several more hours, and other changes unlreated to Scala XML parsing, I forgot to uninstall/reinstall and did an update instead. The problem did not recur. I can no longer replicate the issue.
Edit #2
The problem came back and can not be solved with uninstall/reinstall alone. Retried with Scala 2.8.1, but the problem persists. Will now try uninstall/turn off server/delete temp files/reinstall/restart server. Wish me luck.
Well, I can't give much more advice than I gave in that answer :-), but in your case, it looks like scala classes are the problem. Where all do you have scala classes? If you're not sure, I would suggest enabling JVM verbose class loading trace, and then you'll at least know the locations of the JARs.
If an MDB is having problems, then you must have set your application class loader to be "parent last", so presumably, you have scala classes in both the application and in a server-associated shared library or other server class path. You'll either need to include all relevant scala classes in your JAR, or you'll need to stop using "parent last".
This was a bug in WebSphere 6 ND. Fixed by applying fixpack 37. As you were.
edit: in fact, a bug in the IBM JRE of WAS 6, as evidenced by the fact that the error is reproduced when using scalac with it.
精彩评论