Expand my Community achievements bar.

SOLVED

AEM 6.4.3 | Osgi R7 | Bundle in Installed status

Avatar

Level 4

Hi,

I created a project using maven archetype 17

mvn archetype:generate -DarchetypeGroupId=com.adobe.granite.archetypes -DarchetypeArtifactId=aem-project-archetype -DarchetypeVersion=17 -P adobe-public

updated the pom to use OSGI R7 dependencies

<dependency>

   <groupId>org.osgi</groupId>

   <artifactId>osgi.core</artifactId>

   <version>7.0.0</version>

   <scope>provided</scope>

</dependency>

<dependency>

   <groupId>org.osgi</groupId>

   <artifactId>osgi.cmpn</artifactId>

   <version>7.0.0</version>

   <scope>provided</scope>

</dependency>

<dependency>

   <groupId>org.osgi</groupId>

   <artifactId>osgi.annotation</artifactId>

   <version>7.0.0</version>

   <scope>provided</scope>

</dependency>

Deployed to AEM 6.4.3 instance. But the bundle is in installed status due to

     org.osgi.service.event,version=[1.4,2.0) -- Cannot be resolved

SimpleResourceListener.java sample class is importing the interface org.osgi.service.event.EventHandler from org.osgi:osgi.cmpn:7.0.0 and this is not available in the felix container.

Could you please help me in resolving this issue?

Thanks,

Radha Krishna N

1 Accepted Solution

Avatar

Correct answer by
Level 4

Thanks Arun for the clarification.

Below dependency order worked for me.

  1. <dependency> 
  2.     <groupId>org.apache.felix</groupId> 
  3.     <artifactId>org.apache.felix.eventadmin</artifactId> 
  4.     <version>1.4.10</version> 
  5.     <scope>provided</scope> 
  6. </dependency> 
  7. <dependency> 
  8.     <groupId>org.osgi</groupId> 
  9.     <artifactId>osgi.core</artifactId> 
  10.     <version>7.0.0</version> 
  11.     <scope>provided</scope> 
  12. </dependency> 
  13. <dependency> 
  14.     <groupId>org.osgi</groupId> 
  15.     <artifactId>osgi.cmpn</artifactId> 
  16.     <version>7.0.0</version> 
  17.     <scope>provided</scope> 
  18. </dependency> 
  19. <dependency> 
  20.     <groupId>org.osgi</groupId> 
  21.     <artifactId>osgi.annotation</artifactId> 
  22.     <version>7.0.0</version> 
  23.     <scope>provided</scope> 
  24. </dependency> 

View solution in original post

9 Replies

Avatar

Level 8

I am not able to reproduce the issue.

1719752_pastedImage_0.png

created project using archetype 17 and deploy successfully to 6.4.3

bundles are working fine.

1719753_pastedImage_1.png

Avatar

Level 4

Hi Hemant,

Did you modify the pom to use osgi R7 dependencies as above?

It works for me also with AEM6.4.3+maven archetype 17 (no modification to pom file).

Thanks,

Radha Krishna N

Avatar

Community Advisor

Hi,

Add below dependency as well in parent and core pom

<dependency>

<groupId>org.osgi</groupId>

<artifactId>org.osgi.compendium</artifactId>

<version>5.0.0</version>

<scope>provided</scope>

</dependency>

Please check below?

OSGI R7 annotation



Arun Patidar

Avatar

Level 10

For 6.4, why did you jump to 17?

Avatar

Level 4

arunpatidar26​ after making changes to pom as below, bundle became active. I have org.apache.felix.eventadmin dependency before osgi.cmpn

<dependency>

    <groupId>org.apache.felix</groupId>

    <artifactId>org.apache.felix.eventadmin</artifactId>

    <version>1.4.10</version>

    <scope>provided</scope>

</dependency>

<dependency>

    <groupId>org.osgi</groupId>

    <artifactId>osgi.core</artifactId>

    <version>7.0.0</version>

    <scope>provided</scope>

</dependency>

<dependency>

    <groupId>org.osgi</groupId>

    <artifactId>osgi.cmpn</artifactId>

    <version>7.0.0</version>

    <scope>provided</scope>

</dependency>

<dependency>

    <groupId>org.osgi</groupId>

    <artifactId>osgi.annotation</artifactId>

    <version>7.0.0</version>

    <scope>provided</scope>

</dependency>

Also the dependency which you mentioned worked when I placed at the top. But aren't we dependent on 2 versions of the same artifact?

<dependency>

    <groupId>org.osgi</groupId>

    <artifactId>org.osgi.compendium</artifactId>

    <version>5.0.0</version>

    <scope>provided</scope>

</dependency>

<dependency>

    <groupId>org.osgi</groupId>

    <artifactId>osgi.core</artifactId>

    <version>7.0.0</version>

    <scope>provided</scope>

</dependency>

<dependency>

    <groupId>org.osgi</groupId>

    <artifactId>osgi.cmpn</artifactId>

    <version>7.0.0</version>

    <scope>provided</scope>

</dependency>

<dependency>

    <groupId>org.osgi</groupId>

    <artifactId>osgi.annotation</artifactId>

    <version>7.0.0</version>

    <scope>provided</scope>

</dependency>

Thanks,

Radha Krishna N

Avatar

Community Advisor

Hi,

1. I have added org.osgi.compendium dependency at the end of Osgi dependency section, works for me.

2. Apache Felix Event Admin Service Specification, part of the OSGi Compendium specification, defines a general inter-bundle communication mechanism. The communication conforms to the popular publish/subscribe paradigm and can be performed in a synchronous or asysnchronous manner.



Arun Patidar

Avatar

Level 4

Arun,

1. Placing the org.osgi.compendium dependency below did not work for me.

2. Which dependency should I be using org.osgi.compendium or org.apache.felix.eventadmin

3. org.osgi.compendium:5.0.0 and osgi.cmpn:7.0.0 are different versions of OSGi Compendium specification. Is this correct?

Thanks,

Radhakrishna N

Avatar

Community Advisor

Hi,

1. The org.osgi.compendium imports the lower version of EventAdmin, that's fix the issue but

2. you should use org.apache.felix.eventadmin since other one is already upgraded as new version, so shouldn't use lower version lib.

3. Yes, org.osgi.compendium:5.0.0 and osgi.cmpn:7.0.0 are different versions of OSGi Compendium specification, so should be use osgi.cmpn:7.0.0

It is fine, you can use below dependencies in your project.

<artifactId>org.apache.felix.eventadmin</artifactId> 

<artifactId>osgi.cmpn</artifactId> 



Arun Patidar

Avatar

Correct answer by
Level 4

Thanks Arun for the clarification.

Below dependency order worked for me.

  1. <dependency> 
  2.     <groupId>org.apache.felix</groupId> 
  3.     <artifactId>org.apache.felix.eventadmin</artifactId> 
  4.     <version>1.4.10</version> 
  5.     <scope>provided</scope> 
  6. </dependency> 
  7. <dependency> 
  8.     <groupId>org.osgi</groupId> 
  9.     <artifactId>osgi.core</artifactId> 
  10.     <version>7.0.0</version> 
  11.     <scope>provided</scope> 
  12. </dependency> 
  13. <dependency> 
  14.     <groupId>org.osgi</groupId> 
  15.     <artifactId>osgi.cmpn</artifactId> 
  16.     <version>7.0.0</version> 
  17.     <scope>provided</scope> 
  18. </dependency> 
  19. <dependency> 
  20.     <groupId>org.osgi</groupId> 
  21.     <artifactId>osgi.annotation</artifactId> 
  22.     <version>7.0.0</version> 
  23.     <scope>provided</scope> 
  24. </dependency>