Hi Edoardo,
The "unusedProperty" is logged by tomee saying the setter doesn't exist and therefore the setting is just ignored. The "is not used in DBCP2" comes from tomcat org.apache.tomcat.dbcp.dbcp2.BasicDataSourceFactory (tomcat-dbcp) which is a dbcp bridge between tomcat config and their shade. Issue is tomee will wrap the tomcat resources - originally to add tomee features on tomcat defined datasources but since we upgraded to tomcat 8 not sure it makes much sense anymore - and uses tomee factory (to allow you to get jta support, sql logging etc...) once the webapp is deployed but will also ensure resources are available before the webapp is deployed to make it available to startup events/beans. In other words you can end up using both kind of resources. The workaround is to not use singleton as resource for the datasource (but means it will create one instance per lookup) since the boot will not eagerly create the datasource the tomcat way and then you just have the tomee factory to configure. The easiest fix - and recommanded - is to use resources.xml or even (better) tomee.xml to configure it. Side note: created https://issues.apache.org/jira/browse/TOMEE-1888 to track it and to try to ensure default is to use tomcat datasource and not recreate it if possible when set up this way Romain Manni-Bucau @rmannibucau <https://twitter.com/rmannibucau> | Blog <https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog <http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> | LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber <http://www.tomitribe.com> | JavaEE Factory <https://javaeefactory-rmannibucau.rhcloud.com> 2016-07-26 19:48 GMT+02:00 Edoardo Panfili <[email protected]>: > I am trying to configure a datasource with TomEE+ 7.0.1 > > this is my context.xml: > > <Context path="/ReST"> > <Resource name="jdbc/test1" auth="Container" > type="javax.sql.DataSource" > initialSize="4" maxActive="8" maxIdle="5" minIdle="3" > maxWait="300" > username="testuser" password="testpassword" > driverClassName="org.postgresql.Driver" > url="jdbc:postgresql://127.0.0.1:5432/testdb" > removeAbandoned="true" removeAbandonedTimeout="300" > logAbandoned="true" > /> > </Context> > > > during startup I can see only these warnings in catalina.out: > --------------------------------------------- > WARNING - Name = test1 Property maxActive is not used in DBCP2, use > maxTotal instead. maxTotal default value is 8. You have set value of "8" > for "maxActive" property, which is being ignored. > WARNING - Name = test1 Property removeAbandoned is not used in DBCP2, use > one or both of removeAbandonedOnBorrow or removeAbandonedOnMaintenance > instead. Both have default value set to false. You have set value of "true" > for "removeAbandoned" property, which is being ignored. > WARNING - Name = test1 Property maxWait is not used in DBCP2 , use > maxWaitMillis instead. maxWaitMillis default value is -1. You have set > value of "300" for "maxWait" property, which is being ignored. > --------------------------------------------- > > > Then I change my context.xml to: > > <Context path="/ReST"> > <Resource name="jdbc/test1" auth="Container" > type="javax.sql.DataSource" > initialSize="4" maxTotal="8" maxIdle="5" minIdle="3" > maxWaitMillis="30000" > username="testuser" password="testpassword" > driverClassName="org.postgresql.Driver" > url="jdbc:postgresql://127.0.0.1:5432/testdb" > removeAbandonedOnBorrow="true" removeAbandonedTimeout="300" > logAbandoned="true" > /> > </Context> > > but there are new warnings in catalina.out > --------------------------------------------- > WARNING - unusedProperty maxTotal - ReST/jdbc/test1 > WARNING - unusedProperty removeAbandonedOnBorrow - ReST/jdbc/test1 > WARNING - unusedProperty maxWaitMillis - ReST/jdbc/test1 > --------------------------------------------- > > What I am doing wrong? In $tomee/lib/ I can see dbcp and dbcp2 jars which > one is used? > > > Thank you > > Edoardo > >
