How to use a different OSGI bundle for your imported package

anjali_biddanda

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)

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)