2 Replies Latest reply on Sep 21, 2009 12:03 PM by Pavel Nemec

    using c3p0 as DefaultDS, can`t force ejb-deployer [EJBTimerS

    Pavel Nemec Newbie

      jboss 4.2.3 GA, java version "1.6.0_15", c3p0-0.9.1.2.jar, linux

      I am trying to use c3p0 as only datasource and I want to get rid of hsqldb-ds and mysql-ds.

      c3p0-service.xml is default

      <server>
       <mbean code="com.mchange.v2.c3p0.jboss.C3P0PooledDataSource"
       name="jboss:service=PooledDS">
       <attribute name="JndiName">PooledDS</attribute>-->
       <attribute name="JdbcUrl">URL</attribute>
       <attribute name="DriverClass">com.mysql.jdbc.Driver</attribute>
       <attribute name="User">USER</attribute>
       <attribute name="Password">PWD</attribute>
       </mbean>
      </server>
      


      I set ejb-deployer.xml - EJBTimerService to depend on this DS by change
      <depends optional-attribute name="DataSorce"> jboss.jca:service=DataSourceBinding,name=DefaultDS </depends>
      

      to
      <depends>jboss.jca:service=DataSourceBinding,name=PooledDS</depends>
      

      However I realize that c3p0 is not bound to jca, so I changed JNDI name of c3p0 bean to
      <mbean code="com.mchange.v2.c3p0.jboss.C3P0PooledDataSource"
       name="jboss.jca:service=DataSourceBinding,name=PooledDS">
      


      This worked, but EJBTimerSerivce try look up DataSource with null:
      ObjectName: jboss.ejb:service=EJBTimerService,persistencePolicy=database
       State: FAILED
       Reason: java.sql.SQLException: Failed to lookup data source: null
       I Depend On:
       jboss.jca:service=DataSourceBinding,name=PooledDS
      

      This look like that EJBTimerService do not receive any DS. Putting back optional-argument=DataSource, helpd. Error message changed to:
      ObjectName: jboss.jca:service=DataSourceBinding,name=PooledDS
       State: NOTYETINSTALLED
       Depends On Me:
       jboss.ejb:service=EJBTimerService,persistencePolicy=database
      


      I find out that I am not alone with this problem. For example in jboss forum
      http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3983368#3983368
      Which lead to inetersting solution http://www.nabble.com/c3p0-vs-JPA-injections-on-JBoss-td23722441.html . This helped me to fix EJBTimerService dependency on Pooled JNDI name.

      I am just thinging is it possible to live completly without any -ds.xml data source?

      [/url]