Uploaded image for project: 'WildFly Core'
  1. WildFly Core
  2. WFCORE-5861

InaccessibleObjectException with OpenJDK17 and embed-server

XMLWordPrintable

    • Hide
      1. Unzip the WildFly, start embed-server, deploy an app and reload:
        <path-to-jdk17-java>/bin/java --add-modules=java.se -jar /tmp/wildfly-25.0.1.Final/bin/client/jboss-cli-client.jar -Daesh.terminal=org.jboss.aesh.terminal.TestTerminal --no-color-output --timeout=30000
        embed-server --jboss-home=/tmp/wildfly-25.0.1.Final/ --std-out=echo
        deploy <dir-of-our-jar>/nonmodularservertestcase.jar --runtime-name=foo-archive.jar
        deployment-info --name=nonmodularservertestcase.jar
        reload
        
      2. After the reload operation, you can see the error mentioned in the issue description
      Show
      Unzip the WildFly, start embed-server, deploy an app and reload: <path-to-jdk17-java>/bin/java --add-modules=java.se -jar /tmp/wildfly-25.0.1.Final/bin/client/jboss-cli-client.jar -Daesh.terminal=org.jboss.aesh.terminal.TestTerminal --no-color-output --timeout=30000 embed-server --jboss-home=/tmp/wildfly-25.0.1.Final/ --std-out=echo deploy <dir-of-our-jar>/nonmodularservertestcase.jar --runtime-name=foo-archive.jar deployment-info --name=nonmodularservertestcase.jar reload After the reload operation, you can see the error mentioned in the issue description
    • Workaround Exists
    • Hide

      Define proper --add-opens argument during the jboss-cli-client.jar startup:

      <path-to-jdk17-java>/bin/java --add-modules=java.se --add-opens java.base/java.util=ALL-UNNAMED -jar /tmp/wildfly-25.0.1.Final/bin/client/jboss-cli-client.jar -Daesh.terminal=org.jboss.aesh.terminal.TestTerminal --no-color-output --timeout=30000
      
      Show
      Define proper --add-opens argument during the jboss-cli-client.jar startup: <path-to-jdk17-java>/bin/java --add-modules=java.se --add-opens java.base/java.util=ALL-UNNAMED -jar /tmp/wildfly-25.0.1.Final/bin/client/jboss-cli-client.jar -Daesh.terminal=org.jboss.aesh.terminal.TestTerminal --no-color-output --timeout=30000

      When running the WildFly 25.0.1.Final as an embed-server with OpenJDK17, I can see a following error when I deploy my jar archive and reload the server:

      09:57:54,901 INFO  [org.jboss.as.ejb3.deployment] (MSC service thread 1-8) WFLYEJB0473: JNDI bindings for session bean named 'LoggingBean' in deployment unit 'deployment "foo-archive.jar"' are as follows:
      
      	java:global/foo-archive/LoggingBean!org.jboss.qe.cli.embed.util.LoggingBean
      	java:app/foo-archive/LoggingBean!org.jboss.qe.cli.embed.util.LoggingBean
      	java:module/LoggingBean!org.jboss.qe.cli.embed.util.LoggingBean
      	java:global/foo-archive/LoggingBean
      	java:app/foo-archive/LoggingBean
      	java:module/LoggingBean
      
      09:57:55,036 INFO  [org.wildfly.microprofile.opentracing.smallrye] (MSC service thread 1-8) WFLYTRAC0001: Tracer initialized: NoopTracer
      09:57:55,056 WARN  [org.jboss.as.ejb3] (MSC service thread 1-3) WFLYEJB0131: Jakarta Enterprise Beans org.jboss.qe.cli.embed.util.LoggingBean should not have a final or static method (getHello)
      09:57:55,120 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC000001: Failed to start service org.wildfly.clustering.infinispan.cache-container-configuration.ejb: org.jboss.msc.service.StartException in service org.wildfly.clustering.infinispan.cache-container-configuration.ejb: java.lang.ExceptionInInitializerError
      	at org.wildfly.clustering.service@25.0.1.Final//org.wildfly.clustering.service.FunctionalService.start(FunctionalService.java:66)
      	at org.jboss.msc@1.4.13.Final//org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1739)
      	at org.jboss.msc@1.4.13.Final//org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1701)
      	at org.jboss.msc@1.4.13.Final//org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1559)
      	at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
      	at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1990)
      	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
      	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
      	at java.base/java.lang.Thread.run(Thread.java:833)
      Caused by: java.lang.ExceptionInInitializerError
      	at org.wildfly.clustering.marshalling.protostream@25.0.1.Final//org.wildfly.clustering.marshalling.protostream.util.UtilMarshallerProvider.<clinit>(UtilMarshallerProvider.java:79)
      	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
      	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
      	at java.base/java.lang.Class.getEnumConstantsShared(Class.java:3837)
      	at java.base/java.lang.System$2.getEnumConstantsShared(System.java:2284)
      	at java.base/java.util.EnumSet.getUniverse(EnumSet.java:408)
      	at java.base/java.util.EnumSet.noneOf(EnumSet.java:111)
      	at java.base/java.util.EnumSet.allOf(EnumSet.java:132)
      	at org.wildfly.clustering.marshalling.protostream@25.0.1.Final//org.wildfly.clustering.marshalling.protostream.ProviderSerializationContextInitializer.registerMarshallers(ProviderSerializationContextInitializer.java:46)
      	at org.wildfly.clustering.marshalling.protostream@25.0.1.Final//org.wildfly.clustering.marshalling.protostream.SerializationContextInitializerProvider.registerMarshallers(SerializationContextInitializerProvider.java:54)
      	at org.wildfly.clustering.marshalling.protostream@25.0.1.Final//org.wildfly.clustering.marshalling.protostream.SerializationContextBuilder.init(SerializationContextBuilder.java:138)
      	at org.wildfly.clustering.marshalling.protostream@25.0.1.Final//org.wildfly.clustering.marshalling.protostream.SerializationContextBuilder.register(SerializationContextBuilder.java:90)
      	at org.wildfly.clustering.marshalling.protostream@25.0.1.Final//org.wildfly.clustering.marshalling.protostream.SerializationContextBuilder.<init>(SerializationContextBuilder.java:53)
      	at org.wildfly.clustering.infinispan.marshalling@25.0.1.Final//org.wildfly.clustering.infinispan.marshalling.protostream.ProtoStreamMarshaller.<init>(ProtoStreamMarshaller.java:40)
      	at org.wildfly.clustering.infinispan.spi@25.0.1.Final//org.wildfly.clustering.infinispan.spi.marshalling.InfinispanProtoStreamMarshaller.<init>(InfinispanProtoStreamMarshaller.java:38)
      	at org.wildfly.clustering.infinispan.spi@25.0.1.Final//org.wildfly.clustering.infinispan.spi.marshalling.InfinispanMarshallerFactory$3.apply(InfinispanMarshallerFactory.java:67)
      	at org.wildfly.clustering.infinispan.spi@25.0.1.Final//org.wildfly.clustering.infinispan.spi.marshalling.InfinispanMarshallerFactory$3.apply(InfinispanMarshallerFactory.java:64)
      	at org.jboss.as.clustering.infinispan@25.0.1.Final//org.jboss.as.clustering.infinispan.subsystem.GlobalConfigurationServiceConfigurator.get(GlobalConfigurationServiceConfigurator.java:127)
      	at org.jboss.as.clustering.infinispan@25.0.1.Final//org.jboss.as.clustering.infinispan.subsystem.GlobalConfigurationServiceConfigurator.get(GlobalConfigurationServiceConfigurator.java:79)
      	at org.wildfly.clustering.service@25.0.1.Final//org.wildfly.clustering.service.FunctionalService.start(FunctionalService.java:63)
      	... 8 more
      Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private final java.lang.Class java.util.EnumMap.keyType accessible: module java.base does not "opens java.util" to unnamed module @8a739dc
      	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 org.wildfly.clustering.marshalling.protostream@25.0.1.Final//org.wildfly.clustering.marshalling.protostream.util.EnumMapMarshaller$1.run(EnumMapMarshaller.java:53)
      	at org.wildfly.clustering.marshalling.protostream@25.0.1.Final//org.wildfly.clustering.marshalling.protostream.util.EnumMapMarshaller$1.run(EnumMapMarshaller.java:48)
      	at org.wildfly.security.elytron-base@1.17.1.Final//org.wildfly.security.manager.WildFlySecurityManager.doUnchecked(WildFlySecurityManager.java:838)
      	at org.wildfly.clustering.marshalling.protostream@25.0.1.Final//org.wildfly.clustering.marshalling.protostream.util.EnumMapMarshaller.<clinit>(EnumMapMarshaller.java:48)
      	... 30 more
      
      09:57:55,168 INFO  [org.jboss.weld.Version] (MSC service thread 1-3) WELD-000900: 3.1.8 (Final)
      09:57:55,790 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([
          ("subsystem" => "infinispan"),
          ("cache-container" => "ejb")
      ]) - failure description: {"WFLYCTL0080: Failed services" => {"org.wildfly.clustering.infinispan.cache-container-configuration.ejb" => "java.lang.ExceptionInInitializerError
          Caused by: java.lang.ExceptionInInitializerError
          Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private final java.lang.Class java.util.EnumMap.keyType accessible: module java.base does not \"opens java.util\" to unnamed module @8a739dc"}}
      09:57:55,790 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([
          ("subsystem" => "infinispan"),
          ("cache-container" => "ejb"),
          ("thread-pool" => "async-operations")
      ]) - failure description: {"WFLYCTL0080: Failed services" => {"org.wildfly.clustering.infinispan.cache-container-configuration.ejb" => "java.lang.ExceptionInInitializerError
          Caused by: java.lang.ExceptionInInitializerError
          Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private final java.lang.Class java.util.EnumMap.keyType accessible: module java.base does not \"opens java.util\" to unnamed module @8a739dc"}}
      09:57:55,791 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([
          ("subsystem" => "infinispan"),
          ("cache-container" => "ejb"),
          ("thread-pool" => "blocking")
      ]) - failure description: {"WFLYCTL0080: Failed services" => {"org.wildfly.clustering.infinispan.cache-container-configuration.ejb" => "java.lang.ExceptionInInitializerError
          Caused by: java.lang.ExceptionInInitializerError
          Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private final java.lang.Class java.util.EnumMap.keyType accessible: module java.base does not \"opens java.util\" to unnamed module @8a739dc"}}
      09:57:55,791 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([
          ("subsystem" => "infinispan"),
          ("cache-container" => "ejb"),
          ("thread-pool" => "expiration")
      ]) - failure description: {"WFLYCTL0080: Failed services" => {"org.wildfly.clustering.infinispan.cache-container-configuration.ejb" => "java.lang.ExceptionInInitializerError
          Caused by: java.lang.ExceptionInInitializerError
          Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private final java.lang.Class java.util.EnumMap.keyType accessible: module java.base does not \"opens java.util\" to unnamed module @8a739dc"}}
      09:57:55,791 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([
          ("subsystem" => "infinispan"),
          ("cache-container" => "ejb"),
          ("thread-pool" => "listener")
      ]) - failure description: {"WFLYCTL0080: Failed services" => {"org.wildfly.clustering.infinispan.cache-container-configuration.ejb" => "java.lang.ExceptionInInitializerError
          Caused by: java.lang.ExceptionInInitializerError
          Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private final java.lang.Class java.util.EnumMap.keyType accessible: module java.base does not \"opens java.util\" to unnamed module @8a739dc"}}
      09:57:55,791 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([
          ("subsystem" => "infinispan"),
          ("cache-container" => "ejb"),
          ("thread-pool" => "non-blocking")
      ]) - failure description: {"WFLYCTL0080: Failed services" => {"org.wildfly.clustering.infinispan.cache-container-configuration.ejb" => "java.lang.ExceptionInInitializerError
          Caused by: java.lang.ExceptionInInitializerError
          Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private final java.lang.Class java.util.EnumMap.keyType accessible: module java.base does not \"opens java.util\" to unnamed module @8a739dc"}}
      09:57:55,791 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([
          ("subsystem" => "infinispan"),
          ("cache-container" => "ejb"),
          ("thread-pool" => "persistence")
      ]) - failure description: {"WFLYCTL0080: Failed services" => {"org.wildfly.clustering.infinispan.cache-container-configuration.ejb" => "java.lang.ExceptionInInitializerError
          Caused by: java.lang.ExceptionInInitializerError
          Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private final java.lang.Class java.util.EnumMap.keyType accessible: module java.base does not \"opens java.util\" to unnamed module @8a739dc"}}
      09:57:55,792 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([
          ("subsystem" => "infinispan"),
          ("cache-container" => "ejb"),
          ("thread-pool" => "remote-command")
      ]) - failure description: {"WFLYCTL0080: Failed services" => {"org.wildfly.clustering.infinispan.cache-container-configuration.ejb" => "java.lang.ExceptionInInitializerError
          Caused by: java.lang.ExceptionInInitializerError
          Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private final java.lang.Class java.util.EnumMap.keyType accessible: module java.base does not \"opens java.util\" to unnamed module @8a739dc"}}
      09:57:55,792 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([
          ("subsystem" => "infinispan"),
          ("cache-container" => "ejb"),
          ("thread-pool" => "state-transfer")
      ]) - failure description: {"WFLYCTL0080: Failed services" => {"org.wildfly.clustering.infinispan.cache-container-configuration.ejb" => "java.lang.ExceptionInInitializerError
          Caused by: java.lang.ExceptionInInitializerError
          Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private final java.lang.Class java.util.EnumMap.keyType accessible: module java.base does not \"opens java.util\" to unnamed module @8a739dc"}}
      09:57:55,792 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([
          ("subsystem" => "infinispan"),
          ("cache-container" => "ejb"),
          ("thread-pool" => "transport")
      ]) - failure description: {"WFLYCTL0080: Failed services" => {"org.wildfly.clustering.infinispan.cache-container-configuration.ejb" => "java.lang.ExceptionInInitializerError
          Caused by: java.lang.ExceptionInInitializerError
          Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private final java.lang.Class java.util.EnumMap.keyType accessible: module java.base does not \"opens java.util\" to unnamed module @8a739dc"}}
      09:57:55,792 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([
          ("subsystem" => "infinispan"),
          ("cache-container" => "ejb"),
          ("transport" => "none")
      ]) - failure description: {"WFLYCTL0080: Failed services" => {"org.wildfly.clustering.infinispan.cache-container-configuration.ejb" => "java.lang.ExceptionInInitializerError
          Caused by: java.lang.ExceptionInInitializerError
          Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private final java.lang.Class java.util.EnumMap.keyType accessible: module java.base does not \"opens java.util\" to unnamed module @8a739dc"}}
      09:57:55,794 INFO  [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0010: Deployed "nonmodularservertestcase.jar" (runtime-name : "foo-archive.jar")
      09:57:55,795 INFO  [org.jboss.as.controller] (Controller Boot Thread) WFLYCTL0183: Service status report
      WFLYCTL0186:   Services which failed to start:      service org.wildfly.clustering.infinispan.cache-container-configuration.ejb: java.lang.ExceptionInInitializerError
      WFLYCTL0448: 13 additional services are down due to their dependencies being missing or failed
      09:57:55,810 INFO  [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0212: Resuming server
      09:57:55,813 ERROR [org.jboss.as] (Controller Boot Thread) WFLYSRV0026: WildFly Full 25.0.1.Final (WildFly Core 17.0.3.Final) started (with errors) in 2102ms - Started 404 of 628 services (16 services failed or missing dependencies, 340 services are lazy, passive or on-demand)
      

      I've tried this with a more recent WildFly build (36e9d94a92dcd357008dab2b7178b93e24b43ddf) but I can see the very same issue there too. This issue cannot be seen when I use JDK11 instead of JDK17 in both cases.

      The source of the nonmodularservertestcase.jar jar archive is as following:

      package org.jboss.qe.cli.embed.util;
      
      import javax.ejb.Singleton;
      import javax.ejb.Startup;
      import java.util.logging.Logger;
      
      @Singleton
      @Startup
      public class LoggingBean {
          private static final String HELLO = "Hellos from " + LoggingBean.class.getName();
      
          {
              Logger.getLogger(getClass().getSimpleName()).info(HELLO);
          }
      
          public static String getHello() {
              return HELLO;
          }
      }
      

              bstansbe@redhat.com Brian Stansberry
              jstourac@redhat.com Jan Stourac
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: