Details

    • Type: Bug Bug
    • Status: Closed
    • Resolution: Fixed
    • Affects Version/s: 6.0.2 RC, 6.0.11 EE, 6.1.0 CE RC1
    • Fix Version/s: 6.0.12 EE, 6.1.0 CE RC1
    • Component/s: UI Infrastructure
    • Labels:
      None
    • Environment:
      6.0, at revision: 51611
    • Liferay Contributor's Agreement:
      Accept
    • Similar Issues:
      Show 5 results 

      Description

      The deploy process added log4j.jar for any plugins. This will cause errors in tomcat like following.

      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 [WebappClassLoader
      delegate: false
      repositories:
      /WEB-INF/classes/
      ----------> Parent Classloader:
      org.apache.catalina.loader.StandardClassLoader@1ac1fe4
      ] whereas object of type
      log4j:ERROR "org.apache.log4j.ConsoleAppender" was loaded by [WebappClassLoader
      delegate: false
      repositories:
      /WEB-INF/classes/
      ----------> Parent Classloader:
      org.apache.catalina.loader.StandardClassLoader@1ac1fe4
      ].
      log4j:ERROR Could not instantiate appender named "CONSOLE".

      How to fix it? change the deployment process.

        Activity

        Hide
        Mika Koivisto added a comment -

        This was fixed for 6.0 Enterprise Edition and upcoming 6.1 Community Edition.

        Show
        Mika Koivisto added a comment - This was fixed for 6.0 Enterprise Edition and upcoming 6.1 Community Edition.
        Hide
        T Chaudhry added a comment -

        Thanks.

        Have there been other changes included in the EE or CE to fix this issue?

        I don't see how simply not adding the log4j and commons-logging jar files to my web app's WEB-INF/lib folder will fix this issue. As I previously stated, when those jars are not present and I start my Glassfish server, I see a NoClassDefFoundError.

        Show
        T Chaudhry added a comment - Thanks. Have there been other changes included in the EE or CE to fix this issue? I don't see how simply not adding the log4j and commons-logging jar files to my web app's WEB-INF/lib folder will fix this issue. As I previously stated, when those jars are not present and I start my Glassfish server, I see a NoClassDefFoundError.
        Hide
        T Chaudhry added a comment -

        Just so that you are clear, my problem is intermittent, sort of.

        When I have a clean Glassfish/Liferay without my web application portlet, everything seems to be fine. Then I drop my portlet web application under Glassfish/deploy folder and it gets auto deployed. Logging works fine and my app log files are correctly generated. Now when I stop and start glassfish a number of times (anywhere between 1 to 5), at some point in time, logging fails. The message that I see in glassfish's server.log file is:

        [#|2011-06-16T13:49:25.071-0400|WARNING|sun-appserver2.1|javax.enterprise.system.stream.err|_ThreadID=15;_ThreadName=pool-1-thread-1;_RequestID=a8bc2c92-236d-4108-93da-1179908be7e2;|log4j:ERROR A "org.apache.log4j.ConsoleAppender" object is not assignable to a "org.apache.log4j.Appender" variable.|#]

        [#|2011-06-16T13:49:25.077-0400|WARNING|sun-appserver2.1|javax.enterprise.system.stream.err|_ThreadID=15;_ThreadName=pool-1-thread-1;_RequestID=a8bc2c92-236d-4108-93da-1179908be7e2;|
        log4j:ERROR The class "org.apache.log4j.Appender" was loaded by |#]

        [#|2011-06-16T13:49:25.077-0400|WARNING|sun-appserver2.1|javax.enterprise.system.stream.err|_ThreadID=15;_ThreadName=pool-1-thread-1;_RequestID=a8bc2c92-236d-4108-93da-1179908be7e2;|
        log4j:ERROR [WebappClassLoader
        delegate: true
        repositories:
        /WEB-INF/classes/
        ----------> Parent Classloader:
        EJBClassLoader :
        urlSet = []
        doneCalled = false
        Parent -> java.net.URLClassLoader@cb42cf

        ] whereas object of type |#]

        After this error appears, no matter how many times I restart Glassfish, the error always shows up at start up. Also, my web app's log files are no longer generated! The only workaround that works for me is to undeploy my web app, clean up glassfish directories, restart glassfish and redeploy my web app.

        As you can imagine, this is not much of a workaround since doing this in production env, (power failure, system reboot, etc) will be extremely painful.

        My web application contains a log4j.properties file in the WEB-INF/classes folder. Neither log4j or commons-logging are packaged in the WEB-INF/lib directory. When my web app gets deployed, I can see that LifeRay does indeed add those jars files to the web apps's lib directory. If I try to delete these jars and restart glassfish, I get a NoClassDefFoundError

        ERROR [HotDeployUtil:112] com.liferay.portal.kernel.deploy.hot.HotDeployException: Error registering portlets for my-portlet
        com.liferay.portal.kernel.deploy.hot.HotDeployException: Error registering portlets for my-portlet
        at com.liferay.portal.kernel.deploy.hot.BaseHotDeployListener.throwHotDeployException(BaseHotDeployListener.java:45)
        ....
        Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/Logger

        I'm trying to understand what kinda fix I can expect with Liferay 6.0 EE or 6.1 CE.

        My env is:
        Glassfish server 3.1
        Liferay 6.0.5
        Windows 7

        Our web app which is soon to be deployed to production will run on Unix platform.

        Thanks for your help.

        Show
        T Chaudhry added a comment - Just so that you are clear, my problem is intermittent, sort of. When I have a clean Glassfish/Liferay without my web application portlet, everything seems to be fine. Then I drop my portlet web application under Glassfish/deploy folder and it gets auto deployed. Logging works fine and my app log files are correctly generated. Now when I stop and start glassfish a number of times (anywhere between 1 to 5), at some point in time, logging fails. The message that I see in glassfish's server.log file is: [#|2011-06-16T13:49:25.071-0400|WARNING|sun-appserver2.1|javax.enterprise.system.stream.err|_ThreadID=15;_ThreadName=pool-1-thread-1;_RequestID=a8bc2c92-236d-4108-93da-1179908be7e2;|log4j:ERROR A "org.apache.log4j.ConsoleAppender" object is not assignable to a "org.apache.log4j.Appender" variable.|#] [#|2011-06-16T13:49:25.077-0400|WARNING|sun-appserver2.1|javax.enterprise.system.stream.err|_ThreadID=15;_ThreadName=pool-1-thread-1;_RequestID=a8bc2c92-236d-4108-93da-1179908be7e2;| log4j:ERROR The class "org.apache.log4j.Appender" was loaded by |#] [#|2011-06-16T13:49:25.077-0400|WARNING|sun-appserver2.1|javax.enterprise.system.stream.err|_ThreadID=15;_ThreadName=pool-1-thread-1;_RequestID=a8bc2c92-236d-4108-93da-1179908be7e2;| log4j:ERROR [WebappClassLoader delegate: true repositories: /WEB-INF/classes/ ----------> Parent Classloader: EJBClassLoader : urlSet = [] doneCalled = false Parent -> java.net.URLClassLoader@cb42cf ] whereas object of type |#] After this error appears, no matter how many times I restart Glassfish, the error always shows up at start up. Also, my web app's log files are no longer generated! The only workaround that works for me is to undeploy my web app, clean up glassfish directories, restart glassfish and redeploy my web app. As you can imagine, this is not much of a workaround since doing this in production env, (power failure, system reboot, etc) will be extremely painful. My web application contains a log4j.properties file in the WEB-INF/classes folder. Neither log4j or commons-logging are packaged in the WEB-INF/lib directory. When my web app gets deployed, I can see that LifeRay does indeed add those jars files to the web apps's lib directory. If I try to delete these jars and restart glassfish, I get a NoClassDefFoundError ERROR [HotDeployUtil:112] com.liferay.portal.kernel.deploy.hot.HotDeployException: Error registering portlets for my-portlet com.liferay.portal.kernel.deploy.hot.HotDeployException: Error registering portlets for my-portlet at com.liferay.portal.kernel.deploy.hot.BaseHotDeployListener.throwHotDeployException(BaseHotDeployListener.java:45) .... Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/Logger I'm trying to understand what kinda fix I can expect with Liferay 6.0 EE or 6.1 CE. My env is: Glassfish server 3.1 Liferay 6.0.5 Windows 7 Our web app which is soon to be deployed to production will run on Unix platform. Thanks for your help.
        Hide
        T Chaudhry added a comment -

        Adding system property -Dlog4j.ignoreTCL=true and adding log4j and commons-logging to WEB-INF/lib folder of the app war file seemed to do the trick. I no longer see class x is not assignable to class y type errors and also, my app log files are correctly generated.

        Show
        T Chaudhry added a comment - Adding system property -Dlog4j.ignoreTCL=true and adding log4j and commons-logging to WEB-INF/lib folder of the app war file seemed to do the trick. I no longer see class x is not assignable to class y type errors and also, my app log files are correctly generated.
        Hide
        Massimiliano Assante added a comment -

        I Can confirm that Adding system property -Dlog4j.ignoreTCL=true and adding log4j and commons-logging to WEB-INF/lib folder of the app war file solved the problem on LR 6.0.6 CE

        Show
        Massimiliano Assante added a comment - I Can confirm that Adding system property -Dlog4j.ignoreTCL=true and adding log4j and commons-logging to WEB-INF/lib folder of the app war file solved the problem on LR 6.0.6 CE

          People

          • Votes:
            6 Vote for this issue
            Watchers:
            14 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:
              Days since last comment:
              2 years, 51 weeks ago

              Development

                Structure Helper Panel