"WFLYSRV0003: Could not index class module-info.class" happens during the application deployment when the packaged library contains module-info.class in JBoss EAP 7
Environment
- Red Hat JBoss Enterprise Application Platform (EAP)
- 7.x
Issue
- The following WARN log happens during the application deployment when the packaged library contains module-info.class (for example, log4j2 2.10.0 or later):
WARN [org.jboss.as.server.deployment] (MSC service thread 1-5) WFLYSRV0003: Could not index class META-INF/versions/9/module-info.class at /content/example.war/WEB-INF/lib/log4j-api-2.11.1.jar: java.lang.IllegalStateException: Unknown tag! pos=4 poolCount = 32
at org.jboss.jandex.Indexer.processConstantPool(Indexer.java:1417)
at org.jboss.jandex.Indexer.index(Indexer.java:1451)
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)
- Trying to deploy an application depending on
threeten-extra-1.3.2.jar(packaged intoWEB-INF/libfolder) in JBoss EAP 7.1 results in
WARN [org.jboss.as.server.deployment] (MSC service thread 1-5) WFLYSRV0003: Could not index class module-info.class at /content/application.war/WEB-INF/lib/threeten-extra-1.3.2.jar: java.lang.IllegalStateException: Unknown tag! pos=4 poolCount = 16
at org.jboss.jandex.Indexer.processConstantPool(Indexer.java:1417)
at org.jboss.jandex.Indexer.index(Indexer.java:1451)
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)
Resolution
This is the same issue as Content from issues.jboss.org is not included.JANDEX-40 which was reported for the upstream jandex component. We raised Content from issues.jboss.org is not included.JBEAP-15261 for JBoss EAP 7.1.z. This log message won't be logged in EAP 7.1.6 and EAP 7.2.0 onwards.
This is not harmful, so you can ignore this WARN message. However, if you want a workaround to suppress this WARN message, you can manually generate the annotation index and package the generated META-INF/jandex.idx in the problematic jar . Then, the annotation index is not generated for the jar during the deployment.
You can execute the following command to generate the annotation index and package the index in war (using -m option updates the specified jar file to include the annotation index):
java -jar $JBOSS_HOME/modules/system/layers/base/org/jboss/jandex/main/jandex-2.0.2.Final-redhat-1.jar -m log4j-api-2.11.1.jar
If you are using EAP 7.1.4 (or later), you can use the following command instead:
java -jar $JBOSS_HOME/jboss-modules.jar -mp $JBOSS_HOME/modules/ org.jboss.jandex -m log4j-api-2.11.1.jar
Note that the automatic annotation scanning of modules was added to EAP 7 by Content from issues.jboss.org is not included.AS7-944. The current implementation in EAP 7 is an all or nothing. If the index is added to a jar file inside the module, no scanning at all is executed. So, you may need to execute all of jar files which are packaged in your application.
Root Cause
- Content from issues.jboss.org is not included.JANDEX-40
- Content from issues.jboss.org is not included.JBEAP-15261
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.