Search code examples
mysqlhibernatedatasourcec3p0bitronix

no writable property 'URL' in class 'com.mchange.v2.c3p0.ComboPooledDataSource'


I have configured below c3p0 settings in my project. But while executing the jar file, I have found "no writeable property". Kindly advise me how to solve this.

Configuration:-

dataSource.setClassName("com.mchange.v2.c3p0.ComboPooledDataSource");        
        dataSource.getDriverProperties().setProperty("driverClass", properties.getProperty("jdbc.driver"));
        dataSource.setUniqueName(properties.getProperty("jbpm.uniquename"));
        dataSource.setMaxPoolSize(Integer.parseInt(properties.getProperty("jbpm.max")));
        dataSource.setAllowLocalTransactions(true);
        dataSource.getDriverProperties().setProperty("URL", properties.getProperty("jbpm.url"));
    dataSource.getDriverProperties().setProperty("user", properties.getProperty("jbpm.username"));
        dataSource.getDriverProperties().setProperty("password", properties.getProperty("jbpm.password"));
        dataSource.getDriverProperties().setProperty("acquireIncrement", properties.getProperty("jdbc.acquireincrement"));
        dataSource.getDriverProperties().setProperty("preferredTestQuery", properties.getProperty("jdbc.preferredtestquery"));
        dataSource.getDriverProperties().setProperty("breakAfterAcquireFailure", properties.getProperty("jdbc.breakafteracquirefailure"));
        dataSource.getDriverProperties().setProperty("acquireRetryAttempts", properties.getProperty("jdbc.acquireretryattempts"));
        dataSource.getDriverProperties().setProperty("acquireRetryDelay", properties.getProperty("jdbc.acquireretrydelay"));
        dataSource.getDriverProperties().setProperty("loginTimeout", properties.getProperty("jdbc.logintimeout"));
        dataSource.getDriverProperties().setProperty("idleConnectionTestPeriod", properties.getProperty("jdbc.dleconnectiontestperiod"));
        dataSource.getDriverProperties().setProperty("maxPoolSize", properties.getProperty("jdbc.maxpoolsize"));
        dataSource.getDriverProperties().setProperty("minPoolSize", properties.getProperty("jdbc.minpoolsize"));

Error log:-

bitronix.tm.resource.ResourceConfigurationException: cannot create JDBC datasource named java:jboss/datasources/DS
    at bitronix.tm.resource.jdbc.PoolingDataSource.init(PoolingDataSource.java:80)
    at com.tnq.messageq.DataSource.init(DataSource.java:60)
    at com.tnq.messageq.IntegrationConsumer.main(IntegrationConsumer.java:77)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at com.simontuffs.onejar.Boot.run(Boot.java:340)
    at com.simontuffs.onejar.Boot.main(Boot.java:166)
Caused by: bitronix.tm.utils.PropertyException: no writeable property 'URL' in class 'com.mchange.v2.c3p0.ComboPooledDataSource'
    at bitronix.tm.utils.PropertyUtils.getSetter(PropertyUtils.java:318)
    at bitronix.tm.utils.PropertyUtils.setDirectProperty(PropertyUtils.java:217)
    at bitronix.tm.utils.PropertyUtils.setProperty(PropertyUtils.java:83)
    at bitronix.tm.resource.common.XAPool.createXAFactory(XAPool.java:314)
    at bitronix.tm.resource.common.XAPool.<init>(XAPool.java:63)
    at bitronix.tm.resource.jdbc.PoolingDataSource.buildXAPool(PoolingDataSource.java:89)
    at bitronix.tm.resource.jdbc.PoolingDataSource.init(PoolingDataSource.java:76)

Thanks for looking into this..


Solution

  • ComboPooledDataSource has a property named JdbcUrl.Hence you can try using it instead of url.

        dataSource.getDriverProperties().setProperty("jdbcUrl, properties.getProperty("jbpm.url"));
    

    Hope this helps.