-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: ConnectionWrapper is not visible from class loader
PostPosted: Sun Jan 06, 2008 11:19 pm 
Beginner
Beginner

Joined: Thu Oct 06, 2005 7:34 pm
Posts: 20
Hibernate version: 3.2.5.ga

I'm working on using Hibernate in a web application that has to deal with cross context dispatching (webapp A dispatching requests to webapp B) and callbacks (during processing in webapp B an API call is made back to webapp A). Many of these callbacks need to do persistence work using Hibernate DAOs.

The interesting bit of the stack trace is:
Code:
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.jpa.vendor.HibernateJpaDialect.getJdbcConnection(HibernateJpaDialect.java:86)
   at org.springframework.orm.jpa.JpaTransactionManager.doBegin(JpaTransactionManager.java:341)
   ... 42 more


Doing some searching it looks like I'm running into this issue: http://opensource.atlassian.com/project ... e/HHH-2281

I see that BorrowedConnectionProxy tries to use the thread context ClassLoader first:
Code:
/**
* Determines the appropriate class loader to which the generated proxy
* should be scoped.
*
* @return The class loader appropriate for proxy construction.
*/
public static ClassLoader getProxyClassLoader() {
    ClassLoader cl = Thread.currentThread().getContextClassLoader();
    if ( cl == null ) {
        cl = BorrowedConnectionProxy.class.getClassLoader();
    }
    return cl;
}


Is there any way to get Hibernate to use BorrowedConnectionProxy.class.getClassLoader() first instead?

-Eric


Full stack trace for those interested:
Code:
org.jasig.portal.channels.portlet.PortletDispatchException: The portlet window 'PortletWindowImpl[portletWindowId=1.u14l1n10]'
   at org.jasig.portal.channels.portlet.SpringPortletChannelImpl.render(SpringPortletChannelImpl.java:418)
   at org.jasig.portal.channels.portlet.CSpringPortletAdaptor.renderCharacters(CSpringPortletAdaptor.java:182)
   at org.jasig.portal.ChannelRenderer$Worker.execute(ChannelRenderer.java:545)
   at org.jasig.portal.utils.threading.BaseTask.run(BaseTask.java:27)
   at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:417)
   at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269)
   at java.util.concurrent.FutureTask.run(FutureTask.java:123)
   at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
   at java.lang.Thread.run(Thread.java:613)
Caused by: javax.portlet.PortletException: Request processing failed
   at org.springframework.web.portlet.FrameworkPortlet.processRequest(FrameworkPortlet.java:474)
   at org.springframework.web.portlet.FrameworkPortlet.doDispatch(FrameworkPortlet.java:431)
   at javax.portlet.GenericPortlet.render(GenericPortlet.java:175)
   at org.apache.pluto.core.PortletServlet.dispatch(PortletServlet.java:208)
   at org.apache.pluto.core.PortletServlet.doGet(PortletServlet.java:139)
Caused by: org.springframework.transaction.CannotCreateTransactionException: Could not open JPA EntityManager for transaction; nested exception is java.lang.IllegalArgumentException: interface org.hibernate.jdbc.ConnectionWrapper is not visible from class loader
   at org.springframework.orm.jpa.JpaTransactionManager.doBegin(JpaTransactionManager.java:379)
   at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:350)
   at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:261)
   at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:101)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
   at $Proxy35.getPortletEntity(Unknown Source)
   at org.jasig.portal.portlet.registry.PortletEntityRegistryImpl.getPortletEntity(PortletEntityRegistryImpl.java:81)
   at org.jasig.portal.portlet.registry.PortletWindowRegistryImpl.getParentPortletEntity(PortletWindowRegistryImpl.java:186)
   at org.jasig.portal.portlet.container.services.PortletPreferencesServiceImpl.getStoredPreferences(PortletPreferencesServiceImpl.java:102)
   at org.apache.pluto.internal.impl.PortletPreferencesImpl.<init>(PortletPreferencesImpl.java:125)
   at org.apache.pluto.internal.impl.RenderRequestImpl.getPreferences(RenderRequestImpl.java:85)
   at edu.wisc.my.portlets.bookmarks.web.support.PortletPreferencesBookmarkSetNameResolver.getBookmarkSetName(PortletPreferencesBookmarkSetNameResolver.java:74)
   at edu.wisc.my.portlets.bookmarks.web.support.BookmarkSetRequestResolver.getBookmarkSet(BookmarkSetRequestResolver.java:124)
   at edu.wisc.my.portlets.bookmarks.web.ViewBookmarksController.handleRenderRequestInternal(ViewBookmarksController.java:108)
   at org.springframework.web.portlet.mvc.AbstractController.handleRenderRequest(AbstractController.java:223)
   at org.springframework.web.portlet.mvc.SimpleControllerHandlerAdapter.handleRender(SimpleControllerHandlerAdapter.java:52)
   at org.springframework.web.portlet.DispatcherPortlet.doRenderService(DispatcherPortlet.java:788)
   at org.springframework.web.portlet.FrameworkPortlet.processRequest(FrameworkPortlet.java:461)
   ... 24 more
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.jpa.vendor.HibernateJpaDialect.getJdbcConnection(HibernateJpaDialect.java:86)
   at org.springframework.orm.jpa.JpaTransactionManager.doBegin(JpaTransactionManager.java:341)
   ... 42 more


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.