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

How to use a different OSGI bundle for your imported package

Avatar

Avatar
Validate 10
Level 3
anjali_biddanda
Level 3

Likes

17 likes

Total Posts

69 posts

Correct Reply

6 solutions
Top badges earned
Validate 10
Validate 1
Give Back 5
Give Back 3
Give Back
View profile

Avatar
Validate 10
Level 3
anjali_biddanda
Level 3

Likes

17 likes

Total Posts

69 posts

Correct Reply

6 solutions
Top badges earned
Validate 10
Validate 1
Give Back 5
Give Back 3
Give Back
View profile
anjali_biddanda
Level 3

03-03-2020

AEM 6.5 has two OSGi bundles (A and B). 

A = org.apache.sling.scripting.jsp

B = org.apache.sling.scripting.jsp-api

 

My project bundle has a Java class that uses:

import javax.servlet.jsp.PageContext;  

 I want this imported package to use OSGI bundle A, not B.

 

In AEM 6.4, this was our imported packages list:

javax.servlet.jsp,version=2.1.0 from org.apache.sling.scripting.jsp (525)
javax.servlet.jsp.tagext,version=2.1.0 from org.apache.sling.scripting.jsp (525)

 

But in AEM 6.5, these imported packages are using OSGI bundle B, which is causing a Jasper script evaluation exception:

javax.servlet.jsp,version=2.1.0 from org.apache.sling.scripting.jsp-api (644)
javax.servlet.jsp.tagext,version=2.1.0 from org.apache.sling.scripting.jsp-api (644)

 

How can I make my imported class use the bundle I need it to? I tried explicitly adding the dependency to bundle A in the pom.xml, no luck there.

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,279 likes

Total Posts

3,155 posts

Correct Reply

889 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,279 likes

Total Posts

3,155 posts

Correct Reply

889 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile
Arun_Patidar
MVP

04-03-2020

Hi,

Did you try to import explicitly using Import-Package header

 

Import-Package: org.apache.sling.scripting.jsp;resolution:=optional,*

 

 

https://stackoverflow.com/questions/3094590/force-osgi-package-to-be-imported-by-maven-bundle-plugin...

 

Answers (0)