Issue stopping Resin 3.0.23 with Cargo

View: New views
11 Messages — Rating Filter:   Alert me  

Issue stopping Resin 3.0.23 with Cargo

by mraible :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I get the following error when Cargo tries to stop Resin 3.0.23.
Download, installing and starting seems to work fine.

DEBUG [resin-tcp-connection-*:9876-19] UserManagerImpl.removeUser(66)
| removing user: 42
Exception in thread "main" java.lang.NoClassDefFoundError:
org/codehaus/cargo/container/spi/util/DefaultServerRun
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)

Thanks,

Matt

--
http://raibledesigns.com

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email


Re: Issue stopping Resin 3.0.23 with Cargo

by mraible :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I should mention I'm using version 0.2 of the Cargo Maven 2 Plugin and
everything works fine with Tomcat 5.5.17 and JBoss 4.0.5.GA.

Matt

On 2/21/07, Matt Raible <matt@...> wrote:

> I get the following error when Cargo tries to stop Resin 3.0.23.
> Download, installing and starting seems to work fine.
>
> DEBUG [resin-tcp-connection-*:9876-19] UserManagerImpl.removeUser(66)
> | removing user: 42
> Exception in thread "main" java.lang.NoClassDefFoundError:
> org/codehaus/cargo/container/spi/util/DefaultServerRun
>         at java.lang.ClassLoader.defineClass1(Native Method)
>         at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
>         at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
>         at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
>         at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
>         at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
>         at java.security.AccessController.doPrivileged(Native Method)
>         at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
>         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
>         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
>
> Thanks,
>
> Matt
>
> --
> http://raibledesigns.com
>


--
http://raibledesigns.com

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email


NoClassDefFoundError when using embedded jetty6x

by Denis McCarthy-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,
I'm trying to use the cargo-maven2-plugin with jetty (embedded). When I
try to start my container (I'm starting it as part of my integration
test phase, to run selenium tests) I'm getting a noclassdeffounderror on
log4j. Here's part of the trace:

No suitable Log constructor [Ljava.lang.Class;@9db992 for
org.apache.commons.logging.impl.Log4JLogger (Caused by
java.lang.NoClassDefFoundError: org/apache/log4j/Category))

As you can see, commons-logging seems to be picked up alright, so at
least some dependencies seem to be available to jetty.


Here's the appropriate section of the config in my pom:

<plugin>
   <groupId>org.codehaus.cargo</groupId>
   <artifactId>cargo-maven2-plugin</artifactId>
   <configuration>
   <wait>false</wait>
   <container>
     <containerId>jetty6x</containerId>
     <type>embedded</type>
     <dependencies>
       <dependency>
         <groupId>log4j</groupId>
         <artifactId>log4j</artifactId>
         <location>
/home/dmccarthy/.m2/repository/log4j/log4j/1.2.14/log4j-1.2.14.jar
        </location>
         </dependency>
       </dependencies>
     </container>
   <configuration>
.
.
.

As you can see I tried to put the log4j explicitly in as a dependency
for the jetty instance, but it didn't work. I suspect I'm doing
something wrong. Does anyone know how I should get embedded jetty to add
log4j to its classpath?
Thanks
Denis


---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email


Re: NoClassDefFoundError when using embedded jetty6x

by Arnaud HERITIER :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Denis,

  I also have this problem for some weeks with jetty 5 or jetty 6.
  I don't find if something changed in cargo  recently.

Arnaud

On 2/22/07, Denis McCarthy <dmccarthy@...> wrote:
Hi,
I'm trying to use the cargo-maven2-plugin with jetty (embedded). When I
try to start my container (I'm starting it as part of my integration
test phase, to run selenium tests) I'm getting a noclassdeffounderror on
log4j. Here's part of the trace:

No suitable Log constructor [Ljava.lang.Class;@9db992 for
org.apache.commons.logging.impl.Log4JLogger (Caused by
java.lang.NoClassDefFoundError: org/apache/log4j/Category))

As you can see, commons-logging seems to be picked up alright, so at
least some dependencies seem to be available to jetty.


Here's the appropriate section of the config in my pom:

