include 3rd party dependencies within OSGI bundle | Community
Skip to main content
New Participant
October 16, 2015
Solved

include 3rd party dependencies within OSGI bundle

  • October 16, 2015
  • 18 replies
  • 9792 views

What is the best approach to deploy 3rd party dependencies to AEM OSGI / Felix via Maven build of OSGI bundle?

My team has a requirement to build an OSGI Servlet.  It will use dependency org.apache.oltu.oauth2.client that does not exist in CQ.

I have a pom to build the servlet now and it references the 3rd party dependency.  But when I deploy to AEM OSGI, I see this:

Imported Packages.......
org.apache.oltu.oauth2.client,version=[1.0,2) -- Cannot be resolved

What is the best way / recommend approach to resolve this issue ?  I think we need to package 3rd party dependencies within the OSGI bundle for our servlet?  If yes, how do we specify this in maven POM ?

Thanks in advance for helpful replies.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by deisbel_diaz

Hi:

finally we figure out what is the real problem: the wrapped bundle generated by the Eclipse plugin

If you see the first wrapped bundle you can note that despite the bundle number is correctly registered as 1.0.1 all its Exported Packages are registered with version=0.0.0. Looks like the real dependencies resolver in AEM uses these version numbers instead of the general bundle's version number. 

So, the solution is to edit the manifest of the library to be wrapped and exported to assign the correct version number to each Exported Package. 

After that your are able to export it correctly, and install it manually in AEM/Apache Felix console. 

Hereinafter your main bundle will be installed without problems of dependencies.

18 replies

deisbel_diaz
deisbel_diazAccepted solution
New Participant
April 8, 2016

Hi:

finally we figure out what is the real problem: the wrapped bundle generated by the Eclipse plugin

If you see the first wrapped bundle you can note that despite the bundle number is correctly registered as 1.0.1 all its Exported Packages are registered with version=0.0.0. Looks like the real dependencies resolver in AEM uses these version numbers instead of the general bundle's version number. 

So, the solution is to edit the manifest of the library to be wrapped and exported to assign the correct version number to each Exported Package. 

After that your are able to export it correctly, and install it manually in AEM/Apache Felix console. 

Hereinafter your main bundle will be installed without problems of dependencies.

smacdonald2008
New Participant
April 8, 2016

Just to follow up for community reading this thread - i got bundle into an active state. 

smacdonald2008
New Participant
April 7, 2016

Can you email me your main OSGi bundle. I would need to see it to further help you. I suspect its a version issue. I sent you an email already. 

deisbel_diaz
New Participant
April 7, 2016

Here you can see my wrapped bundle running.

smacdonald2008
New Participant
April 7, 2016

You asked a question on a closed thread. I answered it to help you. 

In future - you should open a new question - not ask a question on a thread that is green.  You will get more responses. 

And the answer is correct - it points to the article that talks about How TO wrap 3rd party JAR files into OSGi bundles. 

If you need more help - we can setup connect sessions and I can show you exactly how this works. 

smacdonald2008
New Participant
April 7, 2016

You asked a question on a closed thread. I answered it to help you. 

In future - you should open a new question - not ask a question on a thread that is green.  You will get more responses. 

And the answer is correct - it points to the article that talks about How TO wrap 3rd party JAR files into OSGi bundles. 

If you need more help - we can setup connect sessions and I can show you exactly how this works. 

deisbel_diaz
New Participant
April 7, 2016

Hi smacdonald2008:

Let me tell you that I really appreciate your labor here. At least you spend time trying to help the community. My bad comments are not personals, Ok?.

I already wrapped the original library in an OSGI Bundle. If you read my post with attention you can read that I have the wrapped bundle running/active in the Apache Felix console right now. 

Also, I verified the dependency using this: http://localhost:4502/system/console/depfinder

I put that dependency in my maven pom.xml, BUT I'M STILL RECEIVING THE ORIGINAL "org.apache.oltu.oauth2.client,version=[1.0,2) -- Cannot be resolved"

I've removed all the bundles, published them again, restarted the services, my PC, everything!!.

smacdonald2008
New Participant
April 7, 2016

Actually - you can download an OSGi bunlde from the main site: 

http://mvnrepository.com/artifact/org.apache.oltu.oauth2/org.apache.oltu.oauth2.client/1.0.1

Then you can deploy that to AEM: 

Once this is done - you can see that org.apache.oltu.oauth2.client resolves in AEM Dependency Finder: 

http://localhost:4502/system/console/depfinder

deisbel_diaz
New Participant
April 7, 2016

How can you mark as resolved a post when it is not solved?

Does Adobe has a profesional customer support?

deisbel_diaz
New Participant
April 7, 2016

How can you mark as resolved a post when it is not solved?

Does Adobe has a profesional customer support?