You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by "a.e" <a....@lupuz.de> on 2010/11/30 17:21:35 UTC

java.lang.NoClassDefFoundError: Lorg/sonatype/plexus/build/incremental/BuildContext;

Hi,

I'm in the middle of developing an integration server for several month now.
Of course the system embedds maven which did work rather good with maven
2.2.1 and even the beta builds of maven 3. Since the release of 3.0 and even
3.0.1 my own MavenEmbedder class (basically something like this
http://java.net/projects/hudson/sources/svn/show/trunk/hudson/lib/maven-embedder)
does not work any more.  If I try to build an test project with my embedder
i get an NoClassDefFoundError:

java.lang.NoClassDefFoundError:
Lorg/sonatype/plexus/build/incremental/BuildContext;
	at java.lang.Class.getDeclaredFields0(Native Method) ~[na:1.6.0_22]
	at java.lang.Class.privateGetDeclaredFields(Class.java:2291) ~[na:1.6.0_22]
	at java.lang.Class.getDeclaredFields(Class.java:1743) ~[na:1.6.0_22]
	at
com.google.inject.spi.InjectionPoint.getInjectionPoints(InjectionPoint.java:649)
~[sisu-guice-2.9.1-noaop.jar:na]
[...]

I can provide the complete stacktrace if necessary.
The only strange thing I can find in my logs is the following that gets
logged right before the error occurs:

17:06:21.845 [main] WARN  d.b.a.i.b.maven.MavenLoggingAdapter - The POM for
org.apache.maven.shared:maven-filtering:jar:1.0-beta-4 is invalid,
transitive dependencies (if any) will not be available, enable debug logging
for more details

-- 
View this message in context: http://maven.40175.n5.nabble.com/java-lang-NoClassDefFoundError-Lorg-sonatype-plexus-build-incremental-BuildContext-tp3286295p3286295.html
Sent from the Maven Developers mailing list archive at Nabble.com.

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


Re: java.lang.NoClassDefFoundError: Lorg/sonatype/plexus/build/incremental/BuildContext;

Posted by "a.e" <a....@lupuz.de>.
Ok with this debugging information I was able to debug into the maven
execution and see where the validation really fails. For some reason the
MavenExecutionRequest had its system properties not populated. I looked what
the hudson embedder is doing regarding the system properties and did the
same:

Properties systemProperties = request.getSystemProperties();
systemProperties.putAll(System.getProperties());
systemProperties.putAll(getEnvironment());

not that getEnvironment() is a method i copied from the hudson embedder
which basically wraps every environment variable into a property prefixed by
"env.". 

So whats the real deal? How is one supposed to populate the system
properties of an execution request? Am I missing something? 
-- 
View this message in context: http://maven.40175.n5.nabble.com/java-lang-NoClassDefFoundError-Lorg-sonatype-plexus-build-incremental-BuildContext-tp3286295p3297152.html
Sent from the Maven Developers mailing list archive at Nabble.com.

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


Re: java.lang.NoClassDefFoundError: Lorg/sonatype/plexus/build/incremental/BuildContext;

Posted by "a.e" <a....@lupuz.de>.
I am still hunting this one down. For some reason I do not seem to be able to
get proper debug output from maven. I really would like to know why this
keeps preventing me from getting the proper dependencies for the resources
plugin included:

10:54:43.051 [main] WARN  d.b.a.i.b.maven.MavenLoggingAdapter - The POM for
org.apache.maven.shared:maven-filtering:jar:1.0-beta-4 is invalid,
transitive dependencies (if any) will not be available, enable debug logging
for more details

as far as "enable debug logging" is considered I finally managed to get more
output. this is the relevant debug output:

11:06:05.621 [main] WARN  d.b.a.i.b.maven.MavenLoggingAdapter - The POM for
org.apache.maven.shared:maven-filtering:jar:1.0-beta-4 is invalid,
transitive dependencies (if any) will not be available: 1 problem was
encountered while building the effective model for
org.apache.maven.shared:maven-filtering:1.0-beta-4
[ERROR] Failed to determine Java version for profile jre-1.5+ @
org.apache.maven.shared:maven-shared-components:15


-- 
View this message in context: http://maven.40175.n5.nabble.com/java-lang-NoClassDefFoundError-Lorg-sonatype-plexus-build-incremental-BuildContext-tp3286295p3297126.html
Sent from the Maven Developers mailing list archive at Nabble.com.

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


Re: java.lang.NoClassDefFoundError: Lorg/sonatype/plexus/build/incremental/BuildContext;

Posted by "a.e" <a....@lupuz.de>.
Hi,

thanks for the hint. When including this dependency for some reason I seem
to run into major classloader issues. Here is the output/exception of the
maven execution:

11:09:28.750 [main] WARN  d.b.a.i.b.maven.MavenLoggingAdapter - The POM for
org.apache.maven:maven-archiver:jar:2.4.1 is invalid, transitive
dependencies (if any) will not be available, enable debug logging for more
details
11:09:28.875 [main] DEBUG d.b.a.i.b.maven.MavenLoggingAdapter - Configuring
mojo 'org.apache.maven.plugins:maven-jar-plugin:2.3.1:jar' with basic
configurator -->
11:09:28.875 [main] DEBUG d.b.a.i.b.maven.MavenLoggingAdapter - -- end
configuration --
11:09:29.022 [main] DEBUG d.b.a.i.b.maven.MavenLoggingAdapter - isUp2date:
false (Destination
/tmp/a_mvn_build_test_dummy-application_9224f35e-08c0-47e3-b5ec-61e3aa6ecb8a/a-dummy-java-bl/target/a-dummy-java-bl-1.0.jar
not found.)
11:09:29.066 [main] INFO  d.b.a.i.b.maven.MavenLoggingAdapter - Building
jar:
/tmp/a_mvn_build_test_dummy-application_9224f35e-08c0-47e3-b5ec-61e3aa6ecb8a/a-dummy-java-bl/target/a-dummy-java-bl-1.0.jar
11:09:29.069 [main] DEBUG d.b.a.i.b.maven.MavenLoggingAdapter - adding
directory META-INF/
11:09:29.071 [main] DEBUG d.b.a.i.b.maven.MavenLoggingAdapter - adding entry
META-INF/MANIFEST.MF
11:09:29.072 [main] DEBUG d.b.a.i.b.maven.MavenLoggingAdapter - adding
directory de/
11:09:29.072 [main] DEBUG d.b.a.i.b.maven.MavenLoggingAdapter - adding
directory de/b/
11:09:29.072 [main] DEBUG d.b.a.i.b.maven.MavenLoggingAdapter - adding
directory de/b/dummy/
11:09:29.073 [main] DEBUG d.b.a.i.b.maven.MavenLoggingAdapter - adding entry
de/b/dummy/Dummy.class
11:09:29.073 [main] DEBUG d.b.a.i.b.maven.MavenLoggingAdapter - adding
directory META-INF/maven/
11:09:29.074 [main] DEBUG d.b.a.i.b.maven.MavenLoggingAdapter - adding
directory META-INF/maven/de.b/
11:09:29.074 [main] DEBUG d.b.a.i.b.maven.MavenLoggingAdapter - adding
directory META-INF/maven/de.b/a-dummy-java-bl/
11:09:29.074 [main] DEBUG d.b.a.i.b.maven.MavenLoggingAdapter - adding entry
META-INF/maven/de.b/a-dummy-java-bl/pom.xml
11:09:29.074 [main] DEBUG d.b.a.i.b.maven.MavenLoggingAdapter - adding entry
META-INF/maven/de.b/a-dummy-java-bl/pom.properties
11:09:29.078 [main] DEBUG d.b.a.i.b.maven.MavenLoggingAdapter - Configuring
mojo 'org.apache.maven.plugins:maven-install-plugin:2.3.1:install' with
basic configurator -->
11:09:29.079 [main] DEBUG d.b.a.i.b.maven.MavenLoggingAdapter - -- end
configuration --
11:09:29.080 [main] INFO  d.b.a.i.b.maven.MavenLoggingAdapter - Installing
/tmp/a_mvn_build_test_dummy-application_9224f35e-08c0-47e3-b5ec-61e3aa6ecb8a/a-dummy-java-bl/target/a-dummy-java-bl-1.0.jar
to /home/ae/.m2/repository/de/b/a-dummy-java-bl/1.0/a-dummy-java-bl-1.0.jar
11:09:29.081 [main] DEBUG d.b.a.i.b.maven.MavenLoggingAdapter - Reading
resolution tracking file
/home/ae/.m2/repository/de/b/a-dummy-java-bl/1.0/_maven.repositories
11:09:29.100 [main] DEBUG d.b.a.i.b.maven.MavenLoggingAdapter - Writing
resolution tracking file
/home/ae/.m2/repository/de/b/a-dummy-java-bl/1.0/_maven.repositories
11:09:29.101 [main] INFO  d.b.a.i.b.maven.MavenLoggingAdapter - Installing
/tmp/a_mvn_build_test_dummy-application_9224f35e-08c0-47e3-b5ec-61e3aa6ecb8a/a-dummy-java-bl/pom.xml
to /home/ae/.m2/repository/de/b/a-dummy-java-bl/1.0/a-dummy-java-bl-1.0.pom
11:09:29.101 [main] DEBUG d.b.a.i.b.maven.MavenLoggingAdapter - Reading
resolution tracking file
/home/ae/.m2/repository/de/b/a-dummy-java-bl/1.0/_maven.repositories
11:09:29.101 [main] DEBUG d.b.a.i.b.maven.MavenLoggingAdapter - Writing
resolution tracking file
/home/ae/.m2/repository/de/b/a-dummy-java-bl/1.0/_maven.repositories
11:09:29.102 [main] DEBUG d.b.a.i.b.maven.MavenLoggingAdapter - Installing
de.b:a-dummy-java-bl/maven-metadata.xml to
/home/ae/.m2/repository/de/b/a-dummy-java-bl/maven-metadata-local.xml
11:09:29.153 [main] DEBUG d.b.a.i.b.maven.MavenLoggingAdapter - Configuring
mojo 'org.apache.maven.plugins:maven-clean-plugin:2.4.1:clean' with basic
configurator -->
11:09:29.154 [main] DEBUG d.b.a.i.b.maven.MavenLoggingAdapter - -- end
configuration --
11:09:29.155 [main] DEBUG d.b.a.i.b.maven.MavenLoggingAdapter - Configuring
mojo 'org.apache.maven.plugins:maven-resources-plugin:2.4.3:resources' with
basic configurator -->
11:09:29.155 [main] DEBUG d.b.a.i.b.maven.MavenLoggingAdapter - -- end
configuration --
11:09:29.155 [main] WARN  d.b.a.i.b.maven.MavenLoggingAdapter - Using
platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is
platform dependent!
11:09:29.155 [main] DEBUG d.b.a.i.b.maven.MavenLoggingAdapter - ignoreDelta
true
11:09:29.187 [main] ERROR d.b.a.i.b.m.MavenBuildServiceTestSuite -
exceptions in maven execution: Failed to execute goal
org.apache.maven.plugins:maven-resources-plugin:2.4.3:resources
(default-resources) on project a-dummy-java-webapp: Execution
default-resources of goal
org.apache.maven.plugins:maven-resources-plugin:2.4.3:resources failed: An
API incompatibility was encountered while executing
org.apache.maven.plugins:maven-resources-plugin:2.4.3:resources:
java.lang.LinkageError: loader constraint violation: when resolving
interface method
"org.sonatype.plexus.build.incremental.BuildContext.newScanner(Ljava/io/File;Z)Lorg/codehaus/plexus/util/Scanner;"
the class loader (instance of
org/codehaus/plexus/classworlds/realm/ClassRealm) of the current class,
org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering, and the
class loader (instance of sun/misc/Launcher$AppClassLoader) for resolved
class, org/sonatype/plexus/build/incremental/BuildContext, have different
Class objects for the type org/codehaus/plexus/util/Scanner used in the
signature
-----------------------------------------------------
realm =    plugin>org.apache.maven.plugins:maven-resources-plugin:2.4.3
strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
urls[0] =
file:/home/ae/.m2/repository/org/apache/maven/plugins/maven-resources-plugin/2.4.3/maven-resources-plugin-2.4.3.jar
urls[1] =
file:/home/ae/.m2/repository/org/apache/maven/reporting/maven-reporting-api/2.0.6/maven-reporting-api-2.0.6.jar
urls[2] =
file:/home/ae/.m2/repository/org/apache/maven/doxia/doxia-sink-api/1.0-alpha-7/doxia-sink-api-1.0-alpha-7.jar
urls[3] =
file:/home/ae/.m2/repository/commons-cli/commons-cli/1.0/commons-cli-1.0.jar
urls[4] =
file:/home/ae/.m2/repository/org/codehaus/plexus/plexus-interactivity-api/1.0-alpha-4/plexus-interactivity-api-1.0-alpha-4.jar
urls[5] = file:/home/ae/.m2/repository/junit/junit/3.8.1/junit-3.8.1.jar
urls[6] =
file:/home/ae/.m2/repository/org/codehaus/plexus/plexus-utils/2.0.5/plexus-utils-2.0.5.jar
urls[7] =
file:/home/ae/.m2/repository/org/apache/maven/shared/maven-filtering/1.0-beta-4/maven-filtering-1.0-beta-4.jar
urls[8] =
file:/home/ae/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.13/plexus-interpolation-1.13.jar
Number of foreign imports: 1
import: Entry[import  from realm ClassRealm[maven.api, parent: null]]
-----------------------------------------------------

I fear that the main reason for this to fail is that the pom for
maven-shared:maven-filtering:1.0-beta-4, which seems to be a dependency of
the maven-resources-plugin, is conceived as being invalid. I failed to
extract more info from maven on what exactly is invalid.
-- 
View this message in context: http://maven.40175.n5.nabble.com/java-lang-NoClassDefFoundError-Lorg-sonatype-plexus-build-incremental-BuildContext-tp3286295p3287434.html
Sent from the Maven Developers mailing list archive at Nabble.com.

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


Re: java.lang.NoClassDefFoundError: Lorg/sonatype/plexus/build/incremental/BuildContext;

Posted by Olivier Lamy <ol...@apache.org>.
Hi,
Try with adding the following dependency :

    <dependency>
      <groupId>org.sonatype.plexus</groupId>
      <artifactId>plexus-build-api</artifactId>
      <version>0.0.6</version>
    </dependency>

HTH,
-- 
Olivier Lamy
http://twitter.com/olamy
http://www.linkedin.com/in/olamy

2010/11/30 a.e <a....@lupuz.de>:
>
> Hi,
>
> I'm in the middle of developing an integration server for several month now.
> Of course the system embedds maven which did work rather good with maven
> 2.2.1 and even the beta builds of maven 3. Since the release of 3.0 and even
> 3.0.1 my own MavenEmbedder class (basically something like this
> http://java.net/projects/hudson/sources/svn/show/trunk/hudson/lib/maven-embedder)
> does not work any more.  If I try to build an test project with my embedder
> i get an NoClassDefFoundError:
>
> java.lang.NoClassDefFoundError:
> Lorg/sonatype/plexus/build/incremental/BuildContext;
>        at java.lang.Class.getDeclaredFields0(Native Method) ~[na:1.6.0_22]
>        at java.lang.Class.privateGetDeclaredFields(Class.java:2291) ~[na:1.6.0_22]
>        at java.lang.Class.getDeclaredFields(Class.java:1743) ~[na:1.6.0_22]
>        at
> com.google.inject.spi.InjectionPoint.getInjectionPoints(InjectionPoint.java:649)
> ~[sisu-guice-2.9.1-noaop.jar:na]
> [...]
>
> I can provide the complete stacktrace if necessary.
> The only strange thing I can find in my logs is the following that gets
> logged right before the error occurs:
>
> 17:06:21.845 [main] WARN  d.b.a.i.b.maven.MavenLoggingAdapter - The POM for
> org.apache.maven.shared:maven-filtering:jar:1.0-beta-4 is invalid,
> transitive dependencies (if any) will not be available, enable debug logging
> for more details
>
> --
> View this message in context: http://maven.40175.n5.nabble.com/java-lang-NoClassDefFoundError-Lorg-sonatype-plexus-build-incremental-BuildContext-tp3286295p3286295.html
> Sent from the Maven Developers mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>

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