Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Connecting to kafka securely from AEM

Avatar

Level 4

I am trying to connect to kafka using 

props.put(CommonClientConfigs.SECURITY_PROTOCOL_CONFIG, "SASL_SSL");

props.put(SaslConfigs.SASL_MECHANISM, "PLAIN");

props.put(SaslConfigs.SASL_JAAS_CONFIG, "org.apache.kafka.common.security.plain.PlainLoginModule required   username=‘x’  password=‘x’;”);

 

When i am trying to run my project i see this in the logs

 

java.security.PrivilegedActionException: javax.security.auth.login.LoginException: java.lang.AssertionError: No bundle exists to create LoginModule from org.apache.kafka.common.security.plain.PlainLoginModule

at org.apache.felix.jaas.internal.BundleLoginModuleCreator.newInstance(BundleLoginModuleCreator.java:59)

at org.apache.felix.jaas.internal.ConfigLoginModuleProvider.createLoginModule(ConfigLoginModuleProvider.java:80)

at org.apache.felix.jaas.boot.ProxyLoginModule.initialize(ProxyLoginModule.java:46)

at sun.reflect.GeneratedMethodAccessor27.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:498)

at javax.security.auth.login.LoginContext.invoke(LoginContext.java:736)

at javax.security.auth.login.LoginContext.access$000(LoginContext.java:195)

at javax.security.auth.login.LoginContext$4.run(LoginContext.java:682)

at javax.security.auth.login.LoginContext$4.run(LoginContext.java:680)

at java.security.AccessController.doPrivileged(Native Method)

at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)

at javax.security.auth.login.LoginContext.logout(LoginContext.java:628)

at org.apache.jackrabbit.oak.core.ContentSessionImpl.close(ContentSessionImpl.java:114)

at org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.logout(SessionDelegate.java:401)

at org.apache.jackrabbit.oak.jcr.repository.RepositoryImpl$1.logout(RepositoryImpl.java:320)

at org.apache.jackrabbit.oak.jcr.session.SessionImpl$10.performVoid(SessionImpl.java:470)

at org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.performVoid(SessionDelegate.java:273)

at org.apache.jackrabbit.oak.jcr.session.SessionImpl.logout(SessionImpl.java:466)

at com.adobe.granite.repository.impl.CRX3SessionImpl.logout(CRX3SessionImpl.java:293)

at com.adobe.granite.repository.hc.impl.DefaultAccessUserProfileHealthCheck.execute(DefaultAccessUserProfileHealthCheck.java:107)

at com.adobe.granite.queries.impl.hc.QueryHealthCheckMetrics$LazyGauge.execute(QueryHealthCheckMetrics.java:266)

at com.adobe.granite.queries.impl.hc.QueryHealthCheckMetrics$LazyGauge.lambda$new$0(QueryHealthCheckMetrics.java:253)

at org.apache.sling.commons.scheduler.impl.QuartzJobExecutor.execute(QuartzJobExecutor.java:347)

at org.quartz.core.JobRunShell.run(JobRunShell.java:202)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)

at java.lang.Thread.run(Thread.java:748)

 

Do we know what could possibly be causing this error ? And how we could fix it ? 

 

 

9 Replies

Avatar

Community Advisor

Hi @AEMnewbie do you have required dependencies installed, at first place seems issue is related to missing dependencies

You should check into the below thread about missing Kafka dependency

Solved: Apache Kafka Integration with AEM - Adobe Experience League Community - 416704

Avatar

Level 4

@Nitin_laad I tried to follow the above the link . I tried to added this 

org.apache.kafka.common.security 

in the Export package section in the pom file . And it blew up my complete local instance . I see this when i tried to restart my local instance .

java.lang.StackOverflowError
	at java.security.AccessController.doPrivileged(Native Method)

 

Avatar

Employee Advisor

I did a small POC for a lightweight Kafka integration some years ago; you can find the code in https://github.com/joerghoh/kafka-integration

 

HTH

Avatar

Level 4

I did take a look at it @Jörg_Hoh . The only diff with my implementation is i am trying to connect to secure kafka using these

 

props.put(CommonClientConfigs.SECURITY_PROTOCOL_CONFIG, "SASL_SSL");

props.put(SaslConfigs.SASL_MECHANISM, "PLAIN");

props.put(SaslConfigs.SASL_JAAS_CONFIG, "org.apache.kafka.common.security.plain.PlainLoginModule required   username=‘x’  password=‘x’;”);

 

our current kafka implementation works fine when it is not secured. We recently changes kafka from unsecure to secure and with these new props it causing issues.

Avatar

Employee Advisor

Looks like your package comes with a login module, and these might be global and therefor interfere with the ootb login modules of AEM.

Avatar

Level 4

@Jörg_Hoh So does that mean we wouldnt be able to make the above implementation work in AEM ?

Avatar

Employee Advisor

I don't know. Probably just the way you want to implement does not work. I know of implementations of Kafka in AEM, so it must work somehow. Unfortunately I don't have details.

Avatar

Level 1

@AEMnewbie ..
Did you able to figure this out ? I am having the similar issue.

Avatar

Level 1

Were you able to figure this out ? I am also facing the same issue.