You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openwebbeans.apache.org by "Teimatini Marin (JIRA)" <ji...@apache.org> on 2018/10/26 22:13:00 UTC

[jira] [Reopened] (OWB-1258) Java 11 - Cannot get Unsafe.defineClass

     [ https://issues.apache.org/jira/browse/OWB-1258?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Teimatini Marin reopened OWB-1258:
----------------------------------

I just retried with 2.0.7 an still see the same issue.

Please take in mind that I'm not running OWB within tome. I'm running it from an standalone app like follows:

 
{code:java}
public static void main(final String[] args) {
    // newInstance() looks up a META-INF service that implements the
    // SeContainerInitializer interface and loads that.
    // There can only be one.
    SeContainer seContainer = SeContainerInitializer.newInstance()
            // This JAR (bean-archive.jar) contains an empty beans.xml in the resources,
            // so the CDI container will find beans from it.
            // But if you have JARs that are not marked as bean archives,
            // you could add some of their packages to the container and
            // treat all those (CDI compatible POJOs) as beans:
            //.addPackages(Foo.class.getPackage())
            .initialize();


    // Fire synchronous event that triggers the code in App class.
    seContainer.getBeanManager().fireEvent(new BootEvent());

    seContainer.close();
}
{code}
The full stacktrace is:
{code:java}
java -Dfile.encoding=UTF-8 --add-modules java.net.http --module-path /Users/teimatinim/git/concepts/redwine/redwine.distribution/target/redwine.distribution-1.0-SNAPSHOT-dist/bin:/Users/teimatinim/git/concepts/redwine/redwine.distribution/target/redwine.distribution-1.0-SNAPSHOT-dist/lib --module redwine.sensor/com.beuwa.redwine.sensor.Main
Exception in thread "main" java.lang.IllegalStateException: Cannot get sun.misc.Unsafe class
at openwebbeans.impl@2.0.7/org.apache.webbeans.proxy.AbstractProxyFactory.getUnsafeClass(AbstractProxyFactory.java:837)
at openwebbeans.impl@2.0.7/org.apache.webbeans.proxy.AbstractProxyFactory.initializeUnsafe(AbstractProxyFactory.java:762)
at openwebbeans.impl@2.0.7/org.apache.webbeans.proxy.AbstractProxyFactory.<init>(AbstractProxyFactory.java:93)
at openwebbeans.impl@2.0.7/org.apache.webbeans.proxy.InterceptorDecoratorProxyFactory.<init>(InterceptorDecoratorProxyFactory.java:80)
at openwebbeans.impl@2.0.7/org.apache.webbeans.config.WebBeansContext.<init>(WebBeansContext.java:157)
at openwebbeans.impl@2.0.7/org.apache.webbeans.config.WebBeansContext.<init>(WebBeansContext.java:119)
at openwebbeans.se@2.0.7/org.apache.openwebbeans.se.OWBInitializer.initialize(OWBInitializer.java:86)
at openwebbeans.se@2.0.7/org.apache.openwebbeans.se.SeInitializerFacade.initialize(SeInitializerFacade.java:137)
at redwine.sensor/com.beuwa.redwine.sensor.Main.main(Main.java:20)
Caused by: java.lang.IllegalStateException: Cannot get sun.misc.Unsafe
at openwebbeans.impl@2.0.7/org.apache.webbeans.proxy.AbstractProxyFactory$4.run(AbstractProxyFactory.java:829)
at openwebbeans.impl@2.0.7/org.apache.webbeans.proxy.AbstractProxyFactory$4.run(AbstractProxyFactory.java:813)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at openwebbeans.impl@2.0.7/org.apache.webbeans.proxy.AbstractProxyFactory.getUnsafeClass(AbstractProxyFactory.java:812)
... 8 more
Caused by: java.lang.ClassNotFoundException: sun.misc.Unsafe
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
at openwebbeans.impl@2.0.7/org.apache.webbeans.proxy.AbstractProxyFactory$4.run(AbstractProxyFactory.java:819)
... 11 more

{code}
Thanks for taking a look!

> Java 11 - Cannot get Unsafe.defineClass
> ---------------------------------------
>
>                 Key: OWB-1258
>                 URL: https://issues.apache.org/jira/browse/OWB-1258
>             Project: OpenWebBeans
>          Issue Type: Bug
>    Affects Versions: 2.0.5
>            Reporter: Teimatini Marin
>            Priority: Major
>             Fix For: 2.0.7
>
>
> While trying to start a container in Java 11, as the sun.misc.Unsafe.defineClass has been terminally deprecated (forRemoval=true), the following exception is thrown:
> Exception in thread "main" java.lang.IllegalStateException: Cannot get Unsafe.defineClass
>  at org.apache.webbeans.proxy.AbstractProxyFactory$4.run(AbstractProxyFactory.java:814)
>  at org.apache.webbeans.proxy.AbstractProxyFactory$4.run(AbstractProxyFactory.java:803)
>  at java.base/java.security.AccessController.doPrivileged(Native Method)
>  at org.apache.webbeans.proxy.AbstractProxyFactory.initializeUnsafe(AbstractProxyFactory.java:802)
>  at org.apache.webbeans.proxy.AbstractProxyFactory.<init>(AbstractProxyFactory.java:93)
>  at org.apache.webbeans.proxy.InterceptorDecoratorProxyFactory.<init>(InterceptorDecoratorProxyFactory.java:80)
>  at org.apache.webbeans.config.WebBeansContext.<init>(WebBeansContext.java:157)
>  at org.apache.webbeans.config.WebBeansContext.<init>(WebBeansContext.java:119)
>  at org.apache.openwebbeans.se.OWBInitializer.initialize(OWBInitializer.java:86)
>  at org.apache.openwebbeans.se.SeInitializerFacade.initialize(SeInitializerFacade.java:137)
>  at com.beuwa.redwine.sensor.Main.main(Main.java:20)
> 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:809)
>  ... 10 more



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)