[
https://issues.apache.org/jira/browse/OWB-1248?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16541625#comment-16541625
]
Romain Manni-Bucau commented on OWB-1248:
-----------------------------------------
[~dkwakkel] feel free to propose a PR using that. This is also what I had in
mind but seems it is not needed in java 11 early builds. Issue with that code
is you need the private lookup which is only accessible if you opened the
module which will likely not be the case for OWB. An alternative is to use a
custom classloader in owb-impl module to so that internally and "facade" all
proxy classes through this fake classloader.
> defineClass used which is not supported by java 11
> --------------------------------------------------
>
> Key: OWB-1248
> URL: https://issues.apache.org/jira/browse/OWB-1248
> Project: OpenWebBeans
> Issue Type: Bug
> Affects Versions: 2.0.6
> Reporter: Donald Kwakkel
> Assignee: Romain Manni-Bucau
> Priority: Critical
> Fix For: 2.0.7
>
>
> 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
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)