JBoss启动时无法转换DailyRollingFileAppender类的解决办法
错误现象:12:49:46,251 INFO [STDOUT] log4j:ERROR A "org.jboss.logging.util.OnlyOnceErrorHandler" object is not assignable to a "o
ache.log4j.spi.ErrorHandler" variable.
12:49:46,252 INFO [STDOUT] log4j:ERROR The class "org.apache.log4j.spi.ErrorHandler" was loaded by
12:49:46,252 INFO [STDOUT] log4j:ERROR [WebappClassLoader
delegate: false
repositories:
/WEB-INF/classes/
----------> Parent Classloader:
] whereas object of type
12:49:46,253 INFO [STDOUT] log4j:ERROR "org.jboss.logging.util.OnlyOnceErrorHandler" was loaded by [org.jboss.system.se
NoAnnotationURLClassLoader@183f74d].
12:49:46,299 INFO [STDOUT] log4j:ERROR Could not create an Appender. Reported error follows.
12:49:46,300 INFO [STDOUT] java.lang.ClassCastException: org.jboss.logging.appender.DailyRollingFileAppender
12:49:46,302 INFO [STDOUT] at org.apache.log4j.xml.DOMConfigurator.parseAppender(DOMConfigurator.java:165)
........................
解决办法:
编辑D:\jboss-4.0.5.GA\server\default\deploy\jbossweb-tomcat55.sar\META-INF\jboss-service.xml文件,修改Java2ClassLoadingCompliance和UseJBossWebLoader为true,即:
<attribute name="Java2ClassLoadingCompliance">true</attribute>
<attribute name="UseJBossWebLoader">true</attribute>
重启服务器即可.