[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-3529) ConnectionWrapper is not visible from class loader

Vladimir Kralik (JIRA) noreply at atlassian.com
Wed Aug 12 08:18:15 EDT 2009


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

Vladimir Kralik commented on HHH-3529:
--------------------------------------

> How to use this pathc? appreciate if some can can share the steps.. 
Download source code for hibernate.
Then 
    mkdir hibernate-src/
    cd hibernate-src/
    tar xvfz hibernate-src-X.Y.Z.tar.gz
    cd hiber*
    patch -p1<hibernate-3.2.6_p2.patch
A now you can build hibernate library.

That patch contains change only in one class, so you can change it directly in Eclipse ( or another IDE )
First you have to setup hibernate project in Eclipse.
Then you find class BorrowedConnectionProxy, rid off all lines in patch which starts with dash(-) and instead that lines put there line marked with plus (+), so the result will be

 	public static ClassLoader getProxyClassLoader() {
		return BorrowedConnectionProxy.class.getClassLoader();
 	}

After compilation you should replace BorrowedConnectionProxy.class in orinal hibernate-X.Y.Z.jar.


> ConnectionWrapper is not visible from class loader 
> ---------------------------------------------------
>
>                 Key: HHH-3529
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3529
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.2.6, 3.3.1
>         Environment: SpringFramework 2.5.5, Hibernate 3.2.6 / 3.3.1, Tomcat 5.5, CommonJ Timer ( http://www.myfoo.de/commonj/ )
>            Reporter: Vladimir Kralik
>         Attachments: hibernate-3.2.6_p2.patch
>
>
> Hibernate/Spring libraries are in app.war/WEB-INF/lib.
> Timer is configured as resources in Tomcat and his libraries are in $CATALINA_HOME/common/lib/.
> Function call from GUI works, but the same function called by timers gives this exception :
> org.springframework.transaction.CannotCreateTransactionException: Could not openHibernate Session for transaction; nested exception is java.lang.IllegalArgumentException:
>   interface org.hibernate.jdbc.ConnectionWrapper is not visible from class loader
>         at org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:599)
> ....
> Caused by: 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:67)
>         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 org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:510)
> It's the same bug as was in HHH-2215, but this is not resolved.
> I think, that the problem is extracting classloader from currentThread(). This is always not null, so the next test in method getProxyClassLoader() is always false.  
> I my case, timer thread lives in top class loader, but hibernate libraries are inside application class loader.
> Attached patch removes classloader extracting  from currentThread(). It works for my case.

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