Expand my Community achievements bar.

SOLVED

Google enterprise captcha integration

Avatar

Level 2

hi there..Hope everyone is sound and safe !! . I am trying to integrate google enterprise libraries in my code. I tried adding in pom like this:

 

 

<dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>com.google.cloud</groupId>
      <artifactId>libraries-bom</artifactId>
      <version>20.8.0</version>
      <type>pom</type>
      <scope>import</scope>
    </dependency>
  </dependencies>
</dependencyManagement>

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

 

 

But the bundle remains in installed state. Here is the error:

 

 

21.07.2021 19:06:21.047 *ERROR* [qtp1013065474-2273] org.apache.felix.http.jetty %bundles.pluginTitle: Cannot start (org.osgi.framework.BundleException: Unable to resolve com.sample.poc [627](R 627.1): missing requirement [com.sample.poc [627](R 627.1)] osgi.wiring.package; (&(osgi.wiring.package=javax.annotation)(version>=1.3.0)(!(version>=2.0.0))) Unresolved requirements: [[com.sample.poc [627](R 627.1)] osgi.wiring.package; (&(osgi.wiring.package=javax.annotation)(version>=1.3.0)(!(version>=2.0.0)))])
org.osgi.framework.BundleException: Unable to resolve com.sample.poc [627](R 627.1): missing requirement [com.sample.poc [627](R 627.1)] osgi.wiring.package; (&(osgi.wiring.package=javax.annotation)(version>=1.3.0)(!(version>=2.0.0))) Unresolved requirements: [[com.sample.poc [627](R 627.1)] osgi.wiring.package; (&(osgi.wiring.package=javax.annotation)(version>=1.3.0)(!(version>=2.0.0)))]
	at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4149)

 

 

Then i tried installing javax.annotation bundle version 1.3.2 in the osgi console. But then I am getting this error this error:

21.07.2021 19:09:37.026 *ERROR* [qtp1013065474-2273] org.apache.felix.http.jetty %bundles.pluginTitle: Cannot start (org.osgi.framework.BundleException: Uses constraint violation. Unable to resolve resource com.sample.poc [com.sample.poc [627](R 627.1)] because it is exposed to package 'javax.annotation' from resources javax.annotation-api [javax.annotation-api [628](R 628.0)] and org.apache.felix.framework [org.apache.felix.framework [0](R 0)] via two dependency chains.

Chain 1:
  com.sample.poc [com.sample.poc [627](R 627.1)]
    import: (&(osgi.wiring.package=javax.annotation)(version>=1.3.0)(!(version>=2.0.0)))
     |
    export: osgi.wiring.package: javax.annotation
  javax.annotation-api [javax.annotation-api [628](R 628.0)]

Chain 2:
  com.sample.poc [com.sample.poc [627](R 627.1)]
    import: (&(osgi.wiring.package=com.adobe.acs.commons.genericlists)(version>=1.0.0)(!(version>=2.0.0)))
     |
    export: osgi.wiring.package=com.adobe.acs.commons.genericlists; uses:=javax.annotation
  com.adobe.acs.acs-aem-commons-bundle [com.adobe.acs.acs-aem-commons-bundle [624](R 624.0)]
    import: (osgi.wiring.package=javax.annotation)
     |
    export: osgi.wiring.package: javax.annotation
  org.apache.felix.framework [org.apache.felix.framework [0](R 0)] Unresolved requirements: [[com.sample.poc [627](R 627.1)] osgi.wiring.package; (&(osgi.wiring.package=com.adobe.acs.commons.genericlists)(version>=1.0.0)(!(version>=2.0.0)))])
org.osgi.framework.BundleException: Uses constraint violation. Unable to resolve resource com.sample.poc [com.sample.poc [627](R 627.1)] because it is exposed to package 'javax.annotation' from resources javax.annotation-api [javax.annotation-api [628](R 628.0)] and org.apache.felix.framework [org.apache.felix.framework [0](R 0)] via two dependency chains.

Chain 1:
  com.sample.poc [com.sample.poc [627](R 627.1)]
    import: (&(osgi.wiring.package=javax.annotation)(version>=1.3.0)(!(version>=2.0.0)))
     |
    export: osgi.wiring.package: javax.annotation
  javax.annotation-api [javax.annotation-api [628](R 628.0)]

