Uploaded image for project: 'OpenWebBeans'
  1. OpenWebBeans
  2. OWB-1248

defineClass used which is not supported by java 11

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 2.0.6
    • Fix Version/s: 2.0.7
    • Component/s: None
    • Labels:
      None

      Description

      Not sure if openwebbeans will support java 11, but with latest java 11 version it is not possible to start tomee:
      org.apache.openejb.OpenEJBException: Creating application failed: /opt/opentext/defaultInst/webroot: Cannot get Unsafe.defineClass
      at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:1096)
      at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:757)
      at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1303)
      at org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1125)
      at org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:133)
      at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:94)
      at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5154)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
      at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:754)
      at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:730)
      at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
      at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:629)
      at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1839)
      at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
      at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
      at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
      at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
      at java.base/java.lang.Thread.run(Thread.java:834)
      Caused by: java.lang.IllegalStateException: Cannot get Unsafe.defineClass
      at org.apache.webbeans.proxy.AbstractProxyFactory$4.run(AbstractProxyFactory.java:812)
      at org.apache.webbeans.proxy.AbstractProxyFactory$4.run(AbstractProxyFactory.java:801)
      at java.base/java.security.AccessController.doPrivileged(Native Method)
      at org.apache.webbeans.proxy.AbstractProxyFactory.initializeUnsafe(AbstractProxyFactory.java:800)
      at org.apache.webbeans.proxy.AbstractProxyFactory.<init>(AbstractProxyFactory.java:91)
      at org.apache.webbeans.proxy.InterceptorDecoratorProxyFactory.<init>(InterceptorDecoratorProxyFactory.java:77)
      at org.apache.webbeans.config.WebBeansContext.<init>(WebBeansContext.java:153)
      at org.apache.webbeans.config.WebBeansContext.<init>(WebBeansContext.java:116)
      at org.apache.openejb.cdi.ThreadSingletonServiceImpl.initialize(ThreadSingletonServiceImpl.java:167)
      at org.apache.openejb.cdi.CdiBuilder.build(CdiBuilder.java:41)
      at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:963)
      ... 17 more
      Caused by: java.lang.NoSuchMethodException: sun.misc.Unsafe.defineClass(java.lang.String, [B, int, int, java.lang.ClassLoader, java.security.ProtectionDomain)
      at java.base/java.lang.Class.getDeclaredMethod(Class.java:2476)
      at org.apache.webbeans.proxy.AbstractProxyFactory$4.run(AbstractProxyFactory.java:807)
      ... 27 more
      Reason is that defineClass is used which is no longer supported with java 11 (at least here, maybe also on other places)

      webbeans-impl/src/main/java/org/apache/webbeans/proxy/AbstractProxyFactory.java:

      return unsafeClass.getDeclaredMethod("defineClass",
      String.class, byte[].class, int.class, int.class, ClassLoader.class, ProtectionDomain.class);

      Same issue has tomee: https://issues.apache.org/jira/browse/TOMEE-2200

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                romain.manni-bucau Romain Manni-Bucau
                Reporter:
                dkwakkel Donald Kwakkel
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: