-->
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.  [ 12 posts ] 
Author Message
 Post subject: c3p0 problemon websphere
PostPosted: Thu Oct 12, 2006 10:54 am 
Newbie

Joined: Fri Sep 02, 2005 10:21 am
Posts: 11
Location: Fribourg, SWITZERLAND
Hibernate version: 3.1.3
Websphere version: 6.1
Oracle version: 8.1.7

Hello,

I have a problem with c3p0 on Websphere 6.1.
My webapp works on Tomcat but when I start my webapp on Websphere I have this error message:

Code:
java.lang.VerifyError: class loading constraint violated (class: com/mchange/v2/c3p0/impl/NewProxyDatabaseMetaData method: attach(Lcom/mchange/v2/c3p0/impl/NewPooledConnection;)V) at pc: 0
...
at com.mchange.v2.c3p0.impl.NewProxyConnection.getMetaData(NewProxyConnection.java:575)


my c3p0 config:
Quote:
<property name="c3p0.acquire_increment">1</property>
<property name="c3p0.min_size">1</property>
<property name="c3p0.max_size">50</property>
<property name="c3p0.timeout">1800</property>
<property name="c3p0.max_statements">50</property>
<property name="c3p0.idle_test_period">0</property>


Without c3p0 my webapp works on Websphere and Tomcat.

Any idea?

Kind regards
Cedric


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 12, 2006 5:43 pm 
C3P0 Developer
C3P0 Developer

Joined: Tue Jan 06, 2004 8:58 pm
Posts: 145
Hmmm. This sort of thing is hard to debug, but here are some thoughts.

1) Do an exhaustive search of any part of your filesystem that might somehow get into the effective classpath of an websphere application or component, and make sure there is no more than 1 c3p0-*.jar file anywhere (this includes jars that might be wrapped in wars or ears!);

2) Make sure that your application components are all properly cleaned up when you do hot restarts of your application. Are any c3p0 DataSources being properly closed and cleaned up on a hot restart?

3) Try upgrading to the latest version of c3p0. There was an issue where under some circumstances, c3p0 would hold a static reference to a ClassLoader, preventing the ClassLoaders from being garbage collected. This is resolved in the latest c3p0-0.9.1-* builds. There might be some kind of issue where the appserver is trying to reload c3p0, but that somehow conflicts with a stale version already loaded.

Note that several of these suggestions are about reloading c3p0. If you shut down WebSphere entirely, so that no WS JVMs are running at all, and then start up your app, do you see this error initially, or only after some time, or an app change and redeployment?

Also, when you see the error, try to get a dump of JVM stack traces, and see if any c3p0-related threads (look for com.mchange in the stack traces) are running. This might indicate live threads are keeping a previous classloader's c3p0 around, while you're trying to load a new one.

