Announcement Announcement Module
Collapse
No announcement yet.
Log4j, Commons Logging in JRun 4 problem Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Log4j, Commons Logging in JRun 4 problem

    I am trying to use log4j through Spring in JRun 4. Anyone with Spring knowledge might be able to help with this.

    Macromedia says there is an issue where having log4j.jar and commons-logging.jar in WEB-INF/lib causes a conflict, resulting in a ClassNotFound error (which will be fixed in a patch in the future). I have moved these 2 jars to a separate directory which I put in the classpath in jvm.config. My applicationContext.xml contains:
    Code:
    <bean id="log4jLogger"
    		class="org.springframework.beans.factory.config.CommonsLogFactoryBean">
    		<property name="logName" value="com.isis" />
    	</bean>
    I now get a ClassCastException. This is because commons logging is picking up jrunx.axis.Logging instead of log4j, which is a problem!

    In my jrun-web.xml I have set load-system-classes-first to false.

    Any ideas on how to get around this problem, perhaps by changing my Spring logging bean to get log4j in a different way?

  • #2
    Can you show the full stack trace of the error and the code that is causing the ClassCastException?

    Rob

    Comment


    • #3
      Code and error

      Code:
      Log4JLogger log4jLogger = &#40;Log4JLogger&#41; springApplicationContext.getBean&#40;"log4jLogger"&#41;;
      where Log4JLogger is org.apache.commons.logging.impl.Log4JLogger.

      The stack trace I have only shows the ClassCastException (because it is trying to cast jrunx.axis.Logging to Log4JLogger... For some reason org.springframework.beans.factory.config.CommonsLo gFactoryBean is picking up the this before log4j due to classpath issues in JRun. Perhaps there is a way to force it to use log4j?

      Comment


      • #4
        Maybe it helps to put a commons-logging.properties file in your classpath to explicitly configure the logger.

        Add
        Code:
        org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger
        to this file. Maybe it will work then.

        Regards,
        Andreas

        Comment


        • #5
          That worked

          Thanks, that worked! Now I just have to figure out why my message resourcing and Jacorb configurations are not working in JRun :-(

          Comment

          Working...
          X