ちょっと適当な書き方になりますが、とりあえずわかったことをまとめてみる。
Webアプリケーション内でJAXPを実装しているJarファイルを複数使っている場合、WLの起動で失敗したり、Strutsの起動に失敗したりと散々な結果になった。
XMLプロセッサの切り替え
これを行う方法は以下のどれかを使える。プログラムは以下の順で検索していくらしい。
- javax.xml.parsers.DocumentBuilderFactoryシステムプロパティ。「javax.xml.parsers.DocumentBuilderFactory=weblogic.xml.jaxp.RegistryDocumentBuilderFactory」みたいに
- JREディレクトリにjaxp.propertiesを置く。(例)lib/jaxp.properties
- 実行時に使用可能なjarファイル中にある「META-INF/services/javax.xml.parsers.DocumentBuilderFactory」で示されたクラス名。
- プラットフォームのデフォルトDocumentBuilderFactoryインスタンス。
参考:http://www.utj.co.jp/XML/dev/java/dxjava_1.html
WebLogic9.2で使っているXMLプロセッサ
WebLogic9.2では何をつかっているのかを調べてみた。
try {
DocumentBuilderFactory dbfactory = DocumentBuilderFactory.newInstance();
out.println("DocumentBuilderFactory = " + dbfactory.getClass().getName());
DocumentBuilder builder = dbfactory.newDocumentBuilder();
out.println("DocumentBuilder = " + builder.getClass().getName());
SAXParserFactory spfactory = SAXParserFactory.newInstance();
out.println("SAXParserFactory = " + spfactory.getClass().getName());
SAXParser parser = spfactory.newSAXParser();
out.println("SAXParser = " + parser.getClass().getName());
TransformerFactory trfactory = TransformerFactory.newInstance();
out.println("TransformerFactory = " + trfactory.getClass().getName());
} catch(Exception e) {
e.printStackTrace();
}
//実行結果 DocumentBuilderFactory = weblogic.xml.jaxp.RegistryDocumentBuilderFactory DocumentBuilder = weblogic.xml.jaxp.RegistryDocumentBuilder SAXParserFactory = weblogic.xml.jaxp.RegistrySAXParserFactory SAXParser = weblogic.xml.jaxp.RegistrySAXParser TransformerFactory = weblogic.xml.jaxp.RegistrySAXTransformerFactory
XMLプロセッサの切り替えをWLから行う
WLのConsoleから設定可能。設定単位はサーバごとになるらしい。
参考:http://www.beasys.co.jp/e-docs/wls/docs91/ConsoleHelp/taskhelp/xml/CreateXMLRegistry.html