Cris Maule
Cris Maule

Reputation: 350

Wildfly 22.0.1 failing to deploy WAR that uses @Stateless classes

I am getting a strange error on Wildfly where it is not deploying a WAR file.

My exact setup is per the below:

OS : Windows 10 JDK : Amazon Correto 17.0.11.9.1 WildFly : 22.0.1.Final IntelliJ : IntelliJ IDEA 2024.1 (Ultimate Edition)

Analyzing the Wildfly logs we are presented with the following error:

2024-04-19 10:50:38,612 DEBUG [org.jboss.as.ee] (MSC service thread 1-1) Ignoring failure to handle interceptor annotations for com.mycompany.job.RunMyJob: java.lang.RuntimeException: WFLYSRV0177: Error getting reflective information for class java.lang.Thread with ClassLoader null
    at [email protected]//org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:78)
    at [email protected]//org.jboss.as.ee.metadata.MethodAnnotationAggregator.runtimeAnnotationInformation(MethodAnnotationAggregator.java:57)
    at [email protected]//org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.handleAnnotations(InterceptorAnnotationProcessor.java:106)
    at [email protected]//org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.processComponentConfig(InterceptorAnnotationProcessor.java:85)
    at [email protected]//org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.deploy(InterceptorAnnotationProcessor.java:77)
    at [email protected]//org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:182)
    at [email protected]//org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1739)
    at [email protected]//org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1701)
    at [email protected]//org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1559)
    at [email protected]//org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
    at [email protected]//org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1990)
    at [email protected]//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
    at [email protected]//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
    at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private volatile java.lang.String java.lang.Thread.name accessible: module java.base does not "opens java.lang" to unnamed module @31664cec
    at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354)
    at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
    at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:178)
    at java.base/java.lang.reflect.Field.setAccessible(Field.java:172)
    at [email protected]//org.jboss.as.server.deployment.reflect.ClassReflectionIndex.<init>(ClassReflectionIndex.java:75)
    at [email protected]//org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:70)
    ... 13 more

Steps taken to try and resolve so far are:

  1. Delete the ".m2" folder with all the Maven repositories
  2. Re-import the project into IntelliJ
  3. Remove all versions of Java from the machine apart from the one Amazon Correto
  4. Upgrade IntelliJ to latest version

Key Observations Seen:

  1. This issue has only recently cropped up and it all used to work just fine
  2. There is nothing wrong with the WAR file it's trying to deploy I can take the compiled WAR and deploy it to another PC (Linux in this scenario)
  3. Try manually starting Wildfly outside IntelliJ still gives same error

Root Lines Of Code:

The class com.mycompany.job.RunMyJob is a Quartz scheduled task, but more importantly it has the

@Stateless annotation at the top of it, which in turn uses the following import

import javax.ejb.Stateless;

Now removing the @Stateless causes the problem to be resolved. But we need the class to be stateless.

Any help would be greatly appreciated.

Upvotes: 0

Views: 55

Answers (0)

Related Questions