You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Arnaud HERITIER <ah...@gmail.com> on 2007/01/09 23:21:31 UTC

Re: [M1] cobertura-1.8 java.lang.NoClassDefFoundError

Hi,

  Having a look at the plugin code, it doesn't seem to be useful to add
log4j in your classpath.
  When tests are executed with cobertura, the following classpath entries
are added :
  <!-- global definitions -->
  <ant:path id="cobertura.classpath">
    <ant:pathelement path="${maven.build.dest}"/>
    <ant:pathelement path="${plugin.getDependencyPath
('urbanophile:java-getopt')}"/>
    <ant:pathelement path="${plugin.getDependencyPath
('javancss:javancss')}"/>
    <ant:pathelement path="${plugin.getDependencyPath('javancss:ccl')}"/>
    <ant:pathelement path="${plugin.getDependencyPath('asm')}"/>
    <ant:pathelement path="${plugin.getDependencyPath('oro')}"/>
    <ant:pathelement path="${plugin.getDependencyPath('log4j')}"/>
    <ant:pathelement path="${plugin.getDependencyPath('cobertura')}"/>
  </ant:path>

  For which class do you have a NoClassDefFoundError  ? Can't it be a
conflict between the version of log4J in your project and the one used in
the cobertura plugin ?

Arnaud


On 1/9/07, Srilakshmanan, Lakshman <
Lakshman.Srilakshmanan@tradingpost.com.au> wrote:
>
> Hi All,
>
> I am using   maven-cobertura-plugin-1.2 & cobertura-1.8.
> We have extended the org.apache.log4j.AppenderSkeleton class.
>
> When cobertura tries to instrument the class a
> java.lang.NoClassDefFoundError is thrown.
>
> I have searched the mail archive and found mails referring to older
> versions, and that it was fixed in cobertura-1.8. There are also mails
> suggesting to add log4j in the project classpath.
>
> Could someone please tell me if you have tried to extend the a log4j
> class and if you experienced the same problem or am I just unlucky and
> did something wrong in my implementation.
>
> Is adding log4j to class path done as follows
>   <dependency>
>       <groupId>log4j</groupId>
>       <artifactId>log4j</artifactId>
>       <version>1.2.8</version>
>       <url>log4j/jars</url>
>       <properties>
>           <classloader>root.maven</classloader>
>       </properties>
>     </dependency>
>
> The funny part is, there is a message "adding dependency
> /repository/log4j/jars/log4j-1.2.8.jar into project classloader". So I
> don't quite believe adding log4j to the project classpath would resolve
> the problem. I believe I need to add it to the classpath used by
> cobertura and I don't believe it is using the project classpath.
>
> Any help/suggestions is greatly appreciated.
>
> Thanks in advance.
>
> Thanks
> Lakshman
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: [M1] cobertura-1.8 java.lang.NoClassDefFoundError

Posted by Jeff Jensen <je...@upstairstechnology.com>.
Cobertura plugin 1.7 started depending on log4j 1.2.9, and the Maven
plugin depends on that.  Is your issue related to the version of log4j,
i.e. 1.2.8 vs 1.2.9?


Quoting Arnaud HERITIER <ah...@gmail.com>:

> Hi,
>
>   Having a look at the plugin code, it doesn't seem to be useful to add
> log4j in your classpath.
>   When tests are executed with cobertura, the following classpath entries
> are added :
>   <!-- global definitions -->
>   <ant:path id="cobertura.classpath">
>     <ant:pathelement path="${maven.build.dest}"/>
>     <ant:pathelement path="${plugin.getDependencyPath
> ('urbanophile:java-getopt')}"/>
>     <ant:pathelement path="${plugin.getDependencyPath
> ('javancss:javancss')}"/>
>     <ant:pathelement path="${plugin.getDependencyPath('javancss:ccl')}"/>
>     <ant:pathelement path="${plugin.getDependencyPath('asm')}"/>
>     <ant:pathelement path="${plugin.getDependencyPath('oro')}"/>
>     <ant:pathelement path="${plugin.getDependencyPath('log4j')}"/>
>     <ant:pathelement path="${plugin.getDependencyPath('cobertura')}"/>
>   </ant:path>
>
>   For which class do you have a NoClassDefFoundError  ? Can't it be a
> conflict between the version of log4J in your project and the one used in
> the cobertura plugin ?
>
> Arnaud
>
>
> On 1/9/07, Srilakshmanan, Lakshman <
> Lakshman.Srilakshmanan@tradingpost.com.au> wrote:
> >
> > Hi All,
> >
> > I am using   maven-cobertura-plugin-1.2 & cobertura-1.8.
> > We have extended the org.apache.log4j.AppenderSkeleton class.
> >
> > When cobertura tries to instrument the class a
> > java.lang.NoClassDefFoundError is thrown.
> >
> > I have searched the mail archive and found mails referring to older
> > versions, and that it was fixed in cobertura-1.8. There are also mails
> > suggesting to add log4j in the project classpath.
> >
> > Could someone please tell me if you have tried to extend the a log4j
> > class and if you experienced the same problem or am I just unlucky and
> > did something wrong in my implementation.
> >
> > Is adding log4j to class path done as follows
> >   <dependency>
> >       <groupId>log4j</groupId>
> >       <artifactId>log4j</artifactId>
> >       <version>1.2.8</version>
> >       <url>log4j/jars</url>
> >       <properties>
> >           <classloader>root.maven</classloader>
> >       </properties>
> >     </dependency>
> >
> > The funny part is, there is a message "adding dependency
> > /repository/log4j/jars/log4j-1.2.8.jar into project classloader". So I
> > don't quite believe adding log4j to the project classpath would resolve
> > the problem. I believe I need to add it to the classpath used by
> > cobertura and I don't believe it is using the project classpath.
> >
> > Any help/suggestions is greatly appreciated.
> >
> > Thanks in advance.
> >
> > Thanks
> > Lakshman
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
>




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