Taxonomy of class loader problems with Jakarta Commons Logging
tomcatで開発をしている時に、コンテキストの更新を何度も行うとOutOfMemoryErrorが発生することがあるので、いろいろ調べていたところ、このページを見つけました。
JCLの、ClassLoaderが絡んだ場合の挙動についてサンプル付きで詳しく説明してあります。
回り道日記 - WebappClassLoader が解放されない件の原因1にて、
- TOMCAT_HOME/bin/commons-logging-api.jar を commons-logging-1.0.4.jar で置きかえる (同名にして上書き)
- TOMCAT_HOME/common/endorsed に log4j.jar を置く
とのことでしたが、これの理由というわけでした。
ただ、今回紹介されている方法はちょっと違いまして、
For Tomcat 5.0.27 and later, Make sure you are using JCL version 1.0.4 or later. Tomcat version 5.0.x ships with an outdated version of JCL.
- Leave the file TOMCAT_HOME/bin/commons-logging-api.jar as is. In particular, do not remove it.
- Place the files commons-logging.jar and log4j.jar in the directory TOMCAT_HOME/commons/lib/.
- Do not include any other copies of commons-logging.jar and log4j.jar in your web-applications' WEB-INF/lib/ directory.
- Do not set the system properties org.apache.commons.logging.LogFactory or org.apache.commons.logging.Log.
というわけで、common/libを利用するというもの。
でも、この方法だと、コンテキスト別のlog4jの設定が効かないのです。。。
はて、、、


コメントする