"PÉNET LUDOVIC" a écrit :
> Mark Struberg a écrit :
>> Hi Ludovic!
>>
>> Do you haven an example? I did run OWB on GAE a looong time ago, but did
>> not test lately.
>> If you have a sample for us then we will make it work ;)
>
> Thanks a lot.
>
> Please find attacher a tar.bz2 of a very simple example. I just created a
> simple app using a GAE archetype, then added dependencies for PrimeFaces
> 5.1 / MyFaces 2.2 / OpenWebBeans 1.2 / Deltaspike 1.0.
>
> I use :
> Apache Maven 3.2.3 (33f8c3e1027c3ddde99d3cdebad2656a31e8fdf4;
> 2014-08-11T22:58:10+02:00)
> Maven home: /usr/local/apache-maven-3.2.3
> Java version: 1.7.0_65, vendor: Oracle Corporation
> Java home: /usr/lib/jvm/java-7-openjdk-amd64/jre
> Default locale: fr_FR, platform encoding: UTF-8
> OS name: "linux", version: "3.13.0-36-generic", arch: "amd64", family:
> "unix"
>
>
> ... which seems to fit GAE requirements (maven 3.1 and newer, Java 7).
>
> I have the enclosed log, where you will find several reflection related
> errors.

I took a closer look at it and the root of the problem is the use of the
instance of sun.misc.Unsafe in
org.apache.webbeans.proxy.AbstractProxyFactory.

The method sun.misc.Unsafe#allocateInstance is retrieved by
AbstractProxyFactory#initializeUnsafe . This last method is a private
method, called by the constructor of AbstractProxyFactory.

As it is hard coded, a quick and dirty trick could be to shadow this
class, for example using the maven shade plugin to create a custom OWB
package, to replace the use of sun.misc.Unsafe#allocateInstance by
com.google.apphosting.api.ReflectionUtils#allocateInstance

Not very nice, not very evolutive, of course. I hope someone has a better
solution. :-)

A better way could be to have some kind of UnsafeAllocator hierarchy,
allowing one to provide custom methods for specific cases like this one.

Ludovic

|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|

Reply via email to