Answered
Using Log4J from JRUN leads to ClassLoader conflict
Summary:
Using Log4J from JRUN leads to ClassLoader conflict
Steps to reproduce:
I created a java class file that uses Log4J. I packaged it in a jar and put it in the directory "JRun4\servers\cfusion\cfusion-ear\cfusion-war\WEB-INF\lib". When I use the <CFOBJECT> tag to instantiate the class, I receive an error message:
log4j:ERROR Could not instantiate appender named "adest".
log4j:ERROR A "org.apache.log4j.ConsoleAppender" object is not assignable to a "org.apache.log4j.Appender" variable.
log4j:ERROR The class "org.apache.log4j.Appender" was loaded by
log4j:ERROR [sun.misc.Launcher$AppClassLoader@53ba3d] whereas object of type
log4j:ERROR "org.apache.log4j.ConsoleAppender" was loaded by [coldfusion.bootstrap.BootstrapClassLoader@4ca6b6].
The messages show up in the cfusion-err.log. My Appender is called adest, so I know it is finding the class and running it. Maybe someone who knows more about how ColdFusion and JRun classloaders work together can help me. I have checked out similar posts, but nothing is quite like this one.
My Log4J configuration file is named "x_log4j.properties", and has this entry:
...
log4j.category.ihf.logging.IHFAgentLogger=WARN, adest
!-----------------------------------------------------------------------------!
! Declare an output file for the IHF Agent Applications logger !
!-----------------------------------------------------------------------------!
log4j.appender.adest=org.apache.log4j.RollingFileAppender
log4j.appender.adest.File=C:\\Work\\agent_applications.log
log4j.appender.adest.layout=org.apache.log4j.PatternLayout
log4j.appender.adest.layout.ConversionPattern=%p|+|%d{yyyy-MM-dd}|+|%d{HH:mm:ss:SSS}|+|%m|+|%n
log4j.appender.adest.MaxFileSize=25KB
log4j.appender.adest.MaxBackupIndex=5
log4j.additivity.ihf.logging.IHFAgentLogger=false
...
What should have happened?:
I should have not seen an error and a new log file specified by my .properties file would be created and receive output from the ColdFusion call
Product version: ColdFusion MX7 7,0,0,91690
Product-version: JRun 4 (Build 84683)
Platform information: Windows
Hardware:
OS Version: XP
RAM:
Color Depth:
Using Log4J from JRUN leads to ClassLoader conflict
Steps to reproduce:
I created a java class file that uses Log4J. I packaged it in a jar and put it in the directory "JRun4\servers\cfusion\cfusion-ear\cfusion-war\WEB-INF\lib". When I use the <CFOBJECT> tag to instantiate the class, I receive an error message:
log4j:ERROR Could not instantiate appender named "adest".
log4j:ERROR A "org.apache.log4j.ConsoleAppender" object is not assignable to a "org.apache.log4j.Appender" variable.
log4j:ERROR The class "org.apache.log4j.Appender" was loaded by
log4j:ERROR [sun.misc.Launcher$AppClassLoader@53ba3d] whereas object of type
log4j:ERROR "org.apache.log4j.ConsoleAppender" was loaded by [coldfusion.bootstrap.BootstrapClassLoader@4ca6b6].
The messages show up in the cfusion-err.log. My Appender is called adest, so I know it is finding the class and running it. Maybe someone who knows more about how ColdFusion and JRun classloaders work together can help me. I have checked out similar posts, but nothing is quite like this one.
My Log4J configuration file is named "x_log4j.properties", and has this entry:
...
log4j.category.ihf.logging.IHFAgentLogger=WARN, adest
!-----------------------------------------------------------------------------!
! Declare an output file for the IHF Agent Applications logger !
!-----------------------------------------------------------------------------!
log4j.appender.adest=org.apache.log4j.RollingFileAppender
log4j.appender.adest.File=C:\\Work\\agent_applications.log
log4j.appender.adest.layout=org.apache.log4j.PatternLayout
log4j.appender.adest.layout.ConversionPattern=%p|+|%d{yyyy-MM-dd}|+|%d{HH:mm:ss:SSS}|+|%m|+|%n
log4j.appender.adest.MaxFileSize=25KB
log4j.appender.adest.MaxBackupIndex=5
log4j.additivity.ihf.logging.IHFAgentLogger=false
...
What should have happened?:
I should have not seen an error and a new log file specified by my .properties file would be created and receive output from the ColdFusion call
Product version: ColdFusion MX7 7,0,0,91690
Product-version: JRun 4 (Build 84683)
Platform information: Windows
Hardware:
OS Version: XP
RAM:
Color Depth:
