Expand my Community achievements bar.

Unable to resolve recaptcha enterprise bundle

Avatar

Level 2

I'm trying to import the following packages in my Captcha Service:

import com.google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClient;
import com.google.recaptchaenterprise.v1.Assessment;
import com.google.recaptchaenterprise.v1.CreateAssessmentRequest;
import com.google.recaptchaenterprise.v1.Event;
import com.google.recaptchaenterprise.v1.ProjectName;

 

Maven build is working fine. Here's my POM setup:

 

(parent pom.xml)

<build>
<plugins>
......
<plugin>
<!-- Builds the dependency as OSGi bundle -->
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Import-Package>*;resolution:=optional</Import-Package>
<Export-Package>
com.google.recaptchaenterprise.v1.*,
com.google.auth.*,
com.google.api.gax.*,
com.google.cloud.recaptchaenterprise.v1.*
</Export-Package>
<Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
<Embed-Transitive>true</Embed-Transitive>
</instructions>
</configuration>
</plugin>
<plugin>
<!-- Installs the build OSGi bundle into specified AEM instance's felix console -->
<groupId>org.apache.sling</groupId>
<artifactId>sling-maven-plugin</artifactId>
<executions>
<execution>
<id>install-bundle</id>
<goals>
<goal>install</goal>
</goals>
<configuration>
<slingUrl>http://${aem.host}:${aem.port}/system/console</slingUrl>
<refreshPackages>true</refreshPackages>
</configuration>
</execution>
</executions>
</plugin>
......
</plugins>
</build>

<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-recaptchaenterprise</artifactId>
<version>3.18.0</version>
</dependency>

 

(core/pom.xml)

<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-recaptchaenterprise</artifactId>
</dependency>

 

However, in my AEM console, I'm still unable to resolve the bundles:

com.google.cloud.recaptchaenterprise.v1 -- Cannot be resolved
com.google.common.collect,version=[15.0,16) from com.adobe.granite.osgi.wrapper.guava (118)
com.google.common.reflect,version=[15.0,16) from com.adobe.granite.osgi.wrapper.guava (118)
com.google.gson,version=[2.8,3) from com.google.gson (499)
com.google.gson.reflect,version=[2.8,3) from com.google.gson (499)
com.google.recaptchaenterprise.v1 -- Cannot be resolved

 

When I check the logs, I'm getting these errors:

 

12.09.2024 07:16:47.459 *ERROR* [FelixLogListener] Events.Framework.project-www.core FrameworkEvent ERROR (org.apache.felix.log.LogException: org.osgi.framework.BundleException: Unable to resolve project-www.core [606](R 606.248): missing requirement [project-www.core [606](R 606.248)] osgi.wiring.package; (osgi.wiring.package=com.google.cloud.recaptchaenterprise.v1) Unresolved requirements: [[project-www.core [606](R 606.248)] osgi.wiring.package; (osgi.wiring.package=com.google.cloud.recaptchaenterprise.v1)])
org.apache.felix.log.LogException: org.osgi.framework.BundleException: Unable to resolve project-www.core [606](R 606.248): missing requirement [project-www.core [606](R 606.248)] osgi.wiring.package; (osgi.wiring.package=com.google.cloud.recaptchaenterprise.v1) Unresolved requirements: [[project-www.core [606](R 606.248)] osgi.wiring.package; (osgi.wiring.package=com.google.cloud.recaptchaenterprise.v1)]
	at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4398)
	at org.apache.felix.framework.Felix.startBundle(Felix.java:2308)
	at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1566)
	at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:308)
	at java.base/java.lang.Thread.run(Thread.java:834)

 

 

In AEMaaCS:

 

2024-09-10 02:34:57.644 Analyser errors have been found 
2024-09-10 02:34:57.644 The analyser found the following errors for author and publish : 
2024-09-10 02:34:57.644 [api-regions-exportsimports] my.co.project:project-www.core:0.0.1-SNAPSHOT: Bundle project-www.core:0.0.1-SNAPSHOT is importing package(s) [com.google.cloud.recaptchaenterprise.v1, com.google.recaptchaenterprise.v1] in start level 20 but no bundle is exporting these for that start level. (my.co.project:project-www.ui.apps:0.0.1-SNAPSHOT)

 

 

 

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

6 Replies

Avatar

Community Advisor

Hi @daym4n71224838 
Could you plesae check if recaptcha bundle available in AEM(runtime)? If not then follow below to deploy recaptcha jar/bundle in AEM along with your core bundle

https://myaemlearnings.blogspot.com/2021/08/embedding-third-party-dependencyosgi.html 



Arun Patidar

Avatar

Level 2

@arunpatidar unfortunately, this didn't resolve my issue.

 

May I know how do I check if the recaptcha bundle is available in AEM at runtime?

 

Based on the article you linked, I have structured my core/pom.xml as follows:

<plugin>
<!-- Builds the dependency as OSGi bundle -->
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Import-Package>*;resolution:=optional</Import-Package>
<Export-Package>
com.google.recaptchaenterprise.v1.*;version=3.45.0,
com.google.cloud.recaptchaenterprise.v1;version=3.45.0.*
</Export-Package>
<Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
<Embed-Transitive>true</Embed-Transitive>
</instructions>
</configuration>
</plugin>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-recaptchaenterprise</artifactId>
</dependency>

 

Here's my parent pom.xml:

<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-recaptchaenterprise</artifactId>
<version>3.45.0</version>
<scope>provided</scope>
</dependency>

Avatar

Community Advisor

Hi @daym4n71224838 
You need to go to http://localhost:4502/system/console/depfinder and check the dependency for below

com.google.cloud.recaptchaenterprise.v1

 

If does not exists that means you need to install the recaptchaenterprise osgi bundle in AEM

 

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/maven-build-error-when-int... 



Arun Patidar

Avatar

Administrator

@daym4n71224838 Did you find the suggestions helpful? Please let us know if you require more information. Otherwise, please mark the answer as correct for posterity. If you've discovered a solution yourself, we would appreciate it if you could share it with the community. Thank you!



Kautuk Sahni

Avatar

Level 2

@arunpatidar @MukeshYadav_ @kautuk_sahni 

 

Unfortunately, I still haven't resolved the issue.

 

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/google-enterprise-captcha-...

In this link, I have followed the pom.xml exactly as it was posted.

 

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/importing-3rd-party-java-m...

This link provides more or less the same solution as the above but it's I'm still getting the issue.

 

https://myaemlearnings.blogspot.com/2021/08/embedding-third-party-dependencyosgi.html

This unfortunately also doesn't resolve my issue.

 

Please see my core/pom.xml below:

 

<build>
<plugins>
......
<plugin>
<!-- Builds the dependency as OSGi bundle -->
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Import-Package>*;resolution:=optional</Import-Package>
<Export-Package>
com.google.recaptchaenterprise.v1.*,
com.google.cloud.recaptchaenterprise.v1.*
</Export-Package>
<Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
<Embed-Transitive>true</Embed-Transitive>
</instructions>
</configuration>
</plugin>
......
</plugins>
</build>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-recaptchaenterprise</artifactId>
<version>3.45.0</version>
</dependency>