You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Farrukh Najmi <fa...@wellfleetsoftware.com> on 2007/08/31 18:32:44 UTC

NoClassDefFoundError: org/apache/log4j/Category

Hello,

I am using cargo-maven2-plugin for deploying my webapp into my webcontainer.
I have no problems using tomcat5x profile but when I use the jetty6x 
profile with:

                            <container>
                                <containerId>jetty6x</containerId>
                                <type>embedded</type>
                            </container>

I get the following exception...

Caused by: org.apache.commons.logging.LogConfigurationException: No 
suitable Log constructor [Ljava.lang.Class;@13ce64f6 for 
org.apache.commons.logging.impl.Log4JLogger (Caused by 
java.lang.NoClassDefFoundError: org/apache/log4j/Category)
        at 
org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:413)
        at 
org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:529)
        ... 28 more
Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/Category
        at java.lang.Class.getDeclaredConstructors0(Native Method)
        at java.lang.Class.privateGetDeclaredConstructors(Class.java:2357)
        at java.lang.Class.getConstructor0(Class.java:2671)
        at java.lang.Class.getConstructor(Class.java:1629)
        at 
org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:410)
        ... 29 more


Having scanned the web I find the following thread that looks similar 
and indicates some sort of classloader issue:

<http://www.nabble.com/Issue-stopping-Resin-3.0.23-with-Cargo-t3270890.html>

However, I cannot figure out what I need to do to fix the problem.

Thanks for any help on this show stopper issue as I would really like to 
use jetty6 for deployment.

-- 
Regards,
Farrukh

Web: http://www.wellfleetsoftware.com



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: NoClassDefFoundError: org/apache/log4j/Category

Posted by Farrukh Najmi <fa...@wellfleetsoftware.com>.
The solution to my problem with jetty6 and cargo-maven2-plugin was to 
add the following systemProperties element to the container 
configuration to the jetty6 container's configuration element:

                            <container>
                                <containerId>jetty6x</containerId>
                                <type>embedded</type>
*                                <systemProperties>
                                    
<org.apache.commons.logging.Log>org.apache.commons.logging.impl.SimpleLog</org.apache.commons.logging.Log>
                                </systemProperties>                       
*                            </container>


Thanks for your help.

Dennis Lundberg wrote:
> This is a classic, but really has nothing to do with Maven.
>
> The root cause is that commons-logging and log4j are in different 
> class loaders. The best way to track down what is going on is to 
> install commons-logging 1.1 (if you are not already using that 
> version) and to turn on diagnostics [1]. Commons-logging might be 
> installed in the container and/or your webapp, so make sure you 
> install 1.1 everywhere.
>
> [1] http://commons.apache.org/logging/troubleshooting.html
>
> Farrukh Najmi wrote:
>> Hello,
>>
>> I am using cargo-maven2-plugin for deploying my webapp into my 
>> webcontainer.
>> I have no problems using tomcat5x profile but when I use the jetty6x 
>> profile with:
>>
>>                            <container>
>>                                <containerId>jetty6x</containerId>
>>                                <type>embedded</type>
>>                            </container>
>>
>> I get the following exception...
>>
>> Caused by: org.apache.commons.logging.LogConfigurationException: No 
>> suitable Log constructor [Ljava.lang.Class;@13ce64f6 for 
>> org.apache.commons.logging.impl.Log4JLogger (Caused by 
>> java.lang.NoClassDefFoundError: org/apache/log4j/Category)
>>        at 
>> org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:413) 
>>
>>        at 
>> org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:529) 
>>
>>        ... 28 more
>> Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/Category
>>        at java.lang.Class.getDeclaredConstructors0(Native Method)
>>        at 
>> java.lang.Class.privateGetDeclaredConstructors(Class.java:2357)
>>        at java.lang.Class.getConstructor0(Class.java:2671)
>>        at java.lang.Class.getConstructor(Class.java:1629)
>>        at 
>> org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:410) 
>>
>>        ... 29 more
>>
>>
>> Having scanned the web I find the following thread that looks similar 
>> and indicates some sort of classloader issue:
>>
>> <http://www.nabble.com/Issue-stopping-Resin-3.0.23-with-Cargo-t3270890.html> 
>>
>>
>> However, I cannot figure out what I need to do to fix the problem.
>>
>> Thanks for any help on this show stopper issue as I would really like 
>> to use jetty6 for deployment.
>>
>
>


-- 
Regards,
Farrukh

Web: http://www.wellfleetsoftware.com



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: NoClassDefFoundError: org/apache/log4j/Category

Posted by Farrukh Najmi <fa...@wellfleetsoftware.com>.
Hi Dennis,