<plugin>
   <groupId>org.codehaus.cargo</groupId>
   <artifactId>cargo-maven2-plugin</artifactId>
   <configuration>
   <wait>false</wait>
   <container>
     <containerId>jetty6x</containerId>
     <type>embedded</type>
     <dependencies>
       <dependency>
         <groupId>log4j</groupId>
         <artifactId>log4j</artifactId>
         <location>
/home/dmccarthy/.m2/repository/log4j/log4j/1.2.14/log4j-1.2.14.jar
        </location>
         </dependency>
       </dependencies>
     </container>
   <configuration>
.
.
.

As you can see I tried to put the log4j explicitly in as a dependency
for the jetty instance, but it didn't work. I suspect I'm doing
something wrong. Does anyone know how I should get embedded jetty to add
log4j to its classpath?
Thanks
Denis


---------------------------------------------------------------------
To unsubscribe from this list please visit:

     http://xircles.codehaus.org/manage_email



Re: NoClassDefFoundError when using embedded jetty6x

by jan_bartel :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Denis,

Are you sure that the <dependencies> element is a valid element for
the <container> element? Shouldn't it be a direct child of the <plugin>
element instead? Also, I'm not sure about the <location> element - I've
never seen that before on standard maven dependencies. I've seen and used
<systemPath> to specify the location for a jar that does *not* exist in
the local maven repo.

cheers
Jan

Denis McCarthy wrote:

> Hi,
> I'm trying to use the cargo-maven2-plugin with jetty (embedded). When I
> try to start my container (I'm starting it as part of my integration
> test phase, to run selenium tests) I'm getting a noclassdeffounderror on
> log4j. Here's part of the trace:
>
> No suitable Log constructor [Ljava.lang.Class;@9db992 for
> org.apache.commons.logging.impl.Log4JLogger (Caused by
> java.lang.NoClassDefFoundError: org/apache/log4j/Category))
>
> As you can see, commons-logging seems to be picked up alright, so at
> least some dependencies seem to be available to jetty.
>
>
> Here's the appropriate section of the config in my pom:
>
> <plugin>
>   <groupId>org.codehaus.cargo</groupId>
>   <artifactId>cargo-maven2-plugin</artifactId>
>   <configuration>
>   <wait>false</wait>
>   <container>
>     <containerId>jetty6x</containerId>
>     <type>embedded</type>
>     <dependencies>
>       <dependency>
>         <groupId>log4j</groupId>
>         <artifactId>log4j</artifactId>
>         <location>
> /home/dmccarthy/.m2/repository/log4j/log4j/1.2.14/log4j-1.2.14.jar
>     </location>
>         </dependency>
>       </dependencies>                  
>     </container>
>   <configuration>
> .
> .
> .
>
> As you can see I tried to put the log4j explicitly in as a dependency
> for the jetty instance, but it didn't work. I suspect I'm doing
> something wrong. Does anyone know how I should get embedded jetty to add
> log4j to its classpath?
> Thanks
> Denis
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>    http://xircles.codehaus.org/manage_email
>


---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email


Re: NoClassDefFoundError when using embedded jetty6x

by Denis McCarthy-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Jan,
According to http://jira.codehaus.org/browse/CARGO-243
it is a valid element in this instance, and indeed maven seems happy
enough to attempt to run the jetty server as previously stated.
Unfortunately it keeps throwing this noclassdeffounderror regardless I'm
digging through the cargo code at the minute to see if can I see anything
Denis

Jan Bartel wrote:

