11 Replies Latest reply on Feb 6, 2009 1:50 PM by toto titi

    c3p0 datasources always marked as 'down'

    toto titi Newbie

      Hello,

      still working with 2.1 GA

      I observed that my deployed datasources, powered by c3p0, are always marked as if they were down (with no activity at all), while the DefaultDS is considered up. I however can access my datasource (an ingres db) through my application.

      Is there a known incompatibility with a c3p0 datasource? if so, any workaround? I can post the ds code if needed.

      cheers

        • 1. Re: c3p0 datasources always marked as 'down'
          mazz Master

          Definitely post the -ds.xml code here.

          • 2. Re: c3p0 datasources always marked as 'down'
            toto titi Newbie

            Here you are :

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



            xxxDatasource
            jdbc:edbc://xxx;CURSOR=READONLY
            ca.edbc.jdbc.EdbcDriver
            xxx
            xxx

            <!-- c3p0-specific configuration -->
            <!-- http://www.mchange.com/projects/c3p0/index.html#configuration_properties -->

            3
            5
            5000
            true

            false
            20000


            xxx DEV pooled c3p0 DataSource
            true

            false
            3600
            3
            0
            0
            7200
            300
            5
            0
            100
            3
            3

            false
            false
            600
            false



            The file itself is called "xxx-c3p0-service.xml", xxx being the webapp's name.


            When I execute a 'Flush' operation on this datasource, it fails with a link to the following stack trace:

            java.lang.NullPointerException
            at org.rhq.plugins.jmx.MBeanResourceComponent.invokeOperation(MBeanResourceComponent.java:417)
            at org.rhq.plugins.jbossas.DatasourceComponent.invokeOperation(DatasourceComponent.java:118)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:585)
            at org.rhq.core.pc.inventory.ResourceContainer$ComponentInvocationThread.call(ResourceContainer.java:450)
            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:595)

            • 3. Re: c3p0 datasources always marked as 'down'
              toto titi Newbie

              Great, I forgot about this formatting issue on the JBoss forum and the lack of an edit function :\
              Here is the XML description of the datasource:

              <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE server>
              <server>
               <mbean code="com.mchange.v2.c3p0.jboss.C3P0PooledDataSource" name="jboss.jca:name=xxxDatasource,service=DataSourceBinding">
              
               <attribute name="JndiName">xxxDatasource</attribute>
               <attribute name="JdbcUrl">jdbc:edbc://zzzzzz;CURSOR=READONLY</attribute>
               <attribute name="DriverClass">ca.edbc.jdbc.EdbcDriver</attribute>
               <attribute name="User">zzz</attribute>
               <attribute name="Password">zzz</attribute>
              
               <!-- c3p0-specific configuration -->
               <!-- http://www.mchange.com/projects/c3p0/index.html#configuration_properties -->
              
               <attribute name="AcquireIncrement">3</attribute>
               <attribute name="AcquireRetryAttempts">5</attribute>
               <attribute name="AcquireRetryDelay">5000</attribute>
               <attribute name="AutoCommitOnClose">true</attribute>
               <attribute name="AutomaticTestTable"></attribute>
               <attribute name="BreakAfterAcquireFailure">false</attribute>
               <attribute name="CheckoutTimeout">20000</attribute>
               <attribute name="ConnectionCustomizerClassName"></attribute>
               <attribute name="ConnectionTesterClassName"></attribute>
               <attribute name="Description">xxx DEV pooled c3p0 DataSource</attribute>
               <attribute name="DebugUnreturnedConnectionStackTraces">true</attribute>
               <attribute name="FactoryClassLocation"></attribute>
               <attribute name="ForceIgnoreUnresolvedTransactions">false</attribute>
               <attribute name="IdleConnectionTestPeriod">3600</attribute>
               <attribute name="InitialPoolSize">3</attribute>
               <attribute name="MaxAdministrativeTaskTime">0</attribute>
               <attribute name="MaxConnectionAge">0</attribute>
               <attribute name="MaxIdleTime">7200</attribute>
               <attribute name="MaxIdleTimeExcessConnections">300</attribute>
               <attribute name="MaxPoolSize">5</attribute>
               <attribute name="MaxStatements">0</attribute>
               <attribute name="MaxStatementsPerConnection">100</attribute>
               <attribute name="MinPoolSize">3</attribute>
               <attribute name="NumHelperThreads">3</attribute>
               <attribute name="PreferredTestQuery"></attribute>
               <attribute name="TestConnectionOnCheckin">false</attribute>
               <attribute name="TestConnectionOnCheckout">false</attribute>
               <attribute name="UnreturnedConnectionTimeout">600</attribute>
               <attribute name="UsesTraditionalReflectiveProxies">false</attribute>
               </mbean>
              </server>




              And the stacktrace:
              java.lang.NullPointerException
               at org.rhq.plugins.jmx.MBeanResourceComponent.invokeOperation(MBeanResourceComponent.java:417)
               at org.rhq.plugins.jbossas.DatasourceComponent.invokeOperation(DatasourceComponent.java:118)
               at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
               at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
               at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
               at java.lang.reflect.Method.invoke(Method.java:585)
               at org.rhq.core.pc.inventory.ResourceContainer$ComponentInvocationThread.call(ResourceContainer.java:450)
               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:595)
              


              • 4. Re: c3p0 datasources always marked as 'down'
                Heiko Rupp Master

                About this stack trace: does the c3p0 datasource offer a 'flush' operation in jmx console and if so, does this work or throw an error?


                • 5. Re: c3p0 datasources always marked as 'down'
                  mazz Master

                  I'm almost positive the plugin doesn't support managing datasources that are defined in that manner. AFAIK, it can only manage datasources defined in -ds.xml files via the datasources tags - such as this XML:

                  <datasources>
                   ...your local-tx-datasources, xa-datasources, etc. here ...
                  </datasources>


                  I don't have good knowledge of the jboss-as plugin code related to datasource management - perhaps someone else that knows this code can confirm or deny that statement. But if I'm right, it makes sense you are getting errors becaues you are defining the mbean service directly, rather than via the datasources element.

                  • 6. Re: c3p0 datasources always marked as 'down'
                    toto titi Newbie

                     

                    "pilhuhn" wrote:
                    About this stack trace: does the c3p0 datasource offer a 'flush' operation in jmx console and if so, does this work or throw an error?



                    No, there are several management options (see idle/active connections etc) but no flush operation is available.

                    • 7. Re: c3p0 datasources always marked as 'down'
                      Heiko Rupp Master

                      I think the latter explains why you are seeing an error when invoking flush.

                      But you are correct that you should see a nicer, more descriptive message:

                      https://jira.jboss.org/jira/browse/JOPR-58

                      • 8. Re: c3p0 datasources always marked as 'down'
                        toto titi Newbie

                         

                        "mazz" wrote:
                        I'm almost positive the plugin doesn't support managing datasources that are defined in that manner. AFAIK, it can only manage datasources defined in -ds.xml files via the datasources tags - such as this XML:

                        <datasources>
                         ...your local-tx-datasources, xa-datasources, etc. here ...
                        </datasources>


                        I don't have good knowledge of the jboss-as plugin code related to datasource management - perhaps someone else that knows this code can confirm or deny that statement. But if I'm right, it makes sense you are getting errors becaues you are defining the mbean service directly, rather than via the datasources element.


                        Then only native JBoss datasource definitions are monitored by JOPR since this formalism is defined by:

                        http://www.jboss.org/j2ee/dtd/jboss-ds_1_5.dtd


                        I think being forced into a JBoss datasource in order to benefit from JOPR is a serious limitation for this tool, especially when the JMX console provides stats about the datasource's activity.
                        Do you see a way to work around this and get a JOPR monitoring of my c3p0 datasource, or should I fill an enhancement request?

                        • 9. Re: c3p0 datasources always marked as 'down'
                          Heiko Rupp Master

                          I re-read your issue and the NPE you are seeing did not come from the missing flush(), but rather from the fact that the resource is down and thus the ResourceContainer within the agent is not started.
                          Now we have to find out, why the c3p0 ds can not be found.
                          Can you please send me the needed libraries and the *xml file(s) ?

                          • 10. Re: c3p0 datasources always marked as 'down'
                            Heiko Rupp Master

                            The cep0 Datasource is reported as down, because the plugin is looking for an MBean
                            "jboss.jca:name=%NAME%,service=ManagedConnectionPool"
                            which the c3p0 one is not providing.

                            Yes, please open a feature request for this.