ops4j / org.ops4j.pax.construct

Build, manage and deploy many types of OSGi bundles
https://ops4j1.jira.com/wiki/display/paxconstruct/Pax+Construct
24 stars 14 forks source link

java.lang.LinkageError when running 'mvn install' before 'mvn pax:eclipse' [PAXCONSTRUCT-110] #45

Closed ops4j-issues closed 15 years ago

ops4j-issues commented 15 years ago

Joachim Kainz created PAXCONSTRUCT-110

I can reliably reproduce the issue described in http://lists.ops4j.org/pipermail/general/2009q1/000787.html. I am using the following simple script:

-------------bug.sh------------------
#!/bin/sh
rm -rf ~/.m2/repository
pax-create-project -g com.jolira.pax -a bug -v 0.0.1-SNAPSHOT
cd bug
pax-wrap-jar -g org.apache.wicket -a wicket -v 1.4-rc2 – -DwrapTransitive
exec mvn install pax:eclipse
-------------bug.sh------------------

The error generated reads:

-------------mvn output------------
INFO ------------------------------------------------------------------------
ERROR FATAL ERROR
INFO ------------------------------------------------------------------------
INFO loader constraint violation: when resolving method "org.codehaus.plexus.util.xml.Xpp3DomWriter.write(Lorg/codehaus/plexus/util/xml/XMLWriter;Lorg/codehaus/plexus/util/xml/Xpp3Dom;)V" the class loader (instance of org/codehaus/classworlds/RealmClassLoader) of the current class, org/ops4j/pax/construct/lifecycle/EclipseOSGiMojo, and the class loader (instance of org/codehaus/classworlds/RealmClassLoader) for resolved class, org/codehaus/plexus/util/xml/Xpp3DomWriter, have different Class objects for the type org/codehaus/plexus/util/xml/XMLWriter used in the signature
INFO ------------------------------------------------------------------------
INFO Trace
java.lang.LinkageError: loader constraint violation: when resolving method "org.codehaus.plexus.util.xml.Xpp3DomWriter.write(Lorg/codehaus/plexus/util/xml/XMLWriter;Lorg/codehaus/plexus/util/xml/Xpp3Dom;)V" the class loader (instance of org/codehaus/classworlds/RealmClassLoader) of the current class, org/ops4j/pax/construct/lifecycle/EclipseOSGiMojo, and the class loader (instance of org/codehaus/classworlds/RealmClassLoader) for resolved class, org/codehaus/plexus/util/xml/Xpp3DomWriter, have different Class objects for the type org/codehaus/plexus/util/xml/XMLWriter used in the signature
at org.ops4j.pax.construct.lifecycle.EclipseOSGiMojo.addEmbeddedEntriesToEclipseClassPath(EclipseOSGiMojo.java:641)
at org.ops4j.pax.construct.lifecycle.EclipseOSGiMojo.refactorForEclipse(EclipseOSGiMojo.java:463)
at org.ops4j.pax.construct.lifecycle.EclipseOSGiMojo.writeBundleConfiguration(EclipseOSGiMojo.java:244)
at org.ops4j.pax.construct.lifecycle.EclipseOSGiMojo.writeConfiguration(EclipseOSGiMojo.java:195)
at org.apache.maven.plugin.ide.AbstractIdeSupportMojo.execute(AbstractIdeSupportMojo.java:494)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:451)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:558)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:512)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:482)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:330)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:291)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:142)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:287)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
-------------mvn output------------

If I run 'exec mvn pax:eclipse' instead of 'exec mvn install pax:eclipse' as the last command in the script, the error does not happen.

I can work around this issue by removing my local repository before running 'mvn pax:eclipse', but this workaround is hardly scalable.


Affects: 1.4 Attachments:

Votes: 0, Watches: 1

ops4j-issues commented 15 years ago

Stuart McCulloch commented

This looks similar to the following thread:

http://www.mail-archive.com/general@lists.ops4j.org/msg05945.html

the problem disappeared once Mike fixed his JDK installation

Which JDK are you using, could you post the results of running "which java" and "echo $JAVA_HOME" ?

ops4j-issues commented 15 years ago

Joachim Kainz commented

Sorry for not getting back regarding this issue. I am using the JDK 1.6 that comes with Ubuntu 9.04.

I figured out that the problem only exists if I use Maven 2.0.9 from the Ubuntu repository. The dependencies of this package include libwagon and others, which I believe create the problem described above.

Instead of maven 2.0.9 from the repo I now use maven 2.1.0. Everything works like a charm.

I think this conclusively proves that this is not a pax-construct issue, but rather an issue with the particular maven install.

ops4j-issues commented 15 years ago

Stuart McCulloch commented

Closing as requested