AEM 6.4.3 | Osgi R7 | Bundle in Installed status

Avatar

Avatar

Radha_Krishna_N

Avatar

Radha_Krishna_N

Radha_Krishna_N

26-03-2019

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

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

Radha_Krishna_N

Avatar

Radha_Krishna_N

Radha_Krishna_N

27-03-2019

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> 

Answers (8)

Answers (8)

Avatar

Avatar

Arun_Patidar

MVP

Total Posts

2.9K

Likes

1.0K

Correct Answer

831

Avatar

Arun_Patidar

MVP

Total Posts

2.9K

Likes

1.0K

Correct Answer

831
Arun_Patidar
MVP

27-03-2019

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> 

Avatar

Avatar

Arun_Patidar

MVP

Total Posts

2.9K

Likes

1.0K

Correct Answer

831

Avatar

Arun_Patidar

MVP

Total Posts

2.9K

Likes

1.0K

Correct Answer

831
Arun_Patidar
MVP

27-03-2019

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.

Avatar

Avatar

Radha_Krishna_N

Avatar

Radha_Krishna_N

Radha_Krishna_N

27-03-2019

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

Avatar

Radha_Krishna_N

Avatar

Radha_Krishna_N

Radha_Krishna_N

27-03-2019

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

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Answer

2.3K
smacdonald2008

27-03-2019

For 6.4, why did you jump to 17?

Avatar

Avatar

Arun_Patidar

MVP

Total Posts

2.9K

Likes

1.0K

Correct Answer

831

Avatar

Arun_Patidar

MVP

Total Posts

2.9K

Likes

1.0K

Correct Answer

831
Arun_Patidar
MVP

27-03-2019

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

Avatar

Avatar

Radha_Krishna_N

Avatar

Radha_Krishna_N

Radha_Krishna_N

27-03-2019

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

Avatar

Hemant_arora

Avatar

Hemant_arora

Hemant_arora

27-03-2019

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