I have created a MAVEN project in Eclipse. It compiles and installs.
Importing it I get
javax.json,version=[1.0,2) -- Cannot be resolved
javax.json.stream,version=[1.0,2) -- Cannot be resolved
org.apache.http -- Cannot be resolved
org.apache.http.client -- Cannot be resolved
org.apache.http.client.methods -- Cannot be resolved
org.apache.http.impl.client -- Cannot be resolved
org.apache.http.util -- Cannot be resolved
org.apache.log4j from log4j.over.slf4j (3)
org.slf4j,version=[1.5,2) from slf4j.api (14)
How do I correctly resolve this.
Solved! Go to Solution.
Views
Replies
Total Likes
What is happening here is your bundle that you built with Maven has a dependency on javax.json and org.apahce.http. You need to get JARs that contain these Java packages and place them into an OSGi bundle fragment.
You can use Eclipse plug-in project. To learn HOW TO do this - see this community article:
http://helpx.adobe.com/experience-manager/using/custom-sling-servlets.html
In this article - look at how we wrap the simple JSON JAR into a bundle fragment:
[img]OSGI.png[/img]
Views
Replies
Total Likes
Your question could be similar to following post
https://forums.adobe.com/thread/1010516
If not try to add these packages in your maven content package plugin import export configuration as
<configuration><instructions><Import-Package>*</Import-Package><Export-Package>org.apache.http.client.*,
org.apache.http.client.methods.*, org.apache.http.impl.client.*, org.apache.http.util.*</Export-Package></instructions></configuration>
Views
Replies
Total Likes
What is happening here is your bundle that you built with Maven has a dependency on javax.json and org.apahce.http. You need to get JARs that contain these Java packages and place them into an OSGi bundle fragment.
You can use Eclipse plug-in project. To learn HOW TO do this - see this community article:
http://helpx.adobe.com/experience-manager/using/custom-sling-servlets.html
In this article - look at how we wrap the simple JSON JAR into a bundle fragment:
[img]OSGI.png[/img]
Views
Replies
Total Likes
Thank you. That answers my question.
Best regards
Clive
Views
Replies
Total Likes
I am getting the following now.
I created the bundles for the dependencies as follows.
Symbolic Name | JSon.Javax |
Version | 1.0.0 |
Bundle Location | inputstream:JSon.Javax_1.0.0.jar |
Last Modification | Tue Oct 28 09:47:41 CAT 2014 |
Start Level | 20 |
Exported Packages | javax.json,version=0.0.0 javax.json.spi,version=0.0.0 javax.json.stream,version=0.0.0 org.glassfish.json,version=0.0.0 org.glassfish.json.api,version=0.0.0 |
and
Symbolic Name | osgi.httpclient.apache |
Version | 1.0.0 |
Bundle Location | inputstream:osgi.httpclient.apache_1.0.0.jar |
Last Modification | Tue Oct 28 09:15:06 CAT 2014 |
Start Level | 20 |
Exported Packages | org.apache.commons.codec,version=0.0.0 org.apache.commons.codec.binary,version=0.0.0 org.apache.commons.codec.digest,version=0.0.0 org.apache.commons.codec.language,version=0.0.0 org.apache.commons.codec.language.bm,version=0.0.0 org.apache.commons.codec.net,version=0.0.0 org.apache.http,version=0.0.0 org.apache.http.annotation,version=0.0.0 org.apache.http.auth,version=0.0.0 org.apache.http.auth.params,version=0.0.0 org.apache.http.client,version=0.0.0 org.apache.http.client.cache,version=0.0.0 org.apache.http.client.config,version=0.0.0 org.apache.http.client.entity,version=0.0.0 org.apache.http.client.fluent,version=0.0.0 org.apache.http.client.methods,version=0.0.0 org.apache.http.client.params,version=0.0.0 org.apache.http.client.protocol,version=0.0.0 org.apache.http.client.utils,version=0.0.0 org.apache.http.concurrent,version=0.0.0 org.apache.http.config,version=0.0.0 org.apache.http.conn,version=0.0.0 org.apache.http.conn.params,version=0.0.0 org.apache.http.conn.routing,version=0.0.0 org.apache.http.conn.scheme,version=0.0.0 org.apache.http.conn.socket,version=0.0.0 org.apache.http.conn.ssl,version=0.0.0 org.apache.http.conn.util,version=0.0.0 org.apache.http.cookie,version=0.0.0 org.apache.http.cookie.params,version=0.0.0 org.apache.http.entity,version=0.0.0 org.apache.http.entity.mime,version=0.0.0 org.apache.http.entity.mime.content,version=0.0.0 org.apache.http.impl,version=0.0.0 org.apache.http.impl.auth,version=0.0.0 org.apache.http.impl.client,version=0.0.0 org.apache.http.impl.client.cache,version=0.0.0 org.apache.http.impl.client.cache.ehcache,version=0.0.0 org.apache.http.impl.client.cache.memcached,version=0.0.0 org.apache.http.impl.conn,version=0.0.0 org.apache.http.impl.conn.tsccm,version=0.0.0 org.apache.http.impl.cookie,version=0.0.0 org.apache.http.impl.entity,version=0.0.0 org.apache.http.impl.execchain,version=0.0.0 org.apache.http.impl.io,version=0.0.0 org.apache.http.impl.pool,version=0.0.0 org.apache.http.io,version=0.0.0 org.apache.http.message,version=0.0.0 org.apache.http.osgi.impl,version=0.0.0 org.apache.http.osgi.services,version=0.0.0 org.apache.http.params,version=0.0.0 org.apache.http.pool,version=0.0.0 org.apache.http.protocol,version=0.0.0 org.apache.http.util,version=0.0.0 |
Imported Packages | None |
Manifest Headers | Bundle-ManifestVersion: 2 Bundle-Name: Apache Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-SymbolicName: osgi.httpclient.apache Bundle-Version: 1.0.0 Export-Package: org.apache.commons.codec, org.apache.commons.codec.binary, org.apache.commons.codec.digest, org.apache.commons.codec.language, org.apache.commons.codec.language.bm, org.apache.commons.codec.net, org.apache.http, org.apache.http.annotation, org.apache.http.auth, org.apache.http.auth.params, org.apache.http.client, org.apache.http.client.cache, org.apache.http.client.config, org.apache.http.client.entity, org.apache.http.client.fluent, org.apache.http.client.methods, org.apache.http.client.params, org.apache.http.client.protocol, org.apache.http.client.utils, org.apache.http.concurrent, org.apache.http.config, org.apache.http.conn, org.apache.http.conn.params, org.apache.http.conn.routing, org.apache.http.conn.scheme, org.apache.http.conn.socket, org.apache.http.conn.ssl, org.apache.http.conn.util, org.apache.http.cookie, org.apache.http.cookie.params, org.apache.http.entity, org.apache.http.entity.mime, org.apache.http.entity.mime.content, org.apache.http.impl, org.apache.http.impl.auth, org.apache.http.impl.client, org.apache.http.impl.client.cache, org.apache.http.impl.client.cache.ehcache, org.apache.http.impl.client.cache.memcached, org.apache.http.impl.conn, org.apache.http.impl.conn.tsccm, org.apache.http.impl.cookie, org.apache.http.impl.entity, org.apache.http.impl.execchain, org.apache.http.impl.io, org.apache.http.impl.pool, org.apache.http.io, org.apache.http.message, org.apache.http.osgi.impl, org.apache.http.osgi.services, org.apache.http.params, org.apache.http.pool, org.apache.http.protocol, org.apache.http.util Manifest-Version: 1.0 |
and
Symbolic Name | client.http |
Version | 1.0.0 |
Bundle Location | inputstream:client.http_1.0.0.jar |
Last Modification | Tue Oct 28 09:52:49 CAT 2014 |
Start Level | 1 |
Exported Packages | org.apache.http.auth,version=0.0.0 org.apache.http.auth.params,version=0.0.0 org.apache.http.client,version=0.0.0 org.apache.http.client.config,version=0.0.0 org.apache.http.client.entity,version=0.0.0 org.apache.http.client.methods,version=0.0.0 org.apache.http.client.params,version=0.0.0 org.apache.http.client.protocol,version=0.0.0 org.apache.http.client.utils,version=0.0.0 org.apache.http.conn,version=0.0.0 org.apache.http.conn.params,version=0.0.0 org.apache.http.conn.routing,version=0.0.0 org.apache.http.conn.scheme,version=0.0.0 org.apache.http.conn.socket,version=0.0.0 org.apache.http.conn.ssl,version=0.0.0 org.apache.http.conn.util,version=0.0.0 org.apache.http.cookie,version=0.0.0 org.apache.http.cookie.params,version=0.0.0 org.apache.http.impl.auth,version=0.0.0 org.apache.http.impl.client,version=0.0.0 org.apache.http.impl.conn,version=0.0.0 org.apache.http.impl.conn.tsccm,version=0.0.0 org.apache.http.impl.cookie,version=0.0.0 org.apache.http.impl.execchain,version=0.0.0 |
Imported Packages | None |
Manifest Headers | Bundle-ManifestVersion: 2 Bundle-Name: Http Bundle-RequiredExecutionEnvironment: JavaSE-1.7 Bundle-SymbolicName: client.http Bundle-Version: 1.0.0 Export-Package: org.apache.http.auth, org.apache.http.auth.params, org.apache.http.client, org.apache.http.client.config, org.apache.http.client.entity, org.apache.http.client.methods, org.apache.http.client.params, org.apache.http.client.protocol, org.apache.http.client.utils, org.apache.http.conn, org.apache.http.conn.params, org.apache.http.conn.routing, org.apache.http.conn.scheme, org.apache.http.conn.socket, org.apache.http.conn.ssl, org.apache.http.conn.util, org.apache.http.cookie, org.apache.http.cookie.params, org.apache.http.impl.auth, org.apache.http.impl.client, org.apache.http.impl.conn, org.apache.http.impl.conn.tsccm, org.apache.http.impl.cookie, org.apache.http.impl.execchain Manifest-Version: 1.0 |
but still I get
Symbolic Name | StoreLocator.StoreLocatorImpl-bundle |
Version | 1.0.0.SNAPSHOT |
Bundle Location | inputstream:StoreLocator-bundle-1.0-SNAPSHOT.jar |
Last Modification | Tue Oct 28 09:54:28 CAT 2014 |
Description | Maven Multimodule project for StoreLocator. |
Start Level | 20 |
Exported Packages | Objects,version=1.0.0.SNAPSHOT StoreLocator,version=1.0.0.SNAPSHOT |
Imported Packages | javax.json,version=[1.0,2) -- Cannot be resolved javax.json.stream,version=[1.0,2) -- Cannot be resolved org.apache.http from osgi.httpclient.apache (422) org.apache.http.client,version=[4.3,5) -- Cannot be resolved org.apache.http.client.methods,version=[4.3,5) -- Cannot be resolved org.apache.http.impl.client,version=[4.3,5) -- Cannot be resolved org.apache.http.util from osgi.httpclient.apache (422) org.apache.log4j from log4j.over.slf4j (3) org.slf4j,version=[1.5,2) from slf4j.api (14) |
Manifest Headers | Bnd-LastModified: 1414480016348 Build-Jdk: 1.7.0_60 Built-By: clive Bundle-Description: Maven Multimodule project for StoreLocator. Bundle-ManifestVersion: 2 Bundle-Name: StoreLocator Bundle Bundle-SymbolicName: StoreLocator.StoreLocatorImpl-bundle Bundle-Version: 1.0.0.SNAPSHOT Created-By: Apache Maven Bundle Plugin Export-Package: Objects; version="1.0.0.SNAPSHOT", StoreLocator; uses:="javax.json.stream, org.apache.log4j, javax.json, Objects, org.apache.http.client, org.slf4j, org.apache.http.impl.client, org.apache.http.client.methods, org.apache.http.util, org.apache.http"; version="1.0.0.SNAPSHOT" Import-Package: javax.json; version="[1.0, 2)", javax.json.stream; version="[1.0, 2)", org.apache.http, org.apache.http.client; version="[4.3, 5)", org.apache.http.client.methods; version="[4.3, 5)", org.apache.http.impl.client; version="[4.3, 5)", org.apache.http.util, org.apache.log4j, org.slf4j; version="[1.5, 2)" Manifest-Version: 1.0 Tool: Bnd-1.50.0 |
Of the bundles I imported only
org.apache.http from osgi.httpclient.apache
org.apache.http.util from osgi.httpclient.apache (422
are being recognized.
But why are the osgi.httpclient.apache export packages packages being seen by my bundlle and non of the others?
Views
Replies
Total Likes
If you are using these classes within bundle and these need not to be imported by any other bundle (You can still do this) then try this with dependency,
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
... Blah Blah ....
If there are import dependency within dependency then you can do something like
<Import-Package>!package with problem all comma separated,*</Import-Package>
Yogesh
Views
Replies
Total Likes