openejb-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sami Jaber" <sami.ja...@gmail.com>
Subject Re: Lazy fields issue with Hibernate/OpenEJB
Date Thu, 07 Aug 2008 10:16:23 GMT
Thanks, in fact I have decompiled, patched and updated my openejb-client.jar
with the content of the current trunk, it worked.
That's better to have the whole thing instead of hacking out the bits.

2008/8/7 David Blevins <david.blevins@visi.com>

> Ok.  Whipped up another build.
>
>  http://people.apache.org/~dblevins/openejb-3.1-r683569.zip<http://people.apache.org/%7Edblevins/openejb-3.1-r683569.zip>
>
> Let's see if we don't have better luck with this one.
>
> -David
>
>
>
> On Aug 7, 2008, at 1:08 AM, Sami Jaber wrote:
>
>  I have checked out the last revision of EjbOutputStream and resolveClass
>> method :
>>
>> http://svn.apache.org/viewvc/openejb/trunk/openejb3/server/openejb-client/src/main/java/org/apache/openejb/client/EjbObjectInputStream.java?view=markup&pathrev=672430
>> This bug should not occurs if I have the right version of
>> openejbclient.jar
>>
>>  catch (ClassNotFoundException e) {
>>           String n = classDesc.getName();
>>           if (n.equals("boolean")) return boolean.class;
>>           if (n.equals("byte")) return byte.class;
>>           if (n.equals("char")) return char.class;
>>           if (n.equals("short")) return short.class;
>>           if (n.equals("int")) return int.class;
>>           if (n.equals("long")) return long.class;
>>           if (n.equals("float")) return float.class;
>>           if (n.equals("double")) return double.class;
>>
>> I have decompiled the jar you sent me David, here the result :
>>
>> // Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
>> // Jad home page: http://www.kpdus.com/jad.html
>> // Decompiler options: packimports(3)
>> // Source File Name:   EjbObjectInputStream.java
>>
>> package org.apache.openejb.client;
>>
>> import java.io.*;
>> import java.lang.reflect.Proxy;
>>
>> public class EjbObjectInputStream extends ObjectInputStream
>> {
>>   public EjbObjectInputStream(InputStream in)
>>       throws IOException
>>   {
>>       super(in);
>>   }
>>
>>   protected Class resolveClass(ObjectStreamClass classDesc)
>>       throws IOException, ClassNotFoundException
>>   {
>>       return Class.forName(classDesc.getName(), false, getClassloader());
>>   }
>>
>>   protected Class resolveProxyClass(String interfaces[])
>>       throws IOException, ClassNotFoundException
>>   {
>>       Class cinterfaces[] = new Class[interfaces.length];
>>       for(int i = 0; i < interfaces.length; i++)
>>           cinterfaces[i] = getClassloader().loadClass(interfaces[i]);
>>       try
>>       {
>>           return Proxy.getProxyClass(getClassloader(), cinterfaces);
>>       }
>>       catch(IllegalArgumentException e)
>>       {
>>           throw new ClassNotFoundException(null, e);
>>       }
>>   }
>>
>>   ClassLoader getClassloader()
>>   {
>>       return Thread.currentThread().getContextClassLoader();
>>   }
>> }
>>
>> We got it. If you can send a working jar of openejb-ejb I will be grateful
>>
>>
>> Sami
>>
>> 2008/8/7 Sami Jaber <sami.jaber@gmail.com>
>>
>>  Damned, here is my stacktrace
>>>
>>> Starting Main ...
>>> Debug of initialContext
>>>
>>> {java.naming.factory.initial=org.apache.openejb.client.RemoteInitialContextFactory,
>>> java.naming.security.principal=USERNAME,
>>> openejb.home=W:\dev_tools\openejb-3.0,
>>> openejb.embedded.remotable=true, local-copy=false,
>>> openejb.server.debug=true, openejb.deployments.classpath.ear=true,
>>> openejb.configuration=W:\dev_tools\openejb-3.0\conf\openejb.xml,
>>> openejb.loader=embed, java.naming.security.credentials=PASS}
>>>
>>> javax.ejb.EJBException: Container has suffered a SystemException
>>>   at
>>>
>>> org.apache.openejb.client.EJBObjectHandler._invoke(EJBObjectHandler.java:173)
>>>   at
>>>
>>> org.apache.openejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:117)
>>>   at
>>>
>>> org.apache.openejb.client.proxy.Jdk13InvocationHandler.invoke(Jdk13InvocationHandler.java:52)
>>>   at $Proxy0.call(Unknown Source)
>>>   at fr.aeag.redevances.presentation.Main.main(Main.java:45)
>>> Caused by: java.rmi.RemoteException: The server has encountered a fatal
>>> error: Error caught during request processing
>>> java.lang.ClassNotFoundException: boolean; nested exception is:
>>>   java.lang.ClassNotFoundException: boolean
>>>   at
>>>
>>> org.apache.openejb.server.ejbd.EjbRequestHandler.replyWithFatalError(EjbRequestHandler.java:425)
>>>   at
>>>
>>> org.apache.openejb.server.ejbd.EjbRequestHandler.processRequest(EjbRequestHandler.java:103)
>>>   at
>>>
>>> org.apache.openejb.server.ejbd.EjbDaemon.processEjbRequest(EjbDaemon.java:164)
>>>   at org.apache.openejb.server.ejbd.EjbDaemon.service(EjbDaemon.java:122)
>>>   at org.apache.openejb.server.ejbd.EjbDaemon.service(EjbDaemon.java:84)
>>>   at org.apache.openejb.server.ejbd.EjbServer.service(EjbServer.java:60)
>>>   at org.apache.openejb.server.ServicePool$2.run(ServicePool.java:78)
>>>   at org.apache.openejb.server.ServicePool$3.run(ServicePool.java:101)
>>>   at
>>>
>>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
>>>   at
>>>
>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
>>>   at java.lang.Thread.run(Thread.java:619)
>>> Caused by: java.lang.ClassNotFoundException: boolean
>>>   at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
>>>   at java.security.AccessController.doPrivileged(Native Method)
>>>   at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
>>>   at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
>>>   at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
>>>   at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
>>>   at java.lang.Class.forName0(Native Method)
>>>   at java.lang.Class.forName(Class.java:247)
>>>   at
>>>
>>> org.apache.openejb.client.EjbObjectInputStream.resolveClass(EjbObjectInputStream.java:35)
>>>   at
>>> java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1575)
>>>   at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496)
>>>   at java.io.ObjectInputStream.readClass(ObjectInputStream.java:1462)
>>>   at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1312)
>>>   at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
>>>   at
>>>
>>> org.apache.openejb.client.EJBRequest$Body.readMethodParameters(EJBRequest.java:386)
>>>   at
>>>
>>> org.apache.openejb.client.EJBRequest$Body.readExternal(EJBRequest.java:200)
>>>   at
>>>
>>> org.apache.openejb.server.ejbd.EjbRequestHandler.processRequest(EjbRequestHandler.java:101)
>>>   ... 9 more
>>>
>>> Your test case works obviously over LocalInitialContext.
>>> Does it mean it is a regression ?
>>>
>>>
>>> Sami
>>>
>>>
>>> 2008/8/7 David Blevins <david.blevins@visi.com>
>>>
>>>
>>>  On Aug 6, 2008, at 2:33 PM, Sami Jaber wrote:
>>>>
>>>> Well David, I have the bits you sent me (kindly) yesterday by mail when
>>>> I
>>>>
>>>>> asked you for a "patched" version of 3.0 supporting
>>>>> deployments.classpath.ear.
>>>>> (http://people.apache.org/~dblevins/openejb-3.1-r683137.tar.gz<http://people.apache.org/%7Edblevins/openejb-3.1-r683137.tar.gz>
>>>>> <http://people.apache.org/%7Edblevins/openejb-3.1-r683137.tar.gz>
>>>>>
>>>>> )
>>>>> Do you think that I could get a patched version of the patched version
>>>>> that
>>>>> correct this bug ?
>>>>> I pay you a beer to thank you ;-)
>>>>>
>>>>>
>>>> It should contain that bug fix.  Hmmm...
>>>>
>>>> Give a bean like this a try over the RemoteInitialContextFactory, if it
>>>> works, then the explanation given in
>>>> https://jira.jboss.org/jira/browse/EJBTHREE-440 cannot be accurate.
>>>>
>>>>  @Stateless
>>>>  public class TesterBean implements Tester {
>>>>      public Object call(Object object) {
>>>>          return object;
>>>>      }
>>>>  }
>>>>
>>>>  public interface Tester {
>>>>      public Object call(Object object);
>>>>  }
>>>>
>>>> Then in your client code make these calls:
>>>>
>>>> tester.call(boolean.class);
>>>> tester.call(byte.class);
>>>> tester.call(char.class);
>>>> tester.call(short.class);
>>>> tester.call(int.class);
>>>> tester.call(long.class);
>>>> tester.call(float.class);
>>>> tester.call(double.class);
>>>>
>>>> -David
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>> 2008/8/6 David Blevins <david.blevins@visi.com>
>>>>>
>>>>> On Aug 6, 2008, at 10:28 AM, Dain Sundstrom wrote:
>>>>>
>>>>>>
>>>>>> I believe this this the JIRA for the issue:
>>>>>>
>>>>>>
>>>>>>> https://jira.jboss.org/jira/browse/EJBTHREE-440
>>>>>>>
>>>>>>> It appears that Hibernate requires a custom ObjectInputStream
to work
>>>>>>> properly.  They claim the root cause is this VM bug:
>>>>>>>
>>>>>>> http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4171142
>>>>>>>
>>>>>>> It seems strange that is could be the cause of the bug.
>>>>>>>
>>>>>>> David, what do you think?
>>>>>>>
>>>>>>>
>>>>>>>  We did have that bug in 3.0 final.  It's since been fixed:
>>>>>>
>>>>>> http://issues.apache.org/jira/browse/OPENEJB-832
>>>>>> http://svn.apache.org/viewvc?view=rev&revision=672429  (the fix)
>>>>>> http://svn.apache.org/viewvc?view=rev&revision=672444  (the tests)
>>>>>>
>>>>>> Sami, what version of the openejb-client.jar are you using?
>>>>>>
>>>>>> -David
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Aug 6, 2008, at 9:53 AM, Sami Jaber wrote:
>>>>>>
>>>>>>
>>>>>>> Hi all,
>>>>>>>
>>>>>>>
>>>>>>>> I try to get the couple JPA(Hibernate) and OpenEJB works
with an
>>>>>>>> application
>>>>>>>> that uses lazy fields in Pojo.
>>>>>>>> My application is pretty simple, I have an inheritance and
some lazy
>>>>>>>> fields
>>>>>>>> are declared FetchMode.LAZY.
>>>>>>>>
>>>>>>>> When I run a client remotely, i get the same error before
any call :
>>>>>>>>
>>>>>>>>
>>>>>>>> javax.ejb.EJBException: Unknown Container Exception:
>>>>>>>> java.rmi.RemoteException: Error reading response from server
>>>>>>>> (OEJP/3.0) :
>>>>>>>> cannot assign instance of
>>>>>>>> org.hibernate.proxy.pojo.javassist.SerializableProxy to field
>>>>>>>> mypackage.Pojo.controleur of type mypackage.domain.user.User
in
>>>>>>>> instance
>>>>>>>> of
>>>>>>>> mypackage.OtherPojo; nested exception is:
>>>>>>>> java.lang.ClassCastException: cannot assign instance of
>>>>>>>> org.hibernate.proxy.pojo.javassist.SerializableProxy to field
>>>>>>>> mypackage.Pojo.controleur of type mypackage.domain.user.User
in
>>>>>>>> instance
>>>>>>>> of
>>>>>>>> mypackage.OtherPojo
>>>>>>>>
>>>>>>>> OtherPojo inherits from Pojo. With all kind of combination
>>>>>>>> (remotable=true,
>>>>>>>> local-copy/true or false, ....), switching to cglib<->javaassist,
 I
