Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

Included dependency jar is not resolving in bundle

GK-AEM
Level 9
Level 9

Hi All,,

In one of my sling servlet we are parsing a xml for this we are using dom4j.

To compile these classes i have included below Maven dependency.

<dependency>
            <groupId>dom4j</groupId>
            <artifactId>dom4j</artifactId>
            <version>1.3</version>
        </dependency>

When i create bundle and installing through Maven bulid script this classes in this jar are not reflecting.

Do i need to make any changes build script to automatically deploy into CQ server?

Thanks,

Kishore

1 Accepted Solution
smacdonald2008
Correct answer by
Level 10
Level 10

Use Eclipse plug-in project to wrap the JAR into an OSGi bundle and deploy the bundle to AEM. See this article to learn how to wrap a JAR into an OSGi using Eclipse plug-in project: 

https://helpx.adobe.com/experience-manager/using/custom-sling-servlets.html

As an example - notice how we wrap the simple JSON JAR into an OSGi bundle. 

View solution in original post

4 Replies
Jörg_Hoh
Employee
Employee

You need either to embed this dependency into your jar or deploy an osgi-version of that jar into AEM. Google says, that Apache servicemix provides an OSGI version of dom4j, so you can deploy it together with your bundles into AEM.

kind regards,
Jörg

GK-AEM
Level 9
Level 9

Jörg Hoh wrote...

You need either to embed this dependency into your jar or deploy an osgi-version of that jar into AEM. Google says, that Apache servicemix provides an OSGI version of dom4j, so you can deploy it together with your bundles into AEM.

kind regards,
Jörg

 

Thanks Jorg,

Could you please explain in detail, and how to do this?

edubey
Level 10
Level 10

Please refer to the following links for more details on how you can achieve this:

How to embed a jar: https://github.com/cytoscape/cytoscape-app-samples/blob/master/sample-embed-dependencies/pom.xml

Few basic concepts: http://felix.apache.org/documentation/subprojects/apache-felix-maven-bundle-plugin-bnd.html

Let me know if you need anything else.

smacdonald2008
Correct answer by
Level 10
Level 10

Use Eclipse plug-in project to wrap the JAR into an OSGi bundle and deploy the bundle to AEM. See this article to learn how to wrap a JAR into an OSGi using Eclipse plug-in project: 

https://helpx.adobe.com/experience-manager/using/custom-sling-servlets.html

As an example - notice how we wrap the simple JSON JAR into an OSGi bundle. 

View solution in original post