> Denis,
>
> Are you sure that the <dependencies> element is a valid element for
> the <container> element? Shouldn't it be a direct child of the <plugin>
> element instead? Also, I'm not sure about the <location> element - I've
> never seen that before on standard maven dependencies. I've seen and used
> <systemPath> to specify the location for a jar that does *not* exist in
> the local maven repo.
>
> cheers
> Jan
>
> Denis McCarthy wrote:
>> Hi,
>> I'm trying to use the cargo-maven2-plugin with jetty (embedded). When I
>> try to start my container (I'm starting it as part of my integration
>> test phase, to run selenium tests) I'm getting a noclassdeffounderror on
>> log4j. Here's part of the trace:
>>
>> No suitable Log constructor [Ljava.lang.Class;@9db992 for
>> org.apache.commons.logging.impl.Log4JLogger (Caused by
>> java.lang.NoClassDefFoundError: org/apache/log4j/Category))
>>
>> As you can see, commons-logging seems to be picked up alright, so at
>> least some dependencies seem to be available to jetty.
>>
>>
>> Here's the appropriate section of the config in my pom:
>>
>> <plugin>
>>   <groupId>org.codehaus.cargo</groupId>
>>   <artifactId>cargo-maven2-plugin</artifactId>
>>   <configuration>
>>   <wait>false</wait>
>>   <container>
>>     <containerId>jetty6x</containerId>
>>     <type>embedded</type>
>>     <dependencies>
>>       <dependency>
>>         <groupId>log4j</groupId>
>>         <artifactId>log4j</artifactId>
>>         <location>
>> /home/dmccarthy/.m2/repository/log4j/log4j/1.2.14/log4j-1.2.14.jar
>>     </location>
>>         </dependency>
>>       </dependencies>                  
>>     </container>
>>   <configuration>
>> .
>> .
>> .
>>
>> As you can see I tried to put the log4j explicitly in as a dependency
>> for the jetty instance, but it didn't work. I suspect I'm doing
>> something wrong. Does anyone know how I should get embedded jetty to add
>> log4j to its classpath?
>> Thanks
>> Denis
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list please visit:
>>
>>    http://xircles.codehaus.org/manage_email
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>     http://xircles.codehaus.org/manage_email
>

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email


Re: NoClassDefFoundError when using embedded jetty6x

by Life is hard, and then you die :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, Feb 23, 2007 at 12:37:45PM +0000, Denis McCarthy wrote:

> >>I'm trying to use the cargo-maven2-plugin with jetty (embedded). When I
> >>try to start my container (I'm starting it as part of my integration
> >>test phase, to run selenium tests) I'm getting a noclassdeffounderror on
> >>log4j. Here's part of the trace:
> >>
> >>No suitable Log constructor [Ljava.lang.Class;@9db992 for
> >>org.apache.commons.logging.impl.Log4JLogger (Caused by
> >>java.lang.NoClassDefFoundError: org/apache/log4j/Category))
> >>
> >>As you can see, commons-logging seems to be picked up alright, so at
> >>least some dependencies seem to be available to jetty.
> >>
> >>
> >>Here's the appropriate section of the config in my pom:
> >>
> >><plugin>
> >>  <groupId>org.codehaus.cargo</groupId>
> >>  <artifactId>cargo-maven2-plugin</artifactId>
> >>  <configuration>
> >>  <wait>false</wait>
> >>  <container>
> >>    <containerId>jetty6x</containerId>
> >>    <type>embedded</type>
> >>    <dependencies>
> >>      <dependency>
> >>        <groupId>log4j</groupId>
> >>        <artifactId>log4j</artifactId>
> >>        <location>
> >>/home/dmccarthy/.m2/repository/log4j/log4j/1.2.14/log4j-1.2.14.jar
> >>    </location>
> >>        </dependency>
> >>      </dependencies>                  
> >>    </container>
> >>  <configuration>

This looks like the usual classloader problem that is so common with
commons-logging. Try ensuring commons-logging is loaded the same
classloader as log4j by specifying it as a dependency too:

        <dependencies>
          <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.14</version>
          </dependency>
          <dependency>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
            <version>1.1</version>
          </dependency>
        </dependencies>                  


  Cheers,

  Ronald


---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email


Re: NoClassDefFoundError when using embedded jetty6x

by Denis McCarthy-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm afraid that doesn't make any difference Ronald - the same
NoClassDefFoundError is thrown even if I add commons-logging as a
dependency. You could be onto something when you say it's a classloader
issue though, as there is definitely *some* log4j jar loaded (it's in
the war file, and it lists it in the debug messages when I run maven
with the -X flag).

Life is hard, and then you die wrote:

> On Fri, Feb 23, 2007 at 12:37:45PM +0000, Denis McCarthy wrote:
>>>> I'm trying to use the cargo-maven2-plugin with jetty (embedded). When I
>>>> try to start my container (I'm starting it as part of my integration
>>>> test phase, to run selenium tests) I'm getting a noclassdeffounderror on
>>>> log4j. Here's part of the trace:
>>>>
>>>> No suitable Log constructor [Ljava.lang.Class;@9db992 for
>>>> org.apache.commons.logging.impl.Log4JLogger (Caused by
>>>> java.lang.NoClassDefFoundError: org/apache/log4j/Category))
>>>>
>>>> As you can see, commons-logging seems to be picked up alright, so at
>>>> least some dependencies seem to be available to jetty.
>>>>
>>>>
>>>> Here's the appropriate section of the config in my pom:
>>>>
>>>> <plugin>
>>>>  <groupId>org.codehaus.cargo</groupId>
>>>>  <artifactId>cargo-maven2-plugin</artifactId>
>>>>  <configuration>
>>>>  <wait>false</wait>
>>>>  <container>
>>>>    <containerId>jetty6x</containerId>
>>>>    <type>embedded</type>
>>>>    <dependencies>
>>>>      <dependency>
>>>>        <groupId>log4j</groupId>
>>>>        <artifactId>log4j</artifactId>
>>>>        <location>
>>>> /home/dmccarthy/.m2/repository/log4j/log4j/1.2.14/log4j-1.2.14.jar
>>>>    </location>
>>>>        </dependency>
>>>>      </dependencies>                  
>>>>    </container>
>>>>  <configuration>
>
> This looks like the usual classloader problem that is so common with
> commons-logging. Try ensuring commons-logging is loaded the same
> classloader as log4j by specifying it as a dependency too:
>
>         <dependencies>
>           <dependency>
>             <groupId>log4j</groupId>
>             <artifactId>log4j</artifactId>
>             <version>1.2.14</version>
>           </dependency>
>           <dependency>
>             <groupId>commons-logging</groupId>
>             <artifactId>commons-logging</artifactId>
>             <version>1.1</version>
>           </dependency>
>         </dependencies>                  
>
>
>   Cheers,
>
>   Ronald
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>     http://xircles.codehaus.org/manage_email
>

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email


Parent Message unknown RE: NoClassDefFoundError when using embedded jetty6x

by Marwan.Zeineddine :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

If I may bud in. And it's fairly speculative in that I'm in a hurry but
thought that this might help even though I'm not 100% sure of it.

If we go back to the classloaders hierarchy, if the parent classloader has
loaded log4j already, then by default it will be consulted first when a
class is needed by the component/bottom-classloader.

Loading log4j in a child classloader doesn't help as it will be bypassed
to go straight to its parent, and loading the dependency commons-logging
class/jar in the child classloader won't help either because they're not
visible from the parent classloader and you get a NoClassDefFounError.

So either make sure only the child classloader loads both log4j and
commons-logging, or you'll need to load commons-logging and log4j using
the parent classloader. In practice this means bundling the jars in the
ejb module not the war.

Marwan


-----Original Message-----
From: dmccarthy@... [mailto:dmccarthy@...]
Sent: 23 February 2007 14:57
To: user@...
Subject: Re: [cargo-user] NoClassDefFoundError when using embedded jetty6x

I'm afraid that doesn't make any difference Ronald - the same
NoClassDefFoundError is thrown even if I add commons-logging as a
dependency. You could be onto something when you say it's a classloader
issue though, as there is definitely *some* log4j jar loaded (it's in
the war file, and it lists it in the debug messages when I run maven
with the -X flag).

Life is hard, and then you die wrote:
> On Fri, Feb 23, 2007 at 12:37:45PM +0000, Denis McCarthy wrote:
>>>> I'm trying to use the cargo-maven2-plugin with jetty (embedded). When
I
>>>> try to start my container (I'm starting it as part of my integration
>>>> test phase, to run selenium tests) I'm getting a noclassdeffounderror
on