>>>>>>>> get
>>>>>>>> desperately the same exception. Note that with LocalInitialContext,
>>>>>>>> all
>>>>>>>> works perfectly. As soon as I run cross JVM calls thru
>>>>>>>> RemoteInitialContext,
>>>>>>>> it hangs.
>>>>>>>>
>>>>>>>> My problem is very close to this issue :
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> http://www.jboss.com/index.html?module=bb&op=viewtopic&t=76737&postdays=0&postorder=asc&start=0
>>>>>>>>
>>>>>>>> any clue? this is very frustrating ...
>>>>>>>>
>>>>>>>> Or, if anybody can provide me with a test case that makes
OpenEJB
>>>>>>>> and
>>>>>>>> Hibernate work with lazy fields, i would really appreciate
>>>>>>>>
>>>>>>>>
>>>>>>>> Sami
>>>>>>>>
>>>>>>>> ps : here is my server stacktrace when the error raises
>>>>>>>>
>>>>>>>> 2008-08-06 18:39:02,975 - FATAL - Couldn't write EjbResponse
to
>>>>>>>> output
>>>>>>>> stream
>>>>>>>> java.net.SocketException: Software caused connection abort:
socket
>>>>>>>> write
>>>>>>>> error
>>>>>>>>  at java.net.SocketOutputStream.socketWrite0(Native Method)
>>>>>>>>  at
>>>>>>>> java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
>>>>>>>>  at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
>>>>>>>>  at
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> java.io.ObjectOutputStream$BlockDataOutputStream.drain(ObjectOutputStream.java:1838)
>>>>>>>>  at
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> java.io.ObjectOutputStream$BlockDataOutputStream.setBlockDataMode(ObjectOutputStream.java:1747)
>>>>>>>>  at
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> java.io.ObjectOutputStream.writeNonProxyDesc(ObjectOutputStream.java:1249)
>>>>>>>>  at
>>>>>>>>
>>>>>>>>
>>>>>>>> java.io.ObjectOutputStream.writeClassDesc(ObjectOutputStream.java:1203)
>>>>>>>>  at
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1387)
>>>>>>>>  at
>>>>>>>>
>>>>>>>> java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
>>>>>>>>  at
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> java.io.ObjectOutputStream.writeFatalException(ObjectOutputStream.java:1538)
>>>>>>>>  at
>>>>>>>> java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:329)
>>>>>>>>  at
>>>>>>>>
>>>>>>>>
>>>>>>>> org.apache.openejb.client.EJBResponse.writeExternal(EJBResponse.java:133)
>>>>>>>>  at
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> org.apache.openejb.server.ejbd.EjbRequestHandler.processRequest(EjbRequestHandler.java:215)
>>>>>>>>  at
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> org.apache.openejb.server.ejbd.EjbDaemon.processEjbRequest(EjbDaemon.java:164)
>>>>>>>>  at
>>>>>>>> org.apache.openejb.server.ejbd.EjbDaemon.service(EjbDaemon.java:122)
>>>>>>>>  at
>>>>>>>> org.apache.openejb.server.ejbd.EjbDaemon.service(EjbDaemon.java:84)
>>>>>>>>  at
>>>>>>>> org.apache.openejb.server.ejbd.EjbServer.service(EjbServer.java:60)
>>>>>>>>  at org.apache.openejb.server.ServicePool$2.run(ServicePool.java:78)
>>>>>>>>  at
>>>>>>>> org.apache.openejb.server.ServicePool$3.run(ServicePool.java:101)
>>>>>>>>  at
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
>>>>>>>>  at
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
>>>>>>>>  at java.lang.Thread.run(Thread.java:619)
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>
>>>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message