Chain 2:
  com.sample.poc [com.sample.poc [627](R 627.1)]
    import: (&(osgi.wiring.package=com.adobe.acs.commons.genericlists)(version>=1.0.0)(!(version>=2.0.0)))
     |
    export: osgi.wiring.package=com.adobe.acs.commons.genericlists; uses:=javax.annotation
  com.adobe.acs.acs-aem-commons-bundle [com.adobe.acs.acs-aem-commons-bundle [624](R 624.0)]
    import: (osgi.wiring.package=javax.annotation)
     |
    export: osgi.wiring.package: javax.annotation
  org.apache.felix.framework [org.apache.felix.framework [0](R 0)] Unresolved requirements: [[com.sample.poc [627](R 627.1)] osgi.wiring.package; (&(osgi.wiring.package=com.adobe.acs.commons.genericlists)(version>=1.0.0)(!(version>=2.0.0)))]
	at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4149)

i tried adding adding dependencies in embed-dependencies also ,tried <import-package> and <export-package> options also. But still the bundle remains in installed state. Also tried osgification of recaptcha jar but still the issue remains.

Please let me know what I am missing here and let me know the correct steps if someone has.

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @harishk_Myst,

Use this pom.xml to build google recaptcha dependency as OSGi bundle - Use command mvn package install

This would build the dependency as OSGi bundle using maven-bundle-plugin and install to felix console via sling-maven-plugin (update the instance details accordingly in properties)

 

We are explicitly mentioning what needs to be exported from Google recaptcha dependency in Export-Package entry instead of "*" (using * would result in dependency chain issue like the one you have posted in the query as it will export everything which when deployed in AEM instance might clash with bundles that are available OOTB)

Based on the code you have written making use of Google recaptcha, make sure to include those package family in Export-Package list. (If there is anything that is apart from the ones that I have mentioned)

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>com.aem.demoproject</groupId>
  <artifactId>thirdparty</artifactId>
  <version>0.0.1</version>
  <packaging>bundle</packaging>

  <name>Demo Project Third party Dependency</name>
  <url>http://maven.apache.org</url>
  <description>Demo Project Third party Dependency as OSGI bundle using maven-bundle-plugin</description>

  <properties>
    <aem.host>localhost</aem.host>
	<aem.port>4502</aem.port>
    <sling.user>admin</sling.user>
	<sling.password>admin</sling.password>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>  

  <dependencies>    
    <!-- Google Recaptcha -->
    <dependency>
        <groupId>com.google.cloud</groupId>
        <artifactId>google-cloud-recaptchaenterprise</artifactId>
        <version>1.0.10</version> <!-- Use the desired version -->
	</dependency>    
  </dependencies>
  
  <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>
</project>

 

View solution in original post

11 Replies

Avatar

Correct answer by
Community Advisor

Hi @harishk_Myst,

Use this pom.xml to build google recaptcha dependency as OSGi bundle - Use command mvn package install

This would build the dependency as OSGi bundle using maven-bundle-plugin and install to felix console via sling-maven-plugin (update the instance details accordingly in properties)

 

We are explicitly mentioning what needs to be exported from Google recaptcha dependency in Export-Package entry instead of "*" (using * would result in dependency chain issue like the one you have posted in the query as it will export everything which when deployed in AEM instance might clash with bundles that are available OOTB)

Based on the code you have written making use of Google recaptcha, make sure to include those package family in Export-Package list. (If there is anything that is apart from the ones that I have mentioned)

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>com.aem.demoproject</groupId>
  <artifactId>thirdparty</artifactId>
  <version>0.0.1</version>
  <packaging>bundle</packaging>

  <name>Demo Project Third party Dependency</name>
  <url>http://maven.apache.org</url>
  <description>Demo Project Third party Dependency as OSGI bundle using maven-bundle-plugin</description>

  <properties>
    <aem.host>localhost</aem.host>
	<aem.port>4502</aem.port>
    <sling.user>admin</sling.user>
	<sling.password>admin</sling.password>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>  

  <dependencies>    
    <!-- Google Recaptcha -->
    <dependency>
        <groupId>com.google.cloud</groupId>
        <artifactId>google-cloud-recaptchaenterprise</artifactId>
        <version>1.0.10</version> <!-- Use the desired version -->
	</dependency>    
  </dependencies>
  
  <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>
