Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-22724

(7.4.z) WFCORE-5861 - InaccessibleObjectException with OpenJDK17 and embed-server

XMLWordPrintable

    • False
    • False
    • +
    • 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/jboss-eap-8.0/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/jboss-eap-8.0/bin/client/jboss-cli-client.jar -Daesh.terminal=org.jboss.aesh.terminal.TestTerminal --no-color-output --timeout=30000
    • Hide
      1. Unzip the JBoss EAP, start embed-server, deploy an app and reload:
        <path-to-jdk17-java>/bin/java --add-modules=java.se -jar /tmp/jboss-eap-8.0/bin/client/jboss-cli-client.jar -Daesh.terminal=org.jboss.aesh.terminal.TestTerminal --no-color-output --timeout=30000
        embed-server --jboss-home=/tmp/jboss-eap-8.0/ --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 JBoss EAP, start embed-server, deploy an app and reload: <path-to-jdk17-java>/bin/java --add-modules=java.se -jar /tmp/jboss-eap-8.0/bin/client/jboss-cli-client.jar -Daesh.terminal=org.jboss.aesh.terminal.TestTerminal --no-color-output --timeout=30000 embed-server --jboss-home=/tmp/jboss-eap-8.0/ --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

      When running the JBoss EAP 8.0.0.Alpha-DR1 as an embed-server with OpenJDK17, I can see a following error when I deploy my jar archive and reload the server:

      11:31:56,800 INFO  [org.jboss.as.ejb3.deployment] (MSC service thread 1-6) 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
      
      11:31:56,891 INFO  [org.jboss.weld.Version] (MSC service thread 1-1) WELD-000900: 3.1.8 (redhat)
      11:31:56,898 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-3) 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@8.0.0.Alpha-DR1-redhat-20211026//org.wildfly.clustering.service.FunctionalService.start(FunctionalService.java:66)
      	at org.jboss.msc@1.4.13.Final-redhat-00001//org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1739)
      	at org.jboss.msc@1.4.13.Final-redhat-00001//org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1701)
      	at org.jboss.msc@1.4.13.Final-redhat-00001//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@8.0.0.Alpha-DR1-redhat-20211026//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@8.0.0.Alpha-DR1-redhat-20211026//org.wildfly.clustering.marshalling.protostream.ProviderSerializationContextInitializer.registerMarshallers(ProviderSerializationContextInitializer.java:46)
      	at org.wildfly.clustering.marshalling.protostream@8.0.0.Alpha-DR1-redhat-20211026//org.wildfly.clustering.marshalling.protostream.SerializationContextInitializerProvider.registerMarshallers(SerializationContextInitializerProvider.java:54)
      	at org.wildfly.clustering.marshalling.protostream@8.0.0.Alpha-DR1-redhat-20211026//org.wildfly.clustering.marshalling.protostream.SerializationContextBuilder.init(SerializationContextBuilder.java:138)
      	at org.wildfly.clustering.marshalling.protostream@8.0.0.Alpha-DR1-redhat-20211026//org.wildfly.clustering.marshalling.protostream.SerializationContextBuilder.register(SerializationContextBuilder.java:90)
      	at org.wildfly.clustering.marshalling.protostream@8.0.0.Alpha-DR1-redhat-20211026//org.wildfly.clustering.marshalling.protostream.SerializationContextBuilder.<init>(SerializationContextBuilder.java:53)
      	at org.wildfly.clustering.infinispan.marshalling@8.0.0.Alpha-DR1-redhat-20211026//org.wildfly.clustering.infinispan.marshalling.protostream.ProtoStreamMarshaller.<init>(ProtoStreamMarshaller.java:40)
      	at org.wildfly.clustering.infinispan.spi@8.0.0.Alpha-DR1-redhat-20211026//org.wildfly.clustering.infinispan.spi.marshalling.InfinispanProtoStreamMarshaller.<init>(InfinispanProtoStreamMarshaller.java:38)
      	at org.wildfly.clustering.infinispan.spi@8.0.0.Alpha-DR1-redhat-20211026//org.wildfly.clustering.infinispan.spi.marshalling.InfinispanMarshallerFactory$3.apply(InfinispanMarshallerFactory.java:67)
      	at org.wildfly.clustering.infinispan.spi@8.0.0.Alpha-DR1-redhat-20211026//org.wildfly.clustering.infinispan.spi.marshalling.InfinispanMarshallerFactory$3.apply(InfinispanMarshallerFactory.java:64)
      	at org.jboss.as.clustering.infinispan@8.0.0.Alpha-DR1-redhat-20211026//org.jboss.as.clustering.infinispan.subsystem.GlobalConfigurationServiceConfigurator.get(GlobalConfigurationServiceConfigurator.java:127)
      	at org.jboss.as.clustering.infinispan@8.0.0.Alpha-DR1-redhat-20211026//org.jboss.as.clustering.infinispan.subsystem.GlobalConfigurationServiceConfigurator.get(GlobalConfigurationServiceConfigurator.java:79)
      	at org.wildfly.clustering.service@8.0.0.Alpha-DR1-redhat-20211026//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 @b60bea4
      	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@8.0.0.Alpha-DR1-redhat-20211026//org.wildfly.clustering.marshalling.protostream.util.EnumMapMarshaller$1.run(EnumMapMarshaller.java:53)
      	at org.wildfly.clustering.marshalling.protostream@8.0.0.Alpha-DR1-redhat-20211026//org.wildfly.clustering.marshalling.protostream.util.EnumMapMarshaller$1.run(EnumMapMarshaller.java:48)
      	at org.wildfly.security.elytron-base@1.17.1.Final-redhat-00001//org.wildfly.security.manager.WildFlySecurityManager.doUnchecked(WildFlySecurityManager.java:838)
      	at org.wildfly.clustering.marshalling.protostream@8.0.0.Alpha-DR1-redhat-20211026//org.wildfly.clustering.marshalling.protostream.util.EnumMapMarshaller.<clinit>(EnumMapMarshaller.java:48)
      	... 30 more
      
      11:31:57,239 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 @b60bea4"}}
      11:31:57,240 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 @b60bea4"}}
      11:31:57,240 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 @b60bea4"}}
      11:31:57,240 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 @b60bea4"}}
      11:31:57,240 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 @b60bea4"}}
      11:31:57,241 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 @b60bea4"}}
      11:31:57,241 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 @b60bea4"}}
      11:31:57,241 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 @b60bea4"}}
      11:31:57,241 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 @b60bea4"}}
      11:31:57,241 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 @b60bea4"}}
      11:31:57,242 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 @b60bea4"}}
      11:31:57,243 INFO  [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0010: Deployed "nonmodularservertestcase.jar" (runtime-name : "foo-archive.jar")
      11:31:57,244 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
      11:31:57,257 INFO  [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0212: Resuming server
      11:31:57,258 ERROR [org.jboss.as] (Controller Boot Thread) WFLYSRV0026: JBoss EAP 8.0.0.Alpha-DR1 (WildFly Core 17.0.2.Final-redhat-20211026) started (with errors) in 1340ms - Started 402 of 626 services (16 services failed or missing dependencies, 339 services are lazy, passive or on-demand)
      

      This issue cannot be seen when I use JDK11 instead of JDK17.

      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;
          }
      }
      

            mstefank Martin Stefanko
            jstourac@redhat.com Jan Stourac
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: