ImportMergeException for aspectj [message #829358] |
Mon, 26 March 2012 07:29 |
Piotrek De Messages: 5 Registered: March 2012 |
Junior Member |
|
|
Hi,
I want to use AspectJ (ebr.springsource.com/repository/app/library/detail?name=org.aspectj) in my OSGI bundle on the latest (3.0.2.RELEASE) Virgo release.
No matter if an entire library, or all bundles included are imported, ImportMergeException is raised. In order to build by bundle, I use maven-bundle-plugin in the latest 2.3.7 version.
In case of the following settings:
<Import-Library>
org.springframework.spring;version="3.0.5.RELEASE"
</Import-Library>
<Import-Bundle>
com.springsource.org.aspectj.runtime;version="1.6.5.RELEASE",
com.springsource.org.aspectj.weaver;version="1.6.5.RELEASE"
</Import-Bundle>
Exception below is thrown:
Caused by: org.eclipse.virgo.kernel.osgi.framework.ImportMergeException: cannot merge imports of package 'org.aspectj.lang' from sources 'Import-Library 'org.springframework.spring' version '3.0.5.RELEASE'(null), Import-Bundle 'com.springsource.org.aspectj.runtime' version '1.6.5.RELEASE', Import-Bundle 'com.springsource.org.aspectj.weaver' version '1.6.5.RELEASE'' because of conflicting values 'com.springsource.org.aspectj.weaver', 'com.springsource.org.aspectj.runtime' of attribute 'bundle-symbolic-name'
Exactly the same when I use an entire library instead of a single bundles imports:
<Import-Library>
org.springframework.spring;version="3.0.5.RELEASE",
org.aspectj;version="1.6.5.RELEASE"
</Import-Library>
Caused by: org.eclipse.virgo.kernel.osgi.framework.ImportMergeException: cannot merge imports of package 'org.aspectj.lang.annotation' from sources 'Import-Library 'org.aspectj' version '1.6.5.RELEASE'(Import-Bundle 'com.springsource.org.aspectj.weaver' version '1.6.5.RELEASE', Import-Bundle 'com.springsource.org.aspectj.runtime' version '1.6.5.RELEASE')' because of conflicting values 'com.springsource.org.aspectj.runtime', 'com.springsource.org.aspectj.weaver' of attribute 'bundle-symbolic-name'
I've also tried to upgrade AspectJ libs, but unfortunately still unsuccessfully. The same exception is for all versions 1.6.5+ (1.6.12.RELEASE is the latest one):
<Import-Library>
org.springframework.spring;version="3.0.5.RELEASE"
</Import-Library>
<Import-Bundle>
com.springsource.org.aspectj.runtime;version="1.6.6.RELEASE",
com.springsource.org.aspectj.weaver;version="1.6.6.RELEASE"
</Import-Bundle>
Caused by: org.eclipse.virgo.kernel.osgi.framework.ImportMergeException: cannot merge imports of package 'org.aspectj.lang' from sources 'Import-Library 'org.springframework.spring' version '3.0.5.RELEASE'(null), Import-Bundle 'com.springsource.org.aspectj.runtime' version '1.6.6.RELEASE', Import-Bundle 'com.springsource.org.aspectj.weaver' version '1.6.6.RELEASE'' because of conflicting values 'com.springsource.org.aspectj.weaver', 'com.springsource.org.aspectj.runtime' of attribute 'bundle-symbolic-name'
Downgrading is not possible - it seems that spring requires aspectj in version 1.5 at least:
<Import-Library>
org.springframework.spring;version="3.0.5.RELEASE"
</Import-Library>
<Import-Bundle>
com.springsource.org.aspectj.runtime;version="1.6.3.RELEASE",
com.springsource.org.aspectj.weaver;version="1.6.3.RELEASE"
</Import-Bundle>
Uses violation: <Import-Package: org.springframework.aop.aspectj.annotation; version="0.0.0"> in bundle <com.company.bundle_0.4.0.SNAPSHOT[1332744741530]>
Found conflicts:
package 'org.springframework.core.io.support_3.0.5.RELEASE' in bundle 'org.springframework.core_3.0.5.RELEASE[25]' used by 'org.springframework.aop.aspectj.annotation_3.0.5.RELEASE' in bundle 'org.springframework.aop_3.0.5.RELEASE[21]'
conflicts with 'org.springframework.core.io.support_3.0.5.RELEASE' in bundle 'org.springframework.core_3.0.5.RELEASE[88]' used by 'org.springframework.orm.jpa_3.0.5.RELEASE' in bundle 'org.springframework.orm_3.0.5.RELEASE[91]'
package 'org.aopalliance.aop_1.0.0' in bundle 'com.springsource.org.aopalliance_1.0.0[32]' used by 'org.springframework.aop.aspectj.annotation_3.0.5.RELEASE' in bundle 'org.springframework.aop_3.0.5.RELEASE[21]'
conflicts with 'org.aopalliance.aop_1.0.0' in bundle 'com.springsource.org.aopalliance_1.0.0[71]' used by 'org.springframework.scheduling.annotation_3.0.5.RELEASE' in bundle 'org.springframework.context_3.0.5.RELEASE[87]'
package 'org.springframework.asm.commons_3.0.5.RELEASE' in bundle 'org.springframework.asm_3.0.5.RELEASE[22]' used by 'org.springframework.aop.aspectj.annotation_3.0.5.RELEASE' in bundle 'org.springframework.aop_3.0.5.RELEASE[21]'
conflicts with 'org.springframework.asm.commons_3.0.5.RELEASE' in bundle 'org.springframework.asm_3.0.5.RELEASE[85]' used by 'org.springframework.orm.jpa_3.0.5.RELEASE' in bundle 'org.springframework.orm_3.0.5.RELEASE[91]'
Uses violation: <Import-Package: org.springframework.aop.aspectj.autoproxy; version="0.0.0"> in bundle <com.company.bundle_0.4.0.SNAPSHOT[1332744741530]>
Resolver reported uses conflict for import constrained to bundle <org.springframework.aop> constrained bundle version range "[3.0.5.RELEASE,3.0.5.RELEASE]"
This defect is reported in the enterprise bundle repo issue tracker (issuetracker.springsource.com/browse/EBR-581) but unfortunately it's still unresolved. Is there any workaround for now?
Of cource it is possible to embed aspectj JARs inside particular bundles, but it seems to do not work properly in case of compile-time weaving.
Thanks in advance for any hints!
|
|
|
Re: ImportMergeException for aspectj [message #829597 is a reply to message #829358] |
Mon, 26 March 2012 14:24 |
Glyn Normington Messages: 1222 Registered: July 2009 |
Senior Member |
|
|
Unfortunately, the AspectJ runtime and weaver bundles in the EBR both export certain packages. I believe the EBR AspectJ runtime bundle was built from aspectjrt.jar which is a strict subset of the aspectjweaver.jar which was used to build the EBR AspectJ weaver bundle. So I think you can get rid of one source of the import merge exception (which is objecting to packages split across imported bundles) by importing the weaver bundle but not the runtime bundle.
Let me now try to provide some commentary on the exception so you have a better chance of understanding the root cause and making progress.
Caused by: org.eclipse.virgo.kernel.osgi.framework.ImportMergeException: cannot merge imports of package 'org.aspectj.lang' from sources 'Import-Library 'org.springframework.spring' version '3.0.5.RELEASE'(null), Import-Bundle 'com.springsource.org.aspectj.runtime' version '1.6.5.RELEASE', Import-Bundle 'com.springsource.org.aspectj.weaver' version '1.6.5.RELEASE'' because of conflicting values 'com.springsource.org.aspectj.weaver', 'com.springsource.org.aspectj.runtime' of attribute 'bundle-symbolic-name'
Virgo expands Import-Library and Import-Bundle into a bunch of package imports, but since any given package may be imported from just one bundle, the merge logic fails if there is a package imported from two or more imported bundles (via import-bundle or import-library). The message above shows that the package org.aspectj.lang is exported by the bundles with symbolic names com.springsource.org.aspectj.weaver and com.springsource.org.aspectj.runtime.
In general, if you really need to import the same "split" package from multiple bundles, you need to use Require-Bundle, but there are quite a few issues with this approach and it is best avoided if you can.
Please try importing the weaver bundle only and see if that helps.
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03726 seconds