[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2281) CLONE -Calling Session.connection() generates java.lang.IllegalArgumentException: interface org.hibernate.jdbc.ConnectionWrapper is not visible from class loader

Fabio Da Soghe (JIRA) noreply at atlassian.com
Fri Mar 9 05:47:14 EST 2007


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2281?page=comments#action_26410 ] 

Fabio Da Soghe commented on HHH-2281:
-------------------------------------

Maybe it can help another confirm: I get this problem developing an Eclipse RCP plugin (RCP 3.2, HIbernate 3.2.1.ga).
With Eclipse RCP there is a notable issue regarding classloading and Hibernate (as you surely know), resolved by the Buddy Loading mechanism.
But the error described here seems different and I wasn't able to resolve it with any Buddy Loading solution (I did several tries). Indeed I was confident I didn't need the Buddy Loading, since I have only one RCP plugin with all classes into it (Hibernate library and user client classes).
I got my application running without this exception by returning to Hibernate 3.2.0. No need of Buddy Loading neither any other workaround: the plain plugin configuration works well.

If needed, I can supply other details (source code, plugin and runtime configuration, etc).

Best Regards,

Fabio

> CLONE -Calling Session.connection() generates java.lang.IllegalArgumentException: interface org.hibernate.jdbc.ConnectionWrapper is not visible from class loader
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>          Key: HHH-2281
>          URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2281
>      Project: Hibernate3
>         Type: Bug

>     Versions: 3.2.1
>  Environment: Hibernate checked out from trunk; revision 10717
>     Reporter: Sergey Polzunov

>
>
> Calling Session.connection() always generates an exception. Here is the stacktrace I get from the attached test case:
> Exception in thread "main" java.lang.IllegalArgumentException: interface org.hibernate.jdbc.ConnectionWrapper is not visible from class loader
> 	at java.lang.reflect.Proxy.getProxyClass(Proxy.java:353)
> 	at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:581)
> 	at org.hibernate.jdbc.BorrowedConnectionProxy.generateProxy(BorrowedConnectionProxy.java:56)
> 	at org.hibernate.jdbc.ConnectionManager.borrowConnection(ConnectionManager.java:163)
> 	at org.hibernate.jdbc.JDBCContext.borrowConnection(JDBCContext.java:111)
> 	at org.hibernate.impl.SessionImpl.connection(SessionImpl.java:359)
> 	at TestSession.main(TestSession.java:16)
> Changing the Connection.class.getClassLoader() to BorrowedConnectionProxy.class.getClassLoader() on line 57 in the generateProxy() method solves the problem. I am not very familiar with class loaders so I don't know if this is likeley to cause other problems elsewhere. Removing the ConnectionWrapper.class from the PROXY_INTERFACES array in the org.hibernate.jdbc.BorrowedConnectionProxy also solves the problem, but I guess it was added for a reason.

-- 
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