« Return to Thread: Issue stopping Resin 3.0.23 with Cargo

Re: NoClassDefFoundError when using embedded jetty6x

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

Reply to Author | View in Thread

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

 « Return to Thread: Issue stopping Resin 3.0.23 with Cargo