Hi DonLuigi,

my comment inlines:
1)
Problem (bug?): When I  deploy 1.1.0 bundle, BundleActivator is called from
1.0.0.
If I refactor BundleActivator classes so they have different names in 1.0.0
and 1.1.0, when I install 1.1.0 Karaf says “class not found”, meaning it is
looking in 1.0.0 jar.

Can anyone explain to me what am I doing wrong?

I think the problem is with your Import-Package statement.

For example, if you have something like that:

<Export-Package>my.package*</Export-Package>
<Import-Package>other,*</Export-Package>

It's totally possible that my.package* comes from another same bundle in another version.

The good approach is to have:

<Export-Package>my.package*;version=xx</Export-Package>
<Import-Package>my.package*;version=xx,*</Import-Package>

or

<Export-Package>my.package*;version=xx</Export-Package>
<Import-Package>!my.package*,*</Import-Package>

like this, you are sure that you use the package provided by your bundle (and not by another same bundle in a different version).


2)
I also have a configuration that gets bound only to 1.0.0, but not 1.1.0,
even though they have the same PID.

Is it possible to share configuration between different versions or must
1.0.0 and 1.1.0 have different PIDs and therefore different (copy/pasted)
metatype declarations?

If the configuration is the same, you can use the same (same PID) for both 1.0.0 and 1.1.0. It's only the usage of the same PID via the ConfigAdmin service. However, if the configuration is different between 1.1.0 and 1.0.0, in that case, you have to use different PID, or add a version property to filter.

Regards
JB


Any help very much appreciated!
DonLuigi

P.S. Here is a pom snippet:
   <groupId>com.test</groupId>
   <artifactId>mock-operation1</artifactId>
   <version>1.1.0</version>
   <packaging>bundle</packaging>
   <name>  Mock Operation 1</name>

   <properties>
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
   </properties>

   <build>
     <plugins>
       <plugin>
         <groupId>org.apache.felix</groupId>
         <artifactId>maven-bundle-plugin</artifactId>
         <version>2.1.0</version>
         <extensions>true</extensions>
         <configuration>
           <instructions>

<Bundle-Activator>si.blah.osgi.MyBundleActivator</Bundle-Activator>
             <Bundle-SymbolicName>mock-operation-1</Bundle-SymbolicName>
           </instructions>
         </configuration>
       </plugin>
     </plugins>
   </build>

--
View this message in context: 
http://karaf.922171.n3.nabble.com/Problems-with-two-versions-of-the-same-bundle-tp3267839p3267839.html
Sent from the Karaf - User mailing list archive at Nabble.com.

--
Jean-Baptiste Onofré
jbono...@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Reply via email to