Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] c3p0 driver switches postgres->mysql on context reload, 9.3.4-SNAPSHOT

I have only the one place for configuring c3p0. The only other .xml I have is web.xml, which doesn't mention c3p0. (There's also a log4j config.)

Maybe c3p0 has a default, but jetty should reinit with the same params it initted with, right?

All I did for c3p0 was copy the jar into lib/ext/ and add the config I gave.


-------- Original message --------
From: Joakim Erdfelt
Date:09/25/2015 2:54 PM (GMT-08:00)
To: JETTY user mailing list
Subject: Re: [jetty-users] c3p0 driver switches postgres->mysql on context reload, 9.3.4-SNAPSHOT

The c3p0 configuration seems to be coming from multiple locations.
Are you also configuring it in your ${jetty.base}/webapps/${context}.xml ?
Is it also being configured from Spring? or Hibernate?
Or c3p0 properties file?
Or c3p0 system properties?




Joakim Erdfelt / joakim@xxxxxxxxxxx

On Fri, Sep 25, 2015 at 2:45 PM, Bill Ross <ross@xxxxxxxxxxxx> wrote:
I am currently "Powered by Jetty:// 9.3.4-SNAPSHOT" updated within the last week or two. It looks like on modifying a web page in ROOT that context reinitializes and this restarts c3p0 with mysql instead of my spec of postgres, and jetty has to be killed/restarted. Gory details follow.


I switched from mysql to postgres, and things worked fine until I got around to removing a mysql-driver.jar I had from somewhere (I thought it had been superseded by mysql-connector-java-5.1.36-bin.jar).

This seems to have uncovered a problem with jetty when a page in ROOT is modified and context is refreshed.

On initialization I have c3p0 following my config:

Sep 25, 2015 2:21:10 PM com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource getPoolManager
INFO: Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 3, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, dataSourceName -> 1hge13a9c1rqmnbcm92m8|6356695f, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> org.postgresql.Driver, <====**** *** ***

Now I edit one of my html pages and it is detected:

2015-09-25 14:23:47.767:INFO:oejsh.ContextHandler:Scanner-0: Stopped o.e.j.w.WebAppContext@15975490{/,null,UNAVAILABLE}{/ROOT}

Servlets claim they initted ok:

14:23:48.011 [Scanner-0] INFO  com.priot.servlet.GetNext - GetNext Init OK
14:23:48.012 [Scanner-0] INFO  com.priot.servlet.GetSession - GetSession Init OK

Back to normal it would seem:

2015-09-25 14:23:48.012:INFO:oejsh.ContextHandler:Scanner-0: Started o.e.j.w.WebAppContext@6c0002ea{/,file:///Users/priot/pr/jetty-base/webapps/ROOT/,AVAILABLE}{/ROOT}

Now I reload the changed page on the browser:

14:29:17.110 [qtp553264065-14] INFO  com.priot.servlet.GetSession - GetSession POST 0:0:0:0:0:0:0:1 | 0:0:0:0:0:0:0:1 | hour=14 | tzoff=420 | lang=en-US | platform=MacIntel | browser=Netscape | version=5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.93 Safari/537.36 | username=zzz
Sep 25, 2015 2:29:17 PM com.mchange.v2.c3p0.DriverManagerDataSource ensureDriverLoaded
WARNING: Could not load driverClass com.mysql.jdbc.Driver
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:264)
        at com.mchange.v2.c3p0.DriverManagerDataSource.ensureDriverLoaded(DriverManagerDataSource.java:100)
        at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:132)
        at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182)
        at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171)
        at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:137)
        at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014)
        at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)
        at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810)
        at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)

And after some of that:

Sep 25, 2015 2:29:17 PM com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource getPoolManager
INFO: Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 3, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, dataSourceName -> 1hge13a9c1rqmnbcm92m8|48b30e5d, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> com.mysql.jdbc.Driver, <=== ** ** **

Why the sudden interest in mysql??? I have to kill/restart jetty at that point.

It seems jetty is reinitializing the pool with the defaults some developer has hard coded.

--- src/main/webapp/WEB-INF/jetty-env.xml

<Configure class="org.eclipse.jetty.webapp.WebAppContext">
  <New id="prDataSource" class="org.eclipse.jetty.plus.jndi.Resource">
   <Arg></Arg>
   <Arg>jdbc/pr</Arg>
   <Arg>
    <New class="com.mchange.v2.c3p0.ComboPooledDataSource">
       <Set name="driverClass">org.postgresql.Driver</Set>
       <Set name="jdbcUrl">jdbc:postgresql:pr</Set>
       <Set name="user">xxx</Set>
       <Set name="password">xxx</Set>
    </New>
   </Arg>
  </New>

</Configure>

Thanks,
Bill

_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users


Back to the top