7 Replies Latest reply on Mar 21, 2013 3:50 PM by smarlow

    Problems getting c3p0 up and running for AS7

    evanmc

      I would certainly appreciate it if someone could point me in the right direction, as I've been fumbling about tring to get this up and running without success.

       

      Sections of the documentation seem to stat that c3p0 is part of the AS7 distribution, but I can't seem to find it, so I obtained hibernate-c3p0-4.0.1.Final.jar from maven.

       

      Is c3p0 part of the distribution and I've just managed to overlook it?

       

      I have an existing deployment using postgres 9.1 that is running just fine, but I would like to move to pooling as we are using an absurd number of DB connections.

       

      - If I add hibernate.c3p0.* properties to my existing persistence.xml file, my server will not init, reporting this error:

       

       

      JBAS014777: Services which failed to start: service jboss.deployment.unit."epicenter.ear".PARSE:

      org.jboss.msc.service.StartException

       

      - If I add set the connection provider to c3p0 in this file like so, I get a "Could not load requested class: or.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider"

       

      <property name="hibernate.connection.provider_class"

      value="org.hibernate.connection.C3P0ConnectionProvider" />

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

      Is there a guide that will show me how to carry this out for AS7?
      Thanks,
      -Evan-
       

       

       

      <?xml version="1.0" encoding="UTF-8"?>

      <persistence xmlns="http://java.sun.com/xml/ns/persistence"

      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

      xsi:schemaLocation="http://java.sun.com/xml/ns/persistence

      http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"

      version="2.0">

      <persistence-unit name="EPICenter">

      <jta-data-source>java:/PostgresDS</jta-data-source>

      <!-- Scan the following jars for entities to persist. -->

      <jar-file>epicenter.ear/common-epicenter.jar</jar-file>

      <jar-file>epicenter.ear/common-server.jar</jar-file>

      <properties>

      <property name="hibernate.archive.autodetection"

      value="class, hbm" />

      <property name="hibernate.dialect"

      value="org.hibernate.dialect.PostgreSQLDialect" />

      <property name="hibernate.connection.datasource"

      value="java:/PostgresDS" />

      <property name="hibernate.connection.provider_class"

      value="org.hibernate.connection.C3P0ConnectionProvider" />

      <!--

      <property name="hibernate.c3p0.min_size" value="5" >

      <property name="hibernate.c3p0.max_size" value="20 >

      -->

      <property name="hibernate.max_fetch_depth" value="3" />

      <property name="hibernate.default_schema" value="public" />

      <!-- <property name="hibernate.default_schema" value="Chomolungma" /> -->

      <!-- Disable the second-level cache

      <property name="cache.provider_class" value="org.hibernate.cache.internal.NoCacheProvider"/>

      -->

      <property name="hibernate.cache.use_second_level_cache"

      value="true" />

      <property name="hibernate.cache.infinispan.statistics" value="false"/>

      <property name="hibernate.show_sql" value="false" />

      <property name="hibernate.format_sql" value="true" />

      <property name="javax.persistence.validation.mode" value="none"/>

      </properties>

      <validation-mode>NONE</validation-mode>

      <shared-cache-mode>ENABLE_SELECTIVE</shared-cache-mode>

      </persistence-unit>

      </persistence>