Hi All,
i am using dom4j.jar to parse XML and in my local i have added as dependency ,so i am not seeing compilation erros.
How to embed the same jar and create a bundle and deploy the bundle
I have tried with several options of Embedd tag but could not able to resolve it.
Can someone please give details like how to use this Embedd tag.
Thanks,
Kishore
Solved! Go to Solution.
Views
Replies
Total Likes
To resolve a dependecy on an external JAR - you wrap a dependent JAR into an OSGi bundle and deploy that bundle. Look at how we wrap the simple JSON JAR file in this article:
https://helpx.adobe.com/experience-manager/using/custom-sling-servlets.html
Using Eclipse plug-in project is a great way.
Here is another example - look at how we include the jsoup JAR into AEM so a service can use it:
https://helpx.adobe.com/experience-manager/using/html-parser-service.html
Views
Replies
Total Likes
To resolve a dependecy on an external JAR - you wrap a dependent JAR into an OSGi bundle and deploy that bundle. Look at how we wrap the simple JSON JAR file in this article:
https://helpx.adobe.com/experience-manager/using/custom-sling-servlets.html
Using Eclipse plug-in project is a great way.
Here is another example - look at how we include the jsoup JAR into AEM so a service can use it:
https://helpx.adobe.com/experience-manager/using/html-parser-service.html
Views
Replies
Total Likes
Have you tried using the <Embed-Dependency> tag of maven-bundle-plugin -
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version></version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${bundle.symbolicName}</Bundle-SymbolicName>
<Bundle-Version>${project.version}</Bundle-Version>
<Bundle-Name>${bundle.name}</Bundle-Name>
<Export-Package>${bundle.namespace}</Export-Package>
<Bundle-Activator>Activator.class</Bundle-Activator>
<Embed-Dependency>*;scope=!provided|test;groupId=!org.mybundle.test</Embed-Dependency>
<Embed-Transitive>true</Embed-Transitive>
<Import-Package>*;resolution:=optional</Import-Package>
</instructions>
</configuration>
</plugin>
You can either include all the dependencies or you can configure to not to include specific ones. The scope attribute lets you configure which dependency jars you want to include based on their include scope. You should not include the dependencies which are only needed for compile and for test.
Views
Replies
Total Likes
kunal23 wrote...
Have you tried using the <Embed-Dependency> tag of maven-bundle-plugin -
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version></version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${bundle.symbolicName}</Bundle-SymbolicName>
<Bundle-Version>${project.version}</Bundle-Version>
<Bundle-Name>${bundle.name}</Bundle-Name>
<Export-Package>${bundle.namespace}</Export-Package>
<Bundle-Activator>Activator.class</Bundle-Activator>
<Embed-Dependency>*;scope=!provided|test;groupId=!org.mybundle.test</Embed-Dependency>
<Embed-Transitive>true</Embed-Transitive>
<Import-Package>*;resolution:=optional</Import-Package>
</instructions>
</configuration>
</plugin>
You can either include all the dependencies or you can configure to not to include specific ones. The scope attribute lets you configure which dependency jars you want to include based on their include scope. You should not include the dependencies which are only needed for compile and for test.
---
I have added dependency as below.
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>1.3</version>
<scope>provided</scope>
</dependency>
And embedded dependency as below
<instructions>
<!-- <Bundle-SymbolicName>${bundle.symbolicName}</Bundle-SymbolicName>
<Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
<Embed-Directory>/lib</Embed-Directory>
<Import-Package>!com.sun.msv.datatype,!com.sun.msv.datatype.xsd,
!org.gjt.xpp,!org.relaxng.datatype *</Import-Package>-->
<Export-Package>com.symantec.elibrary.*</Export-Package>
<Embed-Dependency>*;scope=provided</Embed-Dependency>
<Embed-Directory>OSGI-INF/lib</Embed-Directory>
<Embed-Transitive>true</Embed-Transitive>
<Import-Package>*;resolution:=optional</Import-Package>
</instructions>
getting below error
Imported Packages | com.sun.msv.datatype -- Cannot be resolved and overwritten by Boot Delegation
|
what's the issue???Please help me
Views
Replies
Total Likes
smacdonald2008 wrote...
To resolve a dependecy on an external JAR - you wrap a dependent JAR into an OSGi bundle and deploy that bundle. Look at how we wrap the simple JSON JAR file in this article:
https://helpx.adobe.com/experience-manager/using/custom-sling-servlets.html
Using Eclipse plug-in project is a great way.
Here is another example - look at how we include the jsoup JAR into AEM so a service can use it:
https://helpx.adobe.com/experience-manager/using/html-parser-service.html
still not understandable,why i am getting below error.
com.sun.msv.datatype -- Cannot be resolved and overwritten by Boot Delegation
com.sun.msv.datatype.xsd -- Cannot be resolved and overwritten by Boot Delegation
javax.swing.table from org.apache.felix.framework (0)
javax.swing.tree from org.apache.felix.framework (0)
javax.xml.parsers from org.apache.felix.framework (0)
javax.xml.transform.sax from org.apache.felix.framework (0)
org.apache.sling.api,version=[2.1,3) from org.apache.sling.api (184)
org.apache.sling.api.servlets,version=[2.1,3) from org.apache.sling.api (184)
org.apache.sling.jcr.api,version=[2.1,3) from org.apache.sling.jcr.api (104)
org.gjt.xpp -- Cannot be resolved
org.osgi.service.component,version=[1.1,2) from org.apache.felix.scr (55)
org.relaxng.datatype -- Cannot be resolved
org.slf4j,version=[1.5,2) from slf4j.api (6)
org.w3c.dom from org.apache.felix.framework (0)
org.xml.sax from org.apache.felix.framework (0)
org.xml.sax.ext from org.apache.felix.framework (0)
org.xml.sax.helpers from org.apache.felix.framework (0)
Views
Replies
Total Likes
YOu are missing a JAR file that defines these Java packages:
Now the sun one - looks like its similar issue that occurs when using web services:
https://helpx.adobe.com/experience-manager/using/creating-cxf-bundles-consume-web.html
See the fix we do in this article:
This workflow works on Adobe CQ; however, you may encounter the following exception:
Caused by: java.lang.ClassNotFoundException: com.sun.xml.internal.ws.spi.ProviderImpl
at org.apache.sling.commons.classloader.impl.ClassLoaderFacade.loadClass(ClassLoaderFacade.java:127)
at java.lang.ClassLoader.loadClass(Unknown Source)
at javax.xml.ws.spi.FactoryFinder.safeLoadClass(Unknown Source)
... 107 more
Solution:
To fix this issue and ensure that you can create a bundle that consumes web services as described in this article, modify the sling.properties file located in the crx-quickstart\conf folder. Add the following line of code to this file: sling.bootdelegation.com.sun=com.sun.*. Then restart the server.
Views
Replies
Total Likes
THis means that these packages are not in the AEM OSGi service container. These 2 missing packages need to be included into AEM.
Place the JAR(s) that contain these packages into an OSGi bundle and deploy to AEM.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies