Connecting to kafka securely from AEM | Community
Skip to main content
Level 4
March 2, 2022

Connecting to kafka securely from AEM

  • March 2, 2022
  • 2 replies
  • 2453 views

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 ? 

 

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

2 replies

Nitin_laad
Community Advisor
Community Advisor
March 2, 2022

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

AEMnewbieAuthor
Level 4
March 4, 2022

@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)

 

joerghoh
Adobe Employee
Adobe Employee
March 4, 2022

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

AEMnewbieAuthor
Level 4
March 4, 2022

I did take a look at it @joerghoh . 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.

joerghoh
Adobe Employee
Adobe Employee
March 6, 2022

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