gpt4 book ai didi

mysql - 类 'URL' 中没有可写属性 'com.mchange.v2.c3p0.ComboPooledDataSource'

转载 作者:行者123 更新时间:2023-11-29 11:44:42 26 4
gpt4 key购买 nike

我在我的项目中配置了以下 c3p0 设置。但是在执行jar文件时,我发现“没有可写属性”。请告诉我如何解决这个问题。

配置:-

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"));

错误日志:-

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)

感谢您对此进行调查..

最佳答案

ComboPooledDataSource 有一个名为 JdbcUrl 的属性。因此您可以尝试使用它而不是 url。

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

希望这有帮助。

关于mysql - 类 'URL' 中没有可写属性 'com.mchange.v2.c3p0.ComboPooledDataSource',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35154691/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com