</project>

 

Avatar

Level 2
Hi @Vijayalakshmi_S .. I had already tried this this gave me more chain of errors like; osgi.wiring.package; (osgi.wiring.package=com.google.protobuf.nano) Unresolved requirements: [[com.sample.poc [658](R 658.11)] osgi.wiring.package; (osgi.wiring.package=com.google.protobuf.nano)]

Avatar

Community Advisor

Hi @harishk_Myst,

Can you share the latest pom.xml that you are using (In particular maven-bundle-plugin definition completely) and complete log messages (While taking log, clear existing entries in log file before deployment to instance -> Deploy -> capture the error details) 

Avatar

Level 2

hi @Vijayalakshmi_S : Here is the POM:

 

		<plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <configuration>
                    <instructions>
                        <Import-Package>*</Import-Package>
                        <Export-Package>
                            com.sample.poc.*,
                            com.google.recaptchaenterprise.v1.*,
                       		com.google.auth.*, 
                        	com.google.api.gax.*,
                        	com.google.cloud.recaptchaenterprise.v1.*
                        </Export-Package>
                        <Include-Resource>{maven-resources}</Include-Resource>
                        <Sling-Model-Packages>
                            com.digitaslbi.helios.web.model
                        </Sling-Model-Packages>
                        <Embed-Dependency>restfb,*;scope=compile|runtime</Embed-Dependency>
                        <Embed-Transitive>true</Embed-Transitive>
                    </instructions>
                </configuration>
            </plugin>

 

 

And here is the log: 

 

