[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2355) CGLIBLazyInitializer can not access a public member if parent class is not public

Andreas Brieg (JIRA) noreply at atlassian.com
Fri May 15 03:34:14 EDT 2009


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2355?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=33180#action_33180 ] 

Andreas Brieg commented on HHH-2355:
------------------------------------

This bug is caused by wrong accessibility checking of Method.invoke of suns VM implementation. See http://bugs.sun.com/view_bug.do?bug_id=4071957 and http://bugs.sun.com/view_bug.do?bug_id=4283544 for more details.

A solution to this problem is to manually check accesibility rules and if this succeeds call setAccessible(true) before calling Method.invoke in method CGLIBLazyInitializer.invoke.

> CGLIBLazyInitializer can not access a public member if parent class is not public
> ---------------------------------------------------------------------------------
>
>                 Key: HHH-2355
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2355
>             Project: Hibernate Core
>          Issue Type: Bug
>    Affects Versions: 3.2.1
>            Reporter: Daniel Beland
>         Attachments: test.tar.gz
>
>
> In hibernate 3.2.1, CGLIBLazyInitializer cannot acces a public method if it has been inherited from a parent class that is not public.
> Let's say we have a class A, modifier = default (package) with a public method getName()  (and setName(String name)). 
> Then I create a public class B that extends A.
> in my code I can retrieve B from the database:
> B b = session.load(B.class, new Integer(1), LockMode.NONE);
> I receive b with all the values set correctly (So at this point, Hibernate was able to use the method setName() correctly).
> In my code if I then try to use b.getName(), I receive and error:
> java.lang.IllegalAccessException-->Class org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer can not access a member of class A with modifiers "public"
> But I am not trying to access A.getName(), but B.getName() (which is a public method in a public class).
> This was working perfectly with Hibernate 2.1.7c and 3.1.3.
> The full information about my problem can be found here: http://forum.hibernate.org/viewtopic.php?t=969453

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list