[hibernate-dev] Connection proxy error

Max Rydahl Andersen max.andersen at jboss.com
Mon Nov 6 08:27:35 EST 2006


On Mon, 06 Nov 2006 14:11:46 +0100, Steve Ebersole  
<steve.ebersole at jboss.com> wrote:

> Context classloader can be null...

But it should then be done in the classloader that loaded hibernate; not  
the system classpath loader which Connection.class will be.

You don't get this error at your end ?

At least i'm not the only one  
http://opensource.atlassian.com/projects/hibernate/browse/HHH-1629#action_25145    
;)

/max

>
> -----Original Message-----
> From: hibernate-dev-bounces at lists.jboss.org
> [mailto:hibernate-dev-bounces at lists.jboss.org] On Behalf Of Max Rydahl
> Andersen
> Sent: Monday, November 06, 2006 5:54 AM
> To: hibernate-dev at lists.jboss.org
> Subject: [hibernate-dev] Connection proxy error
>
> Hi Steve,
>
> After updating from svn I get the following in alot of tests:
>
> java.lang.IllegalArgumentException: interface
> org.hibernate.jdbc.ConnectionWrapper is not visible from class loader
> 	at java.lang.reflect.Proxy.getProxyClass(Proxy.java:331)
> 	at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:552)
> 	at
> org.hibernate.jdbc.BorrowedConnectionProxy.generateProxy(BorrowedConnect
> ionProxy.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
> org.hibernate.test.connections.AggressiveReleaseTest.testBorrowedConnect
> ions(AggressiveReleaseTest.java:210)
>
> I fixed it by changing:
>
> public static Connection generateProxy(ConnectionManager
> connectionManager) {
> 		BorrowedConnectionProxy handler = new
> BorrowedConnectionProxy( connectionManager );
> 		return ( Connection ) Proxy.newProxyInstance(
> 		        Connection.class.getClassLoader(),
> 		        PROXY_INTERFACES,
> 		        handler
> 		);
> 	}
>
> to
>
> public static Connection generateProxy(ConnectionManager
> connectionManager) {
> 		BorrowedConnectionProxy handler = new
> BorrowedConnectionProxy( connectionManager );
> 		return ( Connection ) Proxy.newProxyInstance(
> 	
> Thread.currentThread().getContextClassLoader(),
> 		        PROXY_INTERFACES,
> 		        handler
> 		);
> 	}
>
> Connection.class is always loaded via the boot/system clasloader so I
> don't get how using its classloader
> when generating the proxy would ever work ?
>



-- 
--
Max Rydahl Andersen
callto://max.rydahl.andersen

Hibernate
max at hibernate.org
http://hibernate.org

JBoss a division of Red Hat
max.andersen at jboss.com




More information about the hibernate-dev mailing list