无法索引类 module-info.class atlog4j-api.jar:java.lang.IllegalStateException:未知标签!pos=4 poolCount = 24
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/52183207/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Could not index class module-info.class atlog4j-api.jar: java.lang.IllegalStateException: Unknown tag! pos=4 poolCount = 24
提问by prashant
We have updated log4j jar from log4j-api-2.7.jar to log4j-api-2.10.0.jar. We are getting below warning at the startup of JBoss(we are using JBoss-EAP-7.0).
我们已将 log4j jar 从 log4j-api-2.7.jar 更新为 log4j-api-2.10.0.jar。我们在 JBoss 启动时收到以下警告(我们使用的是 JBoss-EAP-7.0)。
2018-09-05 05:31:28,669 WARN [org.jboss.as.server.deployment] (MSC service thread 1-2) WFLYSRV0003: Could not index class module-info.class at /content/project.ear/shared/log4j-api.jar: java.lang.IllegalStateException: Unknown tag! pos=4 poolCount = 24 at org.jboss.jandex.Indexer.processConstantPool(Indexer.java:1416) at org.jboss.jandex.Indexer.index(Indexer.java:1450) at org.jboss.as.server.deployment.annotation.ResourceRootIndexer.indexResourceRoot(ResourceRootIndexer.java:99) at org.jboss.as.server.deployment.annotation.AnnotationIndexProcessor.deploy(AnnotationIndexProcessor.java:51) at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:165) at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:2032) at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1955) 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)
2018-09-05 05:31:28,669 WARN [org.jboss.as.server.deployment](MSC 服务线程 1-2)WFLYSRV0003:无法在 /content/project.ear/shared 索引类 module-info.class /log4j-api.jar:java.lang.IllegalStateException:未知标签!pos=4 poolCount = 24 at org.jboss.jandex.Indexer.processConstantPool(Indexer.java:1416) at org.jboss.jandex.Indexer.index(Indexer.java:1450) at org.jboss.as.server.deployment .annotation.ResourceRootIndexer.indexResourceRoot(ResourceRootIndexer.java:99) 在 org.jboss.as.server.deployment.annotation.AnnotationIndexProcessor.deploy(AnnotationIndexProcessor.java:51) 在 org.jboss.as.server.deployment.DeploymentUnitPhaseService.start (DeploymentUnitPhaseService.java:165) at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:2032) at org.
After my analysis it seems that module-info.class is newly introduced in log4j-api-2.10.0.jar and now it is not able to index that class on startup. It is using JBoss's jandex-2.0.2.Final-redhat-1.jar for the same which is coming from dependency information of eap-runtime-artifacts-7.0.5.GA.pom.
经过我的分析,似乎 module-info.class 是在 log4j-api-2.10.0.jar 中新引入的,现在它无法在启动时索引该类。它使用了 JBoss 的 jandex-2.0.2.Final-redhat-1.jar,它来自 eap-runtime-artifacts-7.0.5.GA.pom 的依赖信息。
Can anyone please help me to resolve this issue?
任何人都可以帮我解决这个问题吗?
Thanks in Advance.
提前致谢。
回答by Jens
First of all this is only a warning.
首先,这只是一个警告。
I guess you are using a Java Version lower than 8. The module-info.class
is used for so called Multi release jar's (jars that are comptible with all java version).
我猜您使用的是低于 8 的 Java 版本。module-info.class
用于所谓的多版本 jar(与所有 Java 版本兼容的 jar)。
Java until Version 8 are not 100% compatible with this technique. So the only way i see is upgrade your Java Version to 1.8 or downgrade log4j
Java 直到第 8 版才 100% 兼容这种技术。所以我看到的唯一方法是将您的 Java 版本升级到 1.8 或降级 log4j
回答by Subhani Pathan
This is a warning message, it occured because of jandex supports Java9 is to simply ignore module-info.class files in dependent archives. To avoid this warning messages, replace jandex jar present in (wildfly_HOME\modules\system\layers\base\org\jboss\jandex\main\jande-version.jar with jandex-2.0.5.Final-redhat-1 and the respective module.xml also. Ref : https://issues.redhat.com/browse/JBEAP-15262https://issues.redhat.com/browse/JBEAP-15715
这是一条警告消息,它的出现是因为 jandex 支持 Java9 是简单地忽略依赖档案中的 module-info.class 文件。为避免出现此警告消息,请将 (wildfly_HOME\modules\system\layers\base\org\jboss\jandex\main\jande-version.jar 中的 jandex jar 替换为 jandex-2.0.5.Final-redhat-1 和相应的module.xml 也。参考:https ://issues.redhat.com/browse/JBEAP-15262 https://issues.redhat.com/browse/JBEAP-15715