I deployed a shared jar file on Tomcat that is to be used by two Spring webapps. The problem is the Exception I receive when trying to access the shared library by the second webapp. The first one already set some properties within the shared class instances.
The Exception: java.lang.IllegalArgumentException: interface org.hibernate.jdbc.ConnectionWrapper is not visible from class loader java.lang.reflect.Proxy.getProxyClass(Proxy.java:353) java.lang.reflect.Proxy.newProxyInstance(Proxy.java:581) org.hibernate.jdbc.BorrowedConnectionProxy.generateProxy(BorrowedConnectionProxy.java:67) org.hibernate.jdbc.ConnectionManager.borrowConnection(ConnectionManager.java:163) org.hibernate.jdbc.JDBCContext.borrowConnection(JDBCContext.java:111) org.hibernate.impl.SessionImpl.connection(SessionImpl.java:359) org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:456) org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:349) org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:259) org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:102) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161) org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:203) $Proxy2.create(Unknown Source) test.TestController.handleRequest(TestController.java:39) org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48) org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:839) org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:774) org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:460) org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:415) javax.servlet.http.HttpServlet.service(HttpServlet.java:690) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) The interface from Hibernate is in the hibernate3.jar file of the first webapp. I tried to do something that seemed to be a workaround. Something to do with the ClassLoaders not being able to see each others classes?! I extended Spring's ContextListeners and replaced the original ones for startup (for both webapps): public class MySpringContextListener extends org.spring....ContextLoaderListener { @Override public void contextInitialized(ServletContextEvent evt) { ClassLoader contextLoader = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); super.contextInitialized(evt); Thread.currentThread().setContextClassLoader(contextLoader); } @Override public void contextDestroyed(ServletContextEvent evt) { ClassLoader contextLoader = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); super.contextDestroyed(evt); evt.getServletContext().removeAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE); Thread.currentThread().setContextClassLoader(contextLoader); } } But the exception remains Can you help me, please? -- View this message in context: http://www.nabble.com/2-webapps-using-shared-jar-%28ClassLoader-problem%29-tf3994120.html#a11342159 Sent from the Tomcat - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]