程序发布到websphere报错,java.lang.IllegalArgumentException: Could not find a 'KafkaClient' entry in the JAAS configuration.

Logan 发表于: 2020-11-05   最后更新时间: 2020-11-05  

kafka版本:1.1.0

错误提示:

[ERROR] 2020-11-05 16:46:01,431 method:org.quartz.core.JobRunShell.run(JobRunShell.java:216)
Job DEFAULT.DataToDMSJob_process threw an unhandled Exception: 
org.springframework.scheduling.quartz.JobMethodInvocationFailedException: Invocation of method 'sendAcceptMessageToDMS' on target class [class org.e3.job.gdbj.DataToDMSJob] failed; nested exception is org.apache.kafka.common.KafkaException: Failed to construct kafka producer
    at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal(MethodInvokingJobDetailFactoryBean.java:266)
    at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:75)
    at org.quartz.core.JobRunShell.run(JobRunShell.java:207)
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:560)
Caused by: org.apache.kafka.common.KafkaException: Failed to construct kafka producer
    at org.apache.kafka.clients.producer.KafkaProducer.<init>(KafkaProducer.java:456)
    at org.apache.kafka.clients.producer.KafkaProducer.<init>(KafkaProducer.java:303)
    at org.e3.job.gdbj.ProduceMessage.produceMessage(ProduceMessage.java:36)
    at org.e3.job.gdbj.DataToDMSJob.sendAcceptMessageToDMS(DataToDMSJob.java:85)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:88)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
    at java.lang.reflect.Method.invoke(Method.java:613)
    at org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:269)
    at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal(MethodInvokingJobDetailFactoryBean.java:257)
    ... 3 more
Caused by: java.lang.IllegalArgumentException: Could not find a 'KafkaClient' entry in the JAAS configuration. System property 'java.security.auth.login.config' is /C:/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/vmhost211Cell01/包名_war.ear/包名.war/WEB-INF/classes/dms_kafka_client_jaas.conf
    at org.apache.kafka.common.security.JaasContext.defaultContext(JaasContext.java:133)
    at org.apache.kafka.common.security.JaasContext.load(JaasContext.java:98)
    at org.apache.kafka.common.security.JaasContext.loadClientContext(JaasContext.java:84)
    at org.apache.kafka.common.network.ChannelBuilders.create(ChannelBuilders.java:119)
    at org.apache.kafka.common.network.ChannelBuilders.clientChannelBuilder(ChannelBuilders.java:65)
    at org.apache.kafka.clients.ClientUtils.createChannelBuilder(ClientUtils.java:88)
    at org.apache.kafka.clients.producer.KafkaProducer.<init>(KafkaProducer.java:413)
    ... 12 more


您需要解锁本帖隐藏内容请: 点击这里
本帖隐藏的内容




上一条: 如何查看 kafka 生产者是否正常?
下一条: 第一次接触kafka,根据用例,有时候消费得到数据,并且消费到的数据offset为:900-1000,902-1002;之后的数据或之前的数据就消费不到了

  • 问题解决了,是要在websphere控制台配置JVM参数。

    Caused by: java.lang.IllegalArgumentException: Could not find a 'KafkaClient' entry in the JAAS configuration. System property 'java.security.auth.login.config' is /C:/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/vmhost211Cell01/包名_war.ear/包名.war/WEB-INF/classes/dms_kafka_client_jaas.conf
    

    找不到这个文件

    • 这个文件在项目运行后解压的文件夹下是有的哦,看到网上的有说是要配置JVM参数,将这个路径配置上去,类似这样的-Djava.security.auth.login.config = /C:/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/vmhost211Cell01/Dms_war.ear/Dms.war/WEB-INF/classes/dms_kafka_client_jaas.conf。是否可能因为配置不对