开发者

Loading different version of IBM's JDK XML libraries

We are using Axis to invoke web services in a Sun JDK, but when we change to IBM JDK we get errors with XML libraries.

Sun's JDK repackages implementation of XML components as com.sun.* and they are easy to replace using factory mechanisms. That doesn't happen with IBM's JDK and then it is not possible to replace an implementation with a newer version of the same class (JDK classes are loaded before application classes).

One solution is to use -Xbootclasspath/p: to override JDKs classes but, is there a 'standard' way to tell IBM's JVM to load a newer version of the XML libraries rather th开发者_开发问答an its default?


The simplest way to pick which version of XML components gets used is to access them through the JAXP/TrAX APIs, which are the portable factory mechanism. For example, if you use the javax.xml.parsers package to get access to your parser, you can control which actual parser factory class is loaded by setting a system property, a configuration file, or the services API.

I'd also note that Sun's JDK has notoriously been backlevel on its XML support compared to IBM's JDKs. It is almost always necessary to replace the Sun packages with a more recent version from Apache. That is much less frequently necessary with the IBM processor; IBM has done a much better job of actively maintaining its code. (In fact, IBM was the primary contributor to the Apache XML parser and XSLT/XPath processor for many years.)

You haven't told us what the errors are, or which version of the IBM JDK you're using, but my admittedly heavily biased guess is that the IBM code is likely to be more correct rather than less so.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