Thank you for your helpful note. I tried specifying the property to turn 
on common-logging 1.1 diags using all of the following but did not get 
any output:

    * mvn  -Dorg.apache.commons.logging.diagnostics.dest=STDOUT cargo:start
    * env
      MAVEN_OPTS="-Dorg.apache.commons.logging.diagnostics.dest=STDOUT"
      mvn cargo:start


What am I doing wrong? Thanks for your help.

Dennis Lundberg wrote:
> This is a classic, but really has nothing to do with Maven.
>
> The root cause is that commons-logging and log4j are in different 
> class loaders. The best way to track down what is going on is to 
> install commons-logging 1.1 (if you are not already using that 
> version) and to turn on diagnostics [1]. Commons-logging might be 
> installed in the container and/or your webapp, so make sure you 
> install 1.1 everywhere.
>
> [1] http://commons.apache.org/logging/troubleshooting.html
>
> Farrukh Najmi wrote:
>> Hello,
>>
>> I am using cargo-maven2-plugin for deploying my webapp into my 
>> webcontainer.
>> I have no problems using tomcat5x profile but when I use the jetty6x 
>> profile with:
>>
>>                            <container>
>>                                <containerId>jetty6x</containerId>
>>                                <type>embedded</type>
>>                            </container>
>>
>> I get the following exception...
>>
>> Caused by: org.apache.commons.logging.LogConfigurationException: No 
>> suitable Log constructor [Ljava.lang.Class;@13ce64f6 for 
>> org.apache.commons.logging.impl.Log4JLogger (Caused by 
>> java.lang.NoClassDefFoundError: org/apache/log4j/Category)
>>        at 
>> org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:413) 
>>
>>        at 
>> org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:529) 
>>
>>        ... 28 more
>> Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/Category
>>        at java.lang.Class.getDeclaredConstructors0(Native Method)
>>        at 
>> java.lang.Class.privateGetDeclaredConstructors(Class.java:2357)
>>        at java.lang.Class.getConstructor0(Class.java:2671)
>>        at java.lang.Class.getConstructor(Class.java:1629)
>>        at 
>> org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:410) 
>>
>>        ... 29 more
>>
>>
>> Having scanned the web I find the following thread that looks similar 
>> and indicates some sort of classloader issue:
>>
>> <http://www.nabble.com/Issue-stopping-Resin-3.0.23-with-Cargo-t3270890.html> 
>>
>>
>> However, I cannot figure out what I need to do to fix the problem.
>>
>> Thanks for any help on this show stopper issue as I would really like 
>> to use jetty6 for deployment.
>>
>
>


-- 
Regards,
Farrukh

Web: http://www.wellfleetsoftware.com



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: NoClassDefFoundError: org/apache/log4j/Category

Posted by Dennis Lundberg <de...@apache.org>.
This is a classic, but really has nothing to do with Maven.

The root cause is that commons-logging and log4j are in different class 
loaders. The best way to track down what is going on is to install 
commons-logging 1.1 (if you are not already using that version) and to 
turn on diagnostics [1]. Commons-logging might be installed in the 
container and/or your webapp, so make sure you install 1.1 everywhere.

[1] http://commons.apache.org/logging/troubleshooting.html

Farrukh Najmi wrote:
> Hello,
> 
> I am using cargo-maven2-plugin for deploying my webapp into my 
> webcontainer.
> I have no problems using tomcat5x profile but when I use the jetty6x 
> profile with:
> 
>                            <container>
>                                <containerId>jetty6x</containerId>
>                                <type>embedded</type>
>                            </container>
> 
> I get the following exception...
> 
> Caused by: org.apache.commons.logging.LogConfigurationException: No 
> suitable Log constructor [Ljava.lang.Class;@13ce64f6 for 
> org.apache.commons.logging.impl.Log4JLogger (Caused by 
> java.lang.NoClassDefFoundError: org/apache/log4j/Category)
>        at 
> org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:413) 
> 
>        at 
> org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:529) 
> 
>        ... 28 more
> Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/Category
>        at java.lang.Class.getDeclaredConstructors0(Native Method)
>        at java.lang.Class.privateGetDeclaredConstructors(Class.java:2357)
>        at java.lang.Class.getConstructor0(Class.java:2671)
>        at java.lang.Class.getConstructor(Class.java:1629)
>        at 
> org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:410) 
> 
>        ... 29 more
> 
> 
> Having scanned the web I find the following thread that looks similar 
> and indicates some sort of classloader issue:
> 
> <http://www.nabble.com/Issue-stopping-Resin-3.0.23-with-Cargo-t3270890.html> 
> 
> 
> However, I cannot figure out what I need to do to fix the problem.
> 
> Thanks for any help on this show stopper issue as I would really like to 
> use jetty6 for deployment.
> 


-- 
Dennis Lundberg

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org