Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Issue with Import Packages in OSGi Container

Avatar

Level 2

Hi Friends,

I have created a AEM project using maven Archetype process. I have an event listener component in that project which will listen to "Activate" event when a user tries to publish/replicate the content  from author to publish server. As part of that event I have a requirement to import the below package.

com.emc.esu.api.* (emcesuapi-1.4.1.jar).

Corresponding <dependency> for the same in both parent and child pom.xml files
<dependency>
<groupId>com.emc.esu</groupId>
<artifactId>emcesuapi</artifactId>
<version>1.4.1</version>
</dependency>

I could see the jars under Maven Dependencies folder after I give its dependency tag in POM. But in the osgi container under Import Packages section. It says

~com.emc.esu.api -- Cannot be resolved
com.emc.esu.api.rest -- Cannot be resolved

{Also attached the message.}

If I don't use this package, my listener code works perfectly fine. It listens to "Activate" event a logs a message.

Additional info just an FYI: The above packages are related to Atmos browser that will help us to upload the content created in AEM to the cloud. Currently the listener will log a message and as a next step I am trying to upload the content to cloud using those packages. Please note that I don't have entire code that uploads the content to cloud, I am just creating an object. That's all.

Let me know, if you have any questions.

Thanks

1 Accepted Solution

Avatar

Correct answer by
Level 10

See this article as an example of how to wrap a 3rd party JAR into an OSGi using Eclipse plug-in project. Notice how we wrap the simple JSON JAR: 

Submitting Adobe CQ form data to Java Sling Servlets

As Lokesh mentioned - you need to place the packages located in the JAR into the AEM OSGi service container. 

View solution in original post

2 Replies

Avatar

Level 10

maven dependency folder is different from OSGi container. Couple of ways to fix it

1. Convert the 3rd party jar as OSGi bundle and install that.

2. Include the 3rd party jar along with the OSGi bundle.

Avatar

Correct answer by
Level 10

See this article as an example of how to wrap a 3rd party JAR into an OSGi using Eclipse plug-in project. Notice how we wrap the simple JSON JAR: 

Submitting Adobe CQ form data to Java Sling Servlets

As Lokesh mentioned - you need to place the packages located in the JAR into the AEM OSGi service container.