We probably might do the Proxy factories as SPI Service. So we can replace the calls to Unsafe with newInstance. Or even provide ways to run without proxies (for smallish Java SE projects).
LieGrue, strub > On Monday, 17 November 2014, 23:16, PÉNET LUDOVIC <[email protected]> wrote: > > > Romain Manni-Bucau a écrit : >> HI >> >> maybe lost a part of the thread in gmail but what's the issue with >> Unsafe? Does GAE uses a security manager? If so it just needs to be >> configured > > The problem is their Reflection policy ( in > https://cloud.google.com/appengine/docs/java/ ) > > « > Reflection > > An application is allowed full, unrestricted, reflective access to its own > classes. > > It may query any private members, call the method > java.lang.reflect.AccessibleObject.setAccessible(), and read/set private > members. > > An application can also reflect on JRE and API classes, such as > java.lang.String and javax.servlet.http.HttpServletRequest. However, it > can only access public members of these classes, not protected or private. > > An application cannot reflect against any other classes not belonging to > itself, and it can not use the setAccessible() method to circumvent these > restrictions. > > » > > When one start OWB, this translates to exceptions such as : > > > [INFO] Caused by: java.lang.IllegalStateException: Cannot get sun.misc.Unsafe > [INFO] at > org.apache.webbeans.proxy.AbstractProxyFactory$2.run(AbstractProxyFactory.java:598) > [INFO] at java.security.AccessController.doPrivileged(Native Method) > [INFO] at > org.apache.webbeans.proxy.AbstractProxyFactory.initializeUnsafe(AbstractProxyFactory.java:585) > [INFO] at > org.apache.webbeans.proxy.AbstractProxyFactory.<init>(AbstractProxyFactory.java:64) > [INFO] at > org.apache.webbeans.proxy.InterceptorDecoratorProxyFactory.<init>(InterceptorDecoratorProxyFactory.java:74) > [INFO] at > org.apache.webbeans.config.WebBeansContext.<init>(WebBeansContext.java:79) > [INFO] at > org.apache.webbeans.config.WebBeansContext.<init>(WebBeansContext.java:98) > [INFO] at > org.apache.webbeans.corespi.DefaultSingletonService.get(DefaultSingletonService.java:54) > [INFO] at > org.apache.webbeans.corespi.DefaultSingletonService.get(DefaultSingletonService.java:28) > [INFO] at > org.apache.webbeans.config.WebBeansFinder.getSingletonInstance(WebBeansFinder.java:51) > [INFO] at > org.apache.webbeans.config.WebBeansContext.getInstance(WebBeansContext.java:164) > [INFO] at > org.apache.webbeans.config.WebBeansContext.currentInstance(WebBeansContext.java:182) > [INFO] at > org.apache.webbeans.jsf.OwbApplicationFactory.<init>(OwbApplicationFactory.java:37) > [INFO] ... 41 more > [INFO] Caused by: java.lang.IllegalAccessException: Reflection is not > allowed on private static final sun.misc.Unsafe sun.misc.Unsafe.theUnsafe > [INFO] at > com.google.appengine.tools.development.agent.runtime.Runtime.verifyWhiteListed(Runtime.java:77) > [INFO] at > com.google.appengine.tools.development.agent.runtime.Runtime.verifyReadable(Runtime.java:85) > [INFO] at > com.google.appengine.tools.development.agent.runtime.Runtime.verifyAndRun(Runtime.java:367) > [INFO] at > com.google.appengine.tools.development.agent.runtime.Runtime.get(Runtime.java:164) > [INFO] at > org.apache.webbeans.proxy.AbstractProxyFactory$2.run(AbstractProxyFactory.java:594) > [INFO] ... 53 more > > Thank you for your attention ! > > > Ludovic > > | > | AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT. > | >
