Hi All,
After upgrading AEM 6.5 to Service Pack 6.5.23, one of our bundles is showing multiple OSGi import errors under /system/console/bundles.
The affected bundle:
Project – Google Captcha (.......platform. Captcha)
In the bundle status, I see many packages marked in red:
Cannot be resolved but is not required
Imported Packages:
com.google.appengine.api.datastore -- Cannot be resolved but is not required
com.google.appengine.api.memcache -- Cannot be resolved but is not required
com.google.appengine.api.urlfetch -- Cannot be resolved but is not required
com.google.auth from ...platform.captcha (598)
com.google.protobuf.nano -- Cannot be resolved but is not required
com.jcraft.jzlib -- Cannot be resolved but is not required
com.ning.compress -- Cannot be resolved but is not required
com.ning.compress.lzf -- Cannot be resolved but is not required
com.ning.compress.lzf.util -- Cannot be resolved but is not required
com.oracle.svm.core.annotate -- Cannot be resolved but is not required
lzma.sdk -- Cannot be resolved but is not required
lzma.sdk.lzma -- Cannot be resolved but is not required
net.jpountz.lz4 -- Cannot be resolved but is not required
net.jpountz.xxhash -- Cannot be resolved but is not required
org.apache.avalon.framework.logger -- Cannot be resolved but is not required
org.apache.log -- Cannot be resolved but is not required
org.bouncycastle.asn1.x500 -- Cannot be resolved but is not required
org.bouncycastle.cert -- Cannot be resolved but is not required
org.bouncycastle.cert.jcajce -- Cannot be resolved but is not required
org.bouncycastle.jce.provider -- Cannot be resolved but is not required
org.bouncycastle.operator -- Cannot be resolved but is not required
org.bouncycastle.operator.jcajce -- Cannot be resolved but is not required
org.eclipse.jetty.alpn -- Cannot be resolved but is not required
org.eclipse.jetty.npn -- Cannot be resolved but is not required
reactor.blockhound -- Cannot be resolved but is not required
reactor.blockhound.integration -- Cannot be resolved but is not required
sun.misc -- Cannot be resolved but is not required and overwritten by Boot Delegation
sun.security.x509 -- Cannot be resolved but is not required and overwritten by Boot Delegation
Any help or recommended approach would be greatly appreciated.
Regards,
Nagendra
Views
Replies
Total Likes
The good news is that most of these are marked as "Cannot be resolved but is not required" - meaning they're optional dependencies that won't prevent your bundle from functioning. Check if your reCAPTCHA functionality is actually working despite these warnings, your bundle may be functioning perfectly fine... of course, test your CAPTCHA implementation to confirm.
Then you can modify your bundle's pom.xml to mark these imports as optional explicitly:
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<instructions>
<Import-Package>
com.google.appengine.api.datastore;resolution:=optional,
com.google.appengine.api.memcache;resolution:=optional,
com.google.appengine.api.urlfetch;resolution:=optional,
com.google.protobuf.nano;resolution:=optional,
*
</Import-Package>
<Embed-Dependency>
google-api-client,
google-http-client,
google-http-client-jackson2;
inline=true
</Embed-Dependency>
<Import-Package>
!com.google.appengine.*,
!com.google.protobuf.nano,
*
</Import-Package>
</instructions>
</configuration>
</plugin>The !com.google.appengine.* syntax explicitly excludes these packages from import requirements.
On the other hand, if during testing the reCAPTCHA functionality isn't working as expected and you need to embed any of those google packages you can have a look at here: maven-bundle-plugin or bnd-maven-plugin
Thanks for the prompt response!
After applying your suggestions, the warnings “Cannot be resolved but is not required” are no longer appearing - so that part is resolved.
However, the bundle is still stuck in the Installed state instead of Active.
In /system/console/bundles, click your Google Captcha bundle and check the Imported Packages section again; anything that shows just “Cannot be resolved” (without “but is not required”) is still blocking activation.Also check if any other bundles are in “Installed” or “Resolved” with unsatisfied imports (they may be the providers you expect for your Captcha bundle, for example a wrapped Google client or shared API bundle).
Maybe a library that used to be exported by another bundle is no longer present or has a different version after installing 6.5.23, so your bundle’s Import-Package range no longer matches.
For each remaining “Cannot be resolved” import, either:
Install a bundle that exports that package (for third‑party JARs, wrap or embed them as proper OSGi bundles), or
Relax/fix the version range or mark it as optional in your maven-bundle-plugin configuration if your code does not truly depend on it at runtime.
Hi @giuseppebaglio
Thanks for your response.
Based on your description and the project structure, it appears you have a separate Google Captcha bundle that's experiencing import issues after the AEM 6.5.23 upgrade. Here are the recommended solutions:
The most effective solution is to make the problematic imports optional in your bundle's
MANIFEST.MF
bnd
<plugin> <groupId>biz.aQute.bnd</groupId> <artifactId>bnd-maven-plugin</artifactId> <configuration> <bnd><![CDATA[ Import-Package: \ !com.google.appengine.*, \ !com.google.protobuf.nano, \ !com.jcraft.jzlib, \ !com.ning.compress.*, \ !com.oracle.svm.core.annotate, \ !lzma.sdk.*, \ !net.jpountz.*, \ !org.apache.avalon.framework.logger, \ !org.apache.log, \ !org.bouncycastle.*, \ !org.eclipse.jetty.*, \ !reactor.blockhound.*, \ com.google.auth;resolution:=optional, \ * ]]></bnd> </configuration> </plugin>
If you need some of these packages conditionally:
<bnd><![CDATA[ Import-Package: \ com.google.auth, \ * DynamicImport-Package: \ com.google.appengine.*, \ org.bouncycastle.*, \ org.eclipse.jetty.* ]]></bnd>
Verify your Google Auth library version is compatible with AEM 6.5.23:
<dependency> <groupId>com.google.auth</groupId> <artifactId>google-auth-library-oauth2-http</artifactId> <version>1.19.0</version> <!-- Use latest compatible version --> </dependency>
If certain dependencies are critical, embed them in your bundle:
<plugin> <groupId>biz.aQute.bnd</groupId> <artifactId>bnd-maven-plugin</artifactId> <configuration> <bnd><![CDATA[ Embed-Dependency: google-auth-library-oauth2-http Embed-Transitive: true Import-Package: !com.google.appengine.*, * ]]></bnd> </configuration> </plugin>
Check if bundle is actually working: Even with red imports, if they're optional, your captcha functionality might still work
Review bundle logs: Check
/system/console/slinglog
Test captcha functionality: Verify if the feature works despite the warnings
This typically happens because:
AEM 6.5.23 updated its OSGi framework
Some transitive dependencies from Google libraries expect packages not available in AEM
These are mostly optional dependencies for features not used in AEM context
The "Cannot be resolved but is not required" message indicates these are optional imports, so your bundle should still function correctly. The recommended approach is to explicitly exclude these optional packages in your bundle configuration.
Views
Replies
Total Likes
Views
Likes
Replies