I am building an OSGI Bundle in Eclipse then importing it into AEM. I cannot get the imported package com.headwire.cqblueprints.examples.osgi to be loaded with mvn -PautoInstallBundle clean install.
If I use mvn -PautoInstallBundle clean install -X I do not get any errors and the jar file is created.
In http://localhost:4502/system/console/bundles/331
I get
Symbolic Name | Shoprite.Nigeria.Services.Shoprite.Nigeria.Services-bundle |
Version | 1.0.0.SNAPSHOT |
Bundle Location | inputstream:Shoprite.Nigeria.Services-bundle-1.0-SNAPSHOT.jar |
Last Modification | Thu Sep 04 13:01:07 CAT 2014 |
Description | Maven Multimodule project for Services. |
Start Level | 20 |
Exported Packages | Shoprite.Nigeria.Models,version=1.0.0 Shoprite.Nigeria.Services,version=1.0.0 |
Imported Packages | com.headwire.cqblueprints.examples.osgi -- Cannot be resolved javax.net.ssl from org.apache.felix.framework (0) javax.xml.parsers from org.apache.felix.framework (0) org.slf4j,version=[1.5,2) from slf4j.api (14) |
Solved! Go to Solution.
Views
Replies
Total Likes
You need to create a bundle fragment with that Java library and deploy. This red means that AEM cannot find the dependency. One way you can resolve this issue is to get a JAR with this Java API in it and use Eclipse Plug-in project to wrap that JAR into an AEM bundle. Then deploy the OSGi bundle to AEM. This will eliminate the dependency issue. We have an example of wrapping the SIMPLE JSON JAR in this community article:
http://helpx.adobe.com/experience-manager/using/custom-sling-servlets.html
Views
Replies
Total Likes
It seems that you have not uploaded bundle into Felix console which contains the class com.headwire.cqblueprints.examples.osgi
Views
Replies
Total Likes
Or if the bundle is present in your OSGI container then it doesn't expose the desired package via its manifest file.
To see whether any of the bundle output the desired package; use the dependency finder console of Felix - http://localhost:4502/system/console/depfinder
put the package declaration and click on find. It will give you the information about bundle present in your OSGI that exposes the provided package.
- Runal
Views
Replies
Total Likes
The dependency comes from the foillowing part of my pom
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<instructions>
<Bundle-Activator>com.headwire.cqblueprints.examples.osgi.Activator</Bundle-Activator>
<Private-Package>com.headwire.cqblueprints.examples.osgi</Private-Package>
<Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
<Embed-Directory>OSGI-INF/lib</Embed-Directory>
<Embed-Transitive>true</Embed-Transitive>
<Import-Package>!org.slf4j.impl,*</Import-Package>
</instructions>
</configuration>
</plugin>
I also point to
<repository>
<id>cqblueprints</id>
<name>blueprints Repository</name>
<url>http://dev.cqblueprints.com/nexus/content/repositories/releases/</url>
<layout>default</layout>
</repository>
Inside of maven settings xml. for my build profile.
I would have thought that this would download and install the necessary far file.
I cannot find which jar file would contain the classes used by <Private-Package>com.headwire.cqblueprints.examples.osgi</Private-Package>
Views
Replies
Total Likes
The difficulty is that the felic console dependency finder cannot find com.headwire.cqblueprints.examples.osgi
Views
Replies
Total Likes
I guess the POM Entries that you have mentioned are from your project POM file?
Also I see com.headwire.cqblueprints.examples.osgi is declared as private package, any specific reason?
Below is what you can do:
1 - Embed the jar exposing headwire.cqblueprints into your Project Bundle:
2 - Convert the jar exposing com.headwire.cqblueprints.examples.osgi into OSGI bundle if it is not already an OSGI bundle jar.
If jar exposing com.headwire.cqblueprints.examples.osgi is already an OSGI bundle jar then simply upload it in your OSGI container using http://localhost:4502/system/console/bundles and then have the package import statement in your project POM. It should work then.
- Runal
Views
Replies
Total Likes
I had them as private-package as i was following the example on http://www.cqblueprints.com/tipsandtricks/build-and-deploy-osgi/build-deploy-osgi-1.html on how to configure the Apache Felix Bundle plugin:
Views
Replies
Total Likes
In the error snap that you have attached at the start, you are trying to import a package that you have declared as private package in your maven-bundle-plugin, which is <Private-Package>com.headwire.cqblueprints.examples.osgi</Private-Package>
Any package declared as private cannot be consumed by any other OSGI bundle.
If you simply looking for tutorial on how to create an OSGI bundle then following link on dev.day would help
More over if you want other bundles to consume files from package com.headwire.cqblueprints.examples.osgi then you need to list this package in Export-Package tag within maven-bundle-plugin.
For details on maven-bundle-plugin, refer to - http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html
- Ruanl
Views
Replies
Total Likes
You need to create a bundle fragment with that Java library and deploy. This red means that AEM cannot find the dependency. One way you can resolve this issue is to get a JAR with this Java API in it and use Eclipse Plug-in project to wrap that JAR into an AEM bundle. Then deploy the OSGi bundle to AEM. This will eliminate the dependency issue. We have an example of wrapping the SIMPLE JSON JAR in this community article:
http://helpx.adobe.com/experience-manager/using/custom-sling-servlets.html
Views
Replies
Total Likes
Views
Likes
Replies