>>>> log4j. Here's part of the trace:
>>>>
>>>> No suitable Log constructor [Ljava.lang.Class;@9db992 for
>>>> org.apache.commons.logging.impl.Log4JLogger (Caused by
>>>> java.lang.NoClassDefFoundError: org/apache/log4j/Category))
>>>>
>>>> As you can see, commons-logging seems to be picked up alright, so at
>>>> least some dependencies seem to be available to jetty.
>>>>
>>>>
>>>> Here's the appropriate section of the config in my pom:
>>>>
>>>> <plugin>
>>>>  <groupId>org.codehaus.cargo</groupId>
>>>>  <artifactId>cargo-maven2-plugin</artifactId>
>>>>  <configuration>
>>>>  <wait>false</wait>
>>>>  <container>
>>>>    <containerId>jetty6x</containerId>
>>>>    <type>embedded</type>
>>>>    <dependencies>
>>>>      <dependency>
>>>>        <groupId>log4j</groupId>
>>>>        <artifactId>log4j</artifactId>
>>>>        <location>
>>>> /home/dmccarthy/.m2/repository/log4j/log4j/1.2.14/log4j-1.2.14.jar
>>>>    </location>
>>>>        </dependency>
>>>>      </dependencies>                  
>>>>    </container>
>>>>  <configuration>
>
> This looks like the usual classloader problem that is so common with
> commons-logging. Try ensuring commons-logging is loaded the same
> classloader as log4j by specifying it as a dependency too:
>
>         <dependencies>
>           <dependency>
>             <groupId>log4j</groupId>
>             <artifactId>log4j</artifactId>
>             <version>1.2.14</version>
>           </dependency>
>           <dependency>
>             <groupId>commons-logging</groupId>
>             <artifactId>commons-logging</artifactId>
>             <version>1.1</version>
>           </dependency>
>         </dependencies>                  
>
>
>   Cheers,
>
>   Ronald
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>     http://xircles.codehaus.org/manage_email
>

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email


---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email


Re: NoClassDefFoundError when using embedded jetty6x

by Denis McCarthy-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,
Thanks for everyone's input. I solved this by adding an extra artifact
to the org.codehaus.cargo.maven2.jetty.JettyArtifactResolver class in
the constructor, like this:
  jetty6xDependencies.add(new Dependency("log4j", "log4j","1.2.14"));