Others have reported this sort of issue involving WS and ant: [ http://www-128.ibm.com/developerworks/forums/dw_thread.jsp?forum=275&thread=31014&cat=9 ]

Good luck!

Steve


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 17, 2006 1:45 am 
Newbie

Joined: Fri Sep 02, 2005 10:21 am
Posts: 11
Location: Fribourg, SWITZERLAND
Hello,

I try with the latest version of c3p0. My webapp doesn't works.

But my c3p0 DataSources are not properly closed...
I use:
Code:
sessionFactory.close();


Should I do something else?

Cedric


Top
 Profile  
 
 Post subject: Solved?
PostPosted: Wed Jan 16, 2008 8:33 am 
Newbie

Joined: Wed Jan 16, 2008 8:04 am
Posts: 7
baudet, any resolution about it?
I'm experiencing the same problem...


Top
 Profile  
 
 Post subject: Solved?
PostPosted: Wed Jan 16, 2008 8:33 am 
Newbie

Joined: Wed Jan 16, 2008 8:04 am
Posts: 7
baudet, any resolution about it?
I'm experiencing the same problem...


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 16, 2008 8:55 am 
Newbie

Joined: Fri Sep 02, 2005 10:21 am
Posts: 11
Location: Fribourg, SWITZERLAND
Hi,

No...
I use now the websphere connection pool.

Regards


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 16, 2008 9:14 am 
Newbie

Joined: Wed Jan 16, 2008 8:04 am
Posts: 7
Can you help me on how to migrate it to connection pool?
Thanks


Top
 Profile  
 
 Post subject: C3P0 and WAS 6.1
PostPosted: Mon May 05, 2008 9:00 am 
Beginner
Beginner

Joined: Wed Aug 09, 2006 12:09 pm
Posts: 20
Location: Belgium
I have the same problem, using Websphere 6.1
I just tried updating to the latest C3p0: 0.9.1.2 but I am still receiving this error:

Code:
class loading constraint violated (class: com/mchange/v2/c3p0/impl/NewProxyDatabaseMetaData method


I found this from another forum, that was pointing to this one:


Quote:
Came across this issue entry searching for a solution to C3P0 not running in WS6.1!

From what I've discovered elsewhere and looking at the C3P0 source is that WS6.1 (which uses IBM's Java5 VM) byte code verifier does not like NewProxyDatabaseMetaData. This class is dynamically created during build time, so I suspect the code generate they use is doing something fishy.

We've worked around this in development by using WS6.1 VM parameter -Xverify:none


But that does not help really. I guess it is down to WAS but I have no way around this I have to use this version of WAS. I have tried using the WAS datasource and this works fine for normal use but not when connecting via an IBM extension interface.

Guess I will just need to look into an alternative which might help, such as DBCP/Proxool.

So is there really no way to get C3P0 and WAS 6.1 working together?

Thanks for reading.

cheers
Martin


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 15, 2008 11:14 am 
Newbie

Joined: Thu May 15, 2008 11:05 am
Posts: 1
I solved the VerifyError by moving the c3p0 jar files outside my application. So I copied the c3p0 jar files under the lib directory of Websphere and removed them from my deployed applications.

This way I don't have to use websphere datasource.


Top
 Profile  
 
 Post subject: Websphere 61 and C3P0
PostPosted: Fri May 16, 2008 9:49 am 
Beginner
Beginner

Joined: Wed Aug 09, 2006 12:09 pm
Posts: 20
Location: Belgium
thanks for the reply danielfarid

I had already tried this (with C3P0 and wit Proxool) and I had no joy.
But now I am storing the sessions in the JNDI and looking up the same session from there, now it works with the c3P0 jar in the LIB.

It was both actions, putting the session into the JNDI of the server and the lib location.


Top
 Profile  
 
 Post subject: same problem for me
PostPosted: Wed Feb 11, 2009 6:04 am 
Newbie

Joined: Wed Apr 02, 2008 3:42 pm
Posts: 2
The same problem happens for me, my configuration is the following:

Hibernate 3.1.3
c3p0-0.9.1
Webpshere 6.1 (same problem appears on Websphere 6.1.0.17)
SQLServer 2000


I encountered the problem few months ago and solved it with the use of a datasource. But it is only a workaround for me, and the big question is "is c3p0 working with websphere? "
The workaround cannot be applied within a product which targets a lot of diffrent databases.

The problem exists at the time we restart the application (not the server). The first start of the application is OK. When we restart the server, this is OK.

is it a pure websphere problem, or is there a real solution (planned or not in the c3p0 release plan) ?


here is the full stack trace

2009-02-10 11:59:42 AM - CRITICAL:MYMACHINE:HibernateManager:Initial SessionFactory creation failed : class loading constraint violated (class: com/mchange/v2/c3p0/impl/NewProxyDatabaseMetaData method: attach(Lcom/mchange/v2/c3p0/impl/NewPooledConnection;)V) at pc: 0
:
Exception reason: class loading constraint violated (class: com/mchange/v2/c3p0/impl/NewProxyDatabaseMetaData method: attach(Lcom/mchange/v2/c3p0/impl/NewPooledConnection;)V) at pc: 0
Stack Trace: java.lang.VerifyError: class loading constraint violated (class: com/mchange/v2/c3p0/impl/NewProxyDatabaseMetaData method: attach(Lcom/mchange/v2/c3p0/impl/NewPooledConnection;)V) at pc: 0
at java.lang.J9VMInternals.verifyImpl(Native Method)
at java.lang.J9VMInternals.verify(J9VMInternals.java:59)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:120)
at com.mchange.v2.c3p0.impl.NewProxyConnection.getMetaData(NewProxyConnection.java:675)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:113)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2101)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1325)
at com.mycompany.myproduct.database.manager.impl.HibernateManagerImpl.initialize(HibernateManagerImpl.java:82)
at com.mycompany.myproduct.database.manager.impl.HibernateManagerImpl.initialize(HibernateManagerImpl.java:72)
at com.mycompany.myproduct.database.manager.impl.HibernateConfigurationHolder.<init>(HibernateConfigurationHolder.java:33)
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1263)
at com.mycompany.myproduct.core.myproduct.instantiateObject(myproduct.java:428)
at com.mycompany.myproduct.core.myproduct.instantiateObject(myproduct.java:408)
at com.mycompany.myproduct.core.myproduct.createObject(myproduct.java:384)
at com.mycompany.myproduct.core.AutocreatedObject.createObject(AutocreatedObject.java:217)
at com.mycompany.myproduct.core.AutocreatedObject.createObject(AutocreatedObject.java:203)
at com.mycompany.myproduct.core.AutocreatedObjectList.createObjects(AutocreatedObjectList.java:92)
at com.mycompany.myproduct.core.myproduct.init_objects(myproduct.java:311)
at com.mycompany.myproduct.core.ServiceInitializer.init(ServiceInitializer.java:27)
at com.mycompany.myproduct.servlets.listeners.LifecycleServletContextListener.contextInitialized(LifecycleServletContextListener.java:30)
at com.ibm.ws.wswebcontainer.webapp.WebApp.notifyServletContextCreated(WebApp.java:605)
at com.ibm.ws.webcontainer.webapp.WebApp.commonInitializationFinish(WebApp.java:265)
at com.ibm.ws.wswebcontainer.webapp.WebApp.initialize(WebApp.java:271)
at com.ibm.ws.wswebcontainer.webapp.WebGroup.addWebApplication(WebGroup.java:88)
at com.ibm.ws.wswebcontainer.VirtualHost.addWebApplication(VirtualHost.java:157)
at com.ibm.ws.wswebcontainer.WebContainer.addWebApp(WebContainer.java:653)
at com.ibm.ws.wswebcontainer.WebContainer.addWebApplication(WebContainer.java:606)
at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:333)
at com.ibm.ws.webcontainer.component.WebContainerImpl.start(WebContainerImpl.java:549)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:1295)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:1129)
at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:567)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:814)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:948)
at com.ibm.ws.runtime.component.ApplicationMgrImpl$1.run(ApplicationMgrImpl.java:1478)
at com.ibm.ws.security.auth.ContextManagerImpl.runAs(ContextManagerImpl.java:3731)
at com.ibm.ws.security.auth.ContextManagerImpl.runAsSystem(ContextManagerImpl.java:3813)
at com.ibm.ws.security.core.SecurityContext.runAsSystem(SecurityContext.java:245)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:1483)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:615)
at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:62)
at sun.reflect.GeneratedMethodAccessor22.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:615)
at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:265)
at javax.management.modelmbean.RequiredModelMBean.invokeMethod(RequiredModelMBean.java:1089)
at javax.management.modelmbean.RequiredModelMBean.invoke(RequiredModelMBean.java:971)
at com.sun.jmx.mbeanserver.DynamicMetaDataImpl.invoke(DynamicMetaDataImpl.java:231)
at com.sun.jmx.mbeanserver.MetaDataImpl.invoke(MetaDataImpl.java:238)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:833)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:802)
at com.ibm.ws.management.AdminServiceImpl$1.run(AdminServiceImpl.java:1055)
at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:118)
at com.ibm.ws.management.AdminServiceImpl.invoke(AdminServiceImpl.java:948)
at com.ibm.ws.management.commands.AdminServiceCommands$InvokeCmd.execute(AdminServiceCommands.java:251)
at com.ibm.ws.console.core.mbean.MBeanHelper.invoke(MBeanHelper.java:239)
at com.ibm.ws.console.appdeployment.ApplicationDeploymentCollectionAction.execute(ApplicationDeploymentCollectionAction.java:536)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1486)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:528)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:966)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:907)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:118)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:87)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:696)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:641)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:475)
at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:463)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:308)
at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1070)
at org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:273)
at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:455)
at org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:319)
at com.ibm.isclite.container.controller.InformationController.processForwardConfig(InformationController.java:159)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1486)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:528)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:966)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:907)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:145)
at com.ibm.ws.console.core.servlet.WSCUrlFilter.continueStoringTaskState(WSCUrlFilter.java:371)
at com.ibm.ws.console.core.servlet.WSCUrlFilter.doFilter(WSCUrlFilter.java:229)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:130)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:87)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:696)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:641)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:475)
at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:463)
at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:92)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:744)
at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1425)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:92)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:465)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:394)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:274)
at com.ibm.ws.ssl.channel.impl.SSLConnectionLink.determineNextChannel(SSLConnectionLink.java:984)
at com.ibm.ws.ssl.channel.impl.SSLConnectionLink.readyInboundPostHandshake(SSLConnectionLink.java:678)
at com.ibm.ws.ssl.channel.impl.SSLConnectionLink$MyHandshakeCompletedCallback.complete(SSLConnectionLink.java:380)
at com.ibm.ws.ssl.channel.impl.SSLUtils.handleHandshake(SSLUtils.java:801)
at com.ibm.ws.ssl.channel.impl.SSLHandshakeIOCallback.complete(SSLHandshakeIOCallback.java:70)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:152)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:213)
at com.ibm.io.async.AbstractAsyncFuture.fireCompletionActions(AbstractAsyncFuture.java:195)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:193)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:725)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:847)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1498)


Top
 Profile  
 
 Post subject: Re: c3p0 problemon websphere
PostPosted: Thu Sep 02, 2010 4:35 am 
Newbie

Joined: Thu Sep 02, 2010 4:15 am
Posts: 1
Sorry to dig up this old thread.. I've been seeing the same problem and I think I've found the cause - even though I don't 100% understand it yet.

In my setup I've got two EAR's deployed to WebSphere which both reference the same Shared Library containing among other things a reference to the c3p0 jar.

I decompiled the class NewProxyDatabaseMetaData.

The attach() method looks like
Code:
void attach(NewPooledConnection parentPooledConnection)
{
   this.parentPooledConnection = parentPooledConnection;
   parentPooledConnection.addConnectionEventListener(cel);
}

The parentPooledConnection member variable is defined as
Code:
volatile NewPooledConnection parentPooledConnection;

This got me thinking that there could be an issue related to the classloader. My understanding of the volatile keyword is that it works like static except that every thread sees it's own separate instance of the variable. Somehow my two applications are stepping on each others toes in relation to this particular member variable.

So I undeployed one of my applications and it works fine. My next experiment is to maybe set up seperate Shared Libraries for each of the EARs to see if that works.


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

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.