24.07.2021 13:40:09.698 *ERROR* [qtp197707477-22184] org.apache.felix.http.jetty %bundles.pluginTitle: Cannot start (org.osgi.framework.BundleException: Unable to resolve com.sample.poc [658](R 658.17): missing requirement [com.sample.poc [658](R 658.17)] osgi.wiring.package; (osgi.wiring.package=com.google.protobuf.nano) Unresolved requirements: [[com.sample.poc [658](R 658.17)] osgi.wiring.package; (osgi.wiring.package=com.google.protobuf.nano)])
org.osgi.framework.BundleException: Unable to resolve com.sample.poc [658](R 658.17): missing requirement [com.sample.poc [658](R 658.17)] osgi.wiring.package; (osgi.wiring.package=com.google.protobuf.nano) Unresolved requirements: [[com.sample.poc [658](R 658.17)] osgi.wiring.package; (osgi.wiring.package=com.google.protobuf.nano)]
	at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4149)
	at org.apache.felix.framework.Felix.startBundle(Felix.java:2119)
	at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:998)
	at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:984)
	at org.apache.felix.webconsole.internal.core.BundlesServlet.doPost(BundlesServlet.java:359) [org.apache.felix.webconsole:4.3.12]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:644) [org.apache.felix.http.servlet-api:1.1.2]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:725) [org.apache.felix.http.servlet-api:1.1.2]
	at org.apache.felix.webconsole.internal.servlet.OsgiManager.service(OsgiManager.java:563) [org.apache.felix.webconsole:4.3.12]
	at org.apache.felix.webconsole.internal.servlet.OsgiManager$3.run(OsgiManager.java:465) [org.apache.felix.webconsole:4.3.12]
	at java.security.AccessController.doPrivileged(Native Method)
	at org.apache.felix.webconsole.internal.servlet.OsgiManager.service(OsgiManager.java:461) [org.apache.felix.webconsole:4.3.12]
	at org.apache.felix.http.base.internal.handler.ServletHandler.handle(ServletHandler.java:120) [org.apache.felix.http.jetty:4.0.6]
	at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:86) [org.apache.felix.http.jetty:4.0.6]
	at org.apache.sling.security.impl.ReferrerFilter.doFilter(ReferrerFilter.java:328) [org.apache.sling.security:1.1.12]
	at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:135) [org.apache.felix.http.jetty:4.0.6]
	at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:81) [org.apache.felix.http.jetty:4.0.6]
	at com.adobe.granite.license.impl.LicenseCheckFilter.doFilter(LicenseCheckFilter.java:308) [com.adobe.granite.license:1.2.6.CQ640-B0001]
	at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:135) [org.apache.felix.http.jetty:4.0.6]
	at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:81) [org.apache.felix.http.jetty:4.0.6]
	at org.apache.felix.http.sslfilter.internal.SslFilter.doFilter(SslFilter.java:96) [org.apache.felix.http.sslfilter:1.2.4]
	at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:135) [org.apache.felix.http.jetty:4.0.6]
	at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:81) [org.apache.felix.http.jetty:4.0.6]
	at org.apache.sling.i18n.impl.I18NFilter.doFilter(I18NFilter.java:131) [org.apache.sling.i18n:2.5.14]
	at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:135) [org.apache.felix.http.jetty:4.0.6]
	at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:81) [org.apache.felix.http.jetty:4.0.6]
	at org.apache.felix.http.base.internal.dispatch.Dispatcher$1.doFilter(Dispatcher.java:146) [org.apache.felix.http.jetty:4.0.6]
	at org.apache.felix.http.base.internal.whiteboard.WhiteboardManager.invokePreprocessors(WhiteboardManager.java:1000) [org.apache.felix.http.jetty:4.0.6]
	at org.apache.felix.http.base.internal.dispatch.Dispatcher.dispatch(Dispatcher.java:91) [org.apache.felix.http.jetty:4.0.6]
	at org.apache.felix.http.base.internal.dispatch.DispatcherServlet.service(DispatcherServlet.java:49) [org.apache.felix.http.jetty:4.0.6]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:725) [org.apache.felix.http.servlet-api:1.1.2]
	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:865) [org.apache.felix.http.jetty:4.0.6]
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:535) [org.apache.felix.http.jetty:4.0.6]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255) [org.apache.felix.http.jetty:4.0.6]
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1595) [org.apache.felix.http.jetty:4.0.6]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255) [org.apache.felix.http.jetty:4.0.6]
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1340) [org.apache.felix.http.jetty:4.0.6]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203) [org.apache.felix.http.jetty:4.0.6]
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473) [org.apache.felix.http.jetty:4.0.6]
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1564) [org.apache.felix.http.jetty:4.0.6]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201) [org.apache.felix.http.jetty:4.0.6]
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1242) [org.apache.felix.http.jetty:4.0.6]
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144) [org.apache.felix.http.jetty:4.0.6]
	at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:220) [org.apache.felix.http.jetty:4.0.6]
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) [org.apache.felix.http.jetty:4.0.6]
	at org.eclipse.jetty.server.Server.handle(Server.java:503) [org.apache.felix.http.jetty:4.0.6]
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:364) [org.apache.felix.http.jetty:4.0.6]
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:260) [org.apache.felix.http.jetty:4.0.6]
	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:305) [org.apache.felix.http.jetty:4.0.6]
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103) [org.apache.felix.http.jetty:4.0.6]
	at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118) [org.apache.felix.http.jetty:4.0.6]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333) [org.apache.felix.http.jetty:4.0.6]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310) [org.apache.felix.http.jetty:4.0.6]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168) [org.apache.felix.http.jetty:4.0.6]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:126) [org.apache.felix.http.jetty:4.0.6]
	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:366) [org.apache.felix.http.jetty:4.0.6]
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:765) [org.apache.felix.http.jetty:4.0.6]
	at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:683) [org.apache.felix.http.jetty:4.0.6]
	at java.lang.Thread.run(Thread.java:748)

 

 

Using "*;resolution:=optional" in <import-package> resolves the bundle but it is leading to run time errors like below. But using only "*" doesnot giving any errors

 

Caused by: org.apache.sling.api.SlingException: javax.servlet.ServletException: java.lang.LinkageError: loader constraint violation: when resolving interface method "com.sample.poc.api.library.JCRService.getChildNodesByProperty(Ljavax/jcr/Node;Ljava/lang/String;Ljava/lang/String;)Ljavaslang/collection/List;" the class loader (instance of org/apache/felix/framework/BundleWiringImpl$BundleClassLoader) of the current class, com/sample/poc/impl/form/FormBuilderServiceImpl, and the class loader (instance of org/apache/felix/framework/BundleWiringImpl$BundleClassLoader) for the method's defining class, com/sample/poc/admin/impl/form/api/library/JCRService, have different Class objects for the type javaslang/collection/List used in the signature
at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.handleJspExceptionInternal(JspServletWrapper.java:672) [org.apache.sling.scripting.jsp:2.2.7.B002]
at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:608) [org.apache.sling.scripting.jsp:2.2.7.B002]
at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:525) [org.apache.sling.scripting.jsp:2.2.7.B002]
at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:449) [org.apache.sling.scripting.jsp:2.2.7.B002]
at org.apache.sling.scripting.jsp.JspScriptEngineFactory.callJsp(JspScriptEngineFactory.java:346) [org.apache.sling.scripting.jsp:2.2.7.B002]
at org.apache.sling.scripting.jsp.JspScriptEngineFactory.access$100(JspScriptEngineFactory.java:101) [org.apache.sling.scripting.jsp:2.2.7.B002]
at org.apache.sling.scripting.jsp.JspScriptEngineFactory$JspScriptEngine.eval(JspScriptEngineFactory.java:607) [org.apache.sling.scripting.jsp:2.2.7.B002]
at org.apache.sling.scripting.core.impl.DefaultSlingScript.call(DefaultSlingScript.java:388) [org.apache.sling.scripting.core:2.0.54]
at org.apache.sling.scripting.core.impl.DefaultSlingScript.eval(DefaultSlingScript.java:184) [org.apache.sling.scripting.core:2.0.54]
at org.apache.sling.scripting.core.impl.DefaultSlingScript.service(DefaultSlingScript.java:491) [org.apache.sling.scripting.core:2.0.54]
at org.apache.sling.engine.impl.request.RequestData.service(RequestData.java:552) [org.apache.sling.engine:2.6.16]
at org.apache.sling.engine.impl.filter.SlingComponentFilterChain.render(SlingComponentFilterChain.java:44) [org.apache.sling.engine:2.6.16]
at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:82) [org.apache.sling.engine:2.6.16]
at com.day.cq.wcm.core.impl.WCMDeveloperModeFilter.doFilter(WCMDeveloperModeFilter.java:119) [com.day.cq.wcm.cq-wcm-core:5.11.276]
at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:72) [org.apache.sling.engine:2.6.16]
at com.day.cq.wcm.core.impl.WCMDebugFilter.doFilterWithErrorHandling(WCMDebugFilter.java:192) [com.day.cq.wcm.cq-wcm-core:5.11.276]
at com.day.cq.wcm.core.impl.WCMDebugFilter.doFilter(WCMDebugFilter.java:159) [com.day.cq.wcm.cq-wcm-core:5.11.276]
at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:72) [org.apache.sling.engine:2.6.16]
at org.apache.sling.dynamicinclude.IncludeTagFilter.doFilter(IncludeTagFilter.java:71) [org.apache.sling.dynamic-include:3.0.0]
at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:72) [org.apache.sling.engine:2.6.16]
at com.day.cq.wcm.core.impl.WCMComponentFilter.doFilter(WCMComponentFilter.java:278) [com.day.cq.wcm.cq-wcm-core:5.11.276]
at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:72) [org.apache.sling.engine:2.6.16]
at com.day.cq.wcm.core.impl.PageLockFilter.doFilter(PageLockFilter.java:91) [com.day.cq.wcm.cq-wcm-core:5.11.276]
at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:72) [org.apache.sling.engine:2.6.16]
at com.day.cq.personalization.impl.TargetComponentFilter.doFilter(TargetComponentFilter.java:96) [com.day.cq.cq-personalization:5.11.66]
at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:72) [org.apache.sling.engine:2.6.16]
at com.adobe.granite.csrf.impl.CSRFFilter.doFilter(CSRFFilter.java:217) [com.adobe.granite.csrf:1.0.18.CQ640-B0004]
at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:72) [org.apache.sling.engine:2.6.16]
at org.apache.sling.engine.impl.SlingRequestProcessorImpl.processComponent(SlingRequestProcessorImpl.java:282) [org.apache.sling.engine:2.6.16]
at org.apache.sling.engine.impl.SlingRequestProcessorImpl.dispatchRequest(SlingRequestProcessorImpl.java:322) [org.apache.sling.engine:2.6.16]
at org.apache.sling.engine.impl.request.SlingRequestDispatcher.dispatch(SlingRequestDispatcher.java:211) [org.apache.sling.engine:2.6.16]
at org.apache.sling.engine.impl.request.SlingRequestDispatcher.include(SlingRequestDispatcher.java:104) [org.apache.sling.engine:2.6.16]
at com.day.cq.wcm.core.impl.WCMComponentFilter$ForwardRequestDispatcher.include(WCMComponentFilter.java:516) [com.day.cq.wcm.cq-wcm-core:5.11.276]
at org.apache.sling.scripting.jsp.taglib.IncludeTagHandler.dispatch(IncludeTagHandler.java:54) [org.apache.sling.scripting.jsp.taglib:2.2.6]
at org.apache.sling.scripting.jsp.taglib.AbstractDispatcherTagHandler.doEndTag(AbstractDispatcherTagHandler.java:129) [org.apache.sling.scripting.jsp.taglib:2.2.6]
at org.apache.jsp.libs.foundation.components.parsys.parsys_jsp._jspService(parsys_jsp.java:325)
at org.apache.sling.scripting.jsp.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) [org.apache.sling.scripting.jsp:2.2.7.B002]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:725) [org.apache.felix.http.servlet-api:1.1.2]
at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:502) [org.apache.sling.scripting.jsp:2.2.7.B002]

 

 

Avatar

Community Advisor

@harishk_Myst,

Can you amend the plugin as below

  • Export-Package entry -
    • Add this - "com.google.protobuf.nano"  and remove "com.sample.poc.*" 
    • The packages from google recaptchaenterprise dependency which are not resolved, you keep adding that alone in Export-Packages list. (By simply using * here would resolve the bundle but at times based on what we have in our AEM instance + dependency we are using, there exist a chance of dependency clash. Hence the need for adding the required/unresolved ones explicitly)
  • Include-Resource is not needed explicitly (That too when you are using {maven-resources} which will be included by default)

Avatar

Level 1

Is this issue resolved , i am still getting issues in bundle after including all the above details in POM.

The import packages error keeps on increasing.

Avatar

Level 2

Hello @mukesh4 

yes, the issue is resolved for me.

 

I added the below configuration to resolve the bundle resolution issue.

For the bundle plugin configuration, i have exported following packages

 

com.google.cloud.recaptchaenterprise.v1.*,
com.google.recaptchaenterprise.v1.*

Avatar

Level 2

Hi @nitish-jain@Vijayalakshmi_S 

We tried to export the packages mentioned by you in our POM, but we still see the bundle in installed state.

 

Moreover the version picked for google api's is showing same as our project version.

Can you please let us know if there was a need to install the google api's as a separate bundle in AEM or it was all done via POM in your case.

 

Also, can you please help us in sharing the exact pom.xml changes you made for making the enterprise recaptcha work.

Please note we are not using maven-bundle-plugin for importing and exporting packages but use maven-bundle-plugin.

Avatar

Community Advisor

@pawan_g_007 

Could you please share your core/pom.xml file and packages of Googla recaptcha you are using in your code (complete list of classes used in respective code)

Avatar

Level 1

HI @Vijayalakshmi_S @nitish-jain 

we are getting below error while implementing the enterprise recaptcha.

we have added all the pom related exports as mentioned above

And we are using the code snippet as mentioned in the https://cloud.google.com/recaptcha-enterprise/docs/create-assessment#java:~:text=import%20com.google...

But still getting the below issue.

The Application Default Credentials are not available. They are available if running in Google Compute Engine. Otherwise, the environment variable GOOGLE_APPLICATION_CREDENTIALS must be defined pointing to a file defining the credentials. See https://developers.google.com/accounts/docs/application-default-credentials for more information.