(I also added one for ojdbc14.jar, but that's beside the point). It does
indeed seem that the problem was a commons-logging/log4j classloading
issue. Thanks for your help.
Denis


Marwan.Zeineddine@... wrote:

> Hi,
>
> If I may bud in. And it's fairly speculative in that I'm in a hurry but
> thought that this might help even though I'm not 100% sure of it.
>
> If we go back to the classloaders hierarchy, if the parent classloader has
> loaded log4j already, then by default it will be consulted first when a
> class is needed by the component/bottom-classloader.
>
> Loading log4j in a child classloader doesn't help as it will be bypassed
> to go straight to its parent, and loading the dependency commons-logging
> class/jar in the child classloader won't help either because they're not
> visible from the parent classloader and you get a NoClassDefFounError.
>
> So either make sure only the child classloader loads both log4j and
> commons-logging, or you'll need to load commons-logging and log4j using
> the parent classloader. In practice this means bundling the jars in the
> ejb module not the war.
>
> Marwan
>
>
> -----Original Message-----
> From: dmccarthy@... [mailto:dmccarthy@...]
> Sent: 23 February 2007 14:57
> To: user@...
> Subject: Re: [cargo-user] NoClassDefFoundError when using embedded jetty6x
>
> I'm afraid that doesn't make any difference Ronald - the same
> NoClassDefFoundError is thrown even if I add commons-logging as a
> dependency. You could be onto something when you say it's a classloader
> issue though, as there is definitely *some* log4j jar loaded (it's in
> the war file, and it lists it in the debug messages when I run maven
> with the -X flag).
>
> Life is hard, and then you die wrote:
>> On Fri, Feb 23, 2007 at 12:37:45PM +0000, Denis McCarthy wrote:
>>>>> I'm trying to use the cargo-maven2-plugin with jetty (embedded). When
> I
>>>>> try to start my container (I'm starting it as part of my integration
>>>>> test phase, to run selenium tests) I'm getting a noclassdeffounderror
> on
>>>>> log4j. Here's part of the trace:
>>>>>
>>>>> No suitable Log constructor [Ljava.lang.Class;@9db992 for
>>>>> org.apache.commons.logging.impl.Log4JLogger (Caused by
>>>>> java.lang.NoClassDefFoundError: org/apache/log4j/Category))
>>>>>
>>>>> As you can see, commons-logging seems to be picked up alright, so at
>>>>> least some dependencies seem to be available to jetty.
>>>>>
>>>>>
>>>>> Here's the appropriate section of the config in my pom:
>>>>>
>>>>> <plugin>
>>>>>  <groupId>org.codehaus.cargo</groupId>
>>>>>  <artifactId>cargo-maven2-plugin</artifactId>
>>>>>  <configuration>
>>>>>  <wait>false</wait>
>>>>>  <container>
>>>>>    <containerId>jetty6x</containerId>
>>>>>    <type>embedded</type>
>>>>>    <dependencies>
>>>>>      <dependency>
>>>>>        <groupId>log4j</groupId>
>>>>>        <artifactId>log4j</artifactId>
>>>>>        <location>
>>>>> /home/dmccarthy/.m2/repository/log4j/log4j/1.2.14/log4j-1.2.14.jar
>>>>>    </location>
>>>>>        </dependency>
>>>>>      </dependencies>                  
>>>>>    </container>
>>>>>  <configuration>
>> This looks like the usual classloader problem that is so common with
>> commons-logging. Try ensuring commons-logging is loaded the same
>> classloader as log4j by specifying it as a dependency too:
>>
>>         <dependencies>
>>           <dependency>
>>             <groupId>log4j</groupId>
>>             <artifactId>log4j</artifactId>
>>             <version>1.2.14</version>
>>           </dependency>
>>           <dependency>
>>             <groupId>commons-logging</groupId>
>>             <artifactId>commons-logging</artifactId>
>>             <version>1.1</version>
>>           </dependency>
>>         </dependencies>                  
>>
>>
>>   Cheers,
>>
>>   Ronald
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list please visit:
>>
>>     http://xircles.codehaus.org/manage_email
>>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>     http://xircles.codehaus.org/manage_email
>

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email


Re: NoClassDefFoundError when using embedded jetty6x

by Paul Spencer-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I also experienced this error, but with Jetty 5.  In my case, the
servlet jar was a dependency of a dependency.  I used the command "mvn
dependency:analyze" to confirm that servlet jar was a dependency and
then added <exclusion> to offending dependency to remove the servlet jar.

FYI: I know I a reponding to an older post, by I wanted to document my
solution.

Paul Spencer

Denis McCarthy wrote:

> Hi,
> I'm trying to use the cargo-maven2-plugin with jetty (embedded). When I
> try to start my container (I'm starting it as part of my integration
> test phase, to run selenium tests) I'm getting a noclassdeffounderror on
> log4j. Here's part of the trace:
>
> No suitable Log constructor [Ljava.lang.Class;@9db992 for
> org.apache.commons.logging.impl.Log4JLogger (Caused by
> java.lang.NoClassDefFoundError: org/apache/log4j/Category))
>
> As you can see, commons-logging seems to be picked up alright, so at
> least some dependencies seem to be available to jetty.
>
>
> Here's the appropriate section of the config in my pom:
>
> <plugin>
>   <groupId>org.codehaus.cargo</groupId>
>   <artifactId>cargo-maven2-plugin</artifactId>
>   <configuration>
>   <wait>false</wait>
>   <container>
>     <containerId>jetty6x</containerId>
>     <type>embedded</type>
>     <dependencies>
>       <dependency>
>         <groupId>log4j</groupId>
>         <artifactId>log4j</artifactId>
>         <location>
> /home/dmccarthy/.m2/repository/log4j/log4j/1.2.14/log4j-1.2.14.jar
>     </location>
>         </dependency>
>       </dependencies>                  
>     </container>
>   <configuration>
> .
> .
> .
>
> As you can see I tried to put the log4j explicitly in as a dependency
> for the jetty instance, but it didn't work. I suspect I'm doing
> something wrong. Does anyone know how I should get embedded jetty to add
> log4j to its classpath?
> Thanks
> Denis
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>


---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email