[jboss-user] [Beginner's Corner] - using c3p0 as DefaultDS, can`t force ejb-deployer [EJBTimerS

pnemec do-not-reply at jboss.com
Tue Sep 15 06:16:03 EDT 2009


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
[url]
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3983368#3983368 [/url]
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]

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4255243#4255243

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4255243



More information about the jboss-user mailing list