You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2019/01/10 20:34:00 UTC

[jira] [Commented] (FELIX-6023) SCR bnd plugin sometimes fails with IncompatibleClassChangeError: Implementing class

    [ https://issues.apache.org/jira/browse/FELIX-6023?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16739756#comment-16739756 ] 

ASF GitHub Bot commented on FELIX-6023:
---------------------------------------

GitHub user adamcin opened a pull request:

    https://github.com/apache/felix/pull/165

    FELIX-6023 bnd scrplugin preserve sequence of classpath entries.

    Replace the HashSet used for deduping classpath entries with a LinkedHashSet to retain the precedence established by the Analyzer.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/adamcin/felix FELIX-6023

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/felix/pull/165.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #165
    
----
commit 0e50d6bdff9f53ef6fb5efe9aa8f9ff88d4c82d1
Author: Mark Adamcin <ad...@...>
Date:   2019-01-10T20:29:40Z

    FELIX-6023 bnd scrplugin preserve sequence of classpath entries.

----


> SCR bnd plugin sometimes fails with IncompatibleClassChangeError: Implementing class
> ------------------------------------------------------------------------------------
>
>                 Key: FELIX-6023
>                 URL: https://issues.apache.org/jira/browse/FELIX-6023
>             Project: Felix
>          Issue Type: Bug
>          Components: SCR Tooling
>    Affects Versions: scr bnd plugin 1.9.0
>         Environment: Maven home: /usr/local/Cellar/maven/3.6.0/libexec
> Java version: 1.8.0_192, vendor: Oracle Corporation, runtime: /Library/Java/JavaVirtualMachines/jdk1.8.0_192.jdk/Contents/Home/jre
> Default locale: en_US, platform encoding: UTF-8
> OS name: "mac os x", version: "10.14.2", arch: "x86_64", family: "mac"
>            Reporter: Mark Adamcin
>            Priority: Major
>         Attachments: com.adobe.acs.acs-aem-commons-bundle.bnd-1.9.0.log, com.adobe.acs.acs-aem-commons-bundle.bnd-1.9.1-SNAPSHOT.log
>
>
>  
> When building a project where a newer version of a dependency is embedded in the project artifact with a conflicting older version of said dependency is also present on the classpath, SOME environments encounter an exception that is similar to the following:
> {noformat}
> [ERROR] Manifest com.adobe.acs:acs-aem-commons-bundle:bundle:3.19.1-SNAPSHOT : Got unexpected exception while analyzing:org.apache.felix.scrplugin.SCRDescriptorException: Unable to load compiled class: com.google.common.base.Suppliers$SupplierFunctionImpl
> 	at org.apache.felix.scrplugin.helper.ClassScanner.scanSources(ClassScanner.java:156)
> 	at org.apache.felix.scrplugin.SCRDescriptorGenerator.execute(SCRDescriptorGenerator.java:146)
> 	at org.apache.felix.scrplugin.bnd.SCRDescriptorBndPlugin.analyzeJar(SCRDescriptorBndPlugin.java:178)
> 	at aQute.bnd.osgi.Analyzer.doPlugins(Analyzer.java:820)
> 	at aQute.bnd.osgi.Analyzer.analyze(Analyzer.java:229)
> 	at aQute.bnd.osgi.Builder.analyze(Builder.java:408)
> 	at aQute.bnd.osgi.Analyzer.calcManifest(Analyzer.java:850)
> 	at aQute.bnd.osgi.Builder.build(Builder.java:116)
> 	at org.apache.felix.bundleplugin.ManifestPlugin.getAnalyzer(ManifestPlugin.java:291)
> 	at org.apache.felix.bundleplugin.ManifestPlugin.execute(ManifestPlugin.java:98)
> 	at org.apache.felix.bundleplugin.BundlePlugin.execute(BundlePlugin.java:384)
> 	at org.apache.felix.bundleplugin.BundlePlugin.execute(BundlePlugin.java:375)
> 	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
> 	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
> 	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
> 	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
> 	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
> 	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
> 	at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
> 	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
> 	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
> 	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
> 	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
> 	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:956)
> 	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
> 	at org.apache.maven.cli.MavenCli.main(MavenCli.java:192)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 	at java.lang.reflect.Method.invoke(Method.java:498)
> 	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
> 	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
> 	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
> 	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
> Caused by: java.lang.IncompatibleClassChangeError: Implementing class
> 	at java.lang.ClassLoader.defineClass1(Native Method)
> 	at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
> 	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
> 	at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
> 	at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
> 	at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
> 	at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
> 	at java.security.AccessController.doPrivileged(Native Method)
> 	at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
> 	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
> 	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
> 	at org.apache.felix.scrplugin.helper.ClassScanner.scanSources(ClassScanner.java:144)
> 	... 33 more
> [ERROR] Error(s) found in manifest configuration{noformat}
> The sequence of dependencies in the build should allow the preferred embedded version to be declared with higher precedence than the non-preferred version, but this sequence does not appear to be respected because of the use of a non-linked HashSet in `SCRDescriptorBndPlugin.getClassPath()` to post-process the list of classpath elements returned from Analyzer.getClasspath().
> I attached to debug logs from the execution. the *.bnd-1.9.0.log file shows the `uber-jar` artifact listed before the `guava` artifact in the classpath log, but their order is reversed in the dependencies log.
> I then replaced the HashSet with a LinkedHashSet in the bnd plugin and rebuilt the project, resulting in the *.bnd-1.9.1-SNAPSHOT.log, which shows the sequence of these two artifacts being the same in both the classpath log and the dependencies log.
> See: [https://github.com/Adobe-Consulting-Services/acs-aem-commons/issues/1675] for background.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)