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

Logan 发表于: 2020-11-05   最后更新时间: 2020-11-05 18:46:39   3,587 游览

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
发表于 2020-11-05
添加评论
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

找不到这个文件

Logan -> 半兽人 4年前

这个文件在项目运行后解压的文件夹下是有的哦,看到网上的有说是要配置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。是否可能因为配置不对

半兽人 -> Logan 4年前

这样,你可以先做个测试,用下面的命令来执行看看,是否可以匹配到这个目录:
https://www.orchome.com/500

ps:路径里不要带空格,中文等特殊字符

Logan -> 半兽人 4年前

好的,感谢大佬

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

你的答案

查看kafka相关的其他问题或提一个您自己的问题