Expand my Community achievements bar.

July 31st AEM Gems Webinar: Elevate your AEM development to master the integration of private GitHub repositories within AEM Cloud Manager.
SOLVED

How to use a different OSGI bundle for your imported package

Avatar

Level 4

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.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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...

 



Arun Patidar

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

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...

 



Arun Patidar

Avatar

Level 4
Thanks Arun, I gave that a try. It didn't help. javax.servlet.jsp is still using org.apache.sling.scripting.jsp-api.