I cannot reproduce error, but let me correct your properties files, so that Spring actually can read your properties, if you are using SpringBoot 1.4 and higher.
As I found in post with the same error, in order to solve the problem you are trying to increase datasource.max-active
and other properties, right ?
So if properties are not in this default application properties, then you have to write them as
spring.jpa.properties.*= # Additional native properties to set on the JPA provider.
According to this I advice you to change application.properties
file to the following:
spring.datasource.url = jdbc:derby:/spring-boot/db;create=true
spring.datasource.username = admin
spring.datasource.password = 1234
# this one is incorrect
# spring.datasource.driver = org.apache.derby.jdbc.EmbeddedDriver
# replace with the one below, otherwise Spring will use his own
# derby driver
spring.datasource.driver-class-name = org.apache.derby.jdbc.EmbeddedDriver
# this one is incorrect as well
# hibernate.dialect = org.hibernate.dialect.DerbyDialect
# use the following way
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.DerbyDialect
spring.jpa.generate-ddl = true
spring.jpa.hibernate.ddl-auto = update
spring.jpa.properties.hibernate.current_session_context_class = org.springframework.orm.hibernate4.SpringSessionContext
# and in order for these guys to work you have to know
# spring.datasource.max-active=100
# spring.datasource.max-idle=8
# spring.datasource.min-idle=8
# your dbcp and look for documentation
# below is the example for Tomcat
spring.datasource.tomcat.max-active=100
spring.datasource.tomcat.max-idle=8
spring.datasource.tomcat.min-idle=8
# make sure you check out the logging
# this is IMPORTANT to see that your
# properties were ACTUALLY picked up
logging.level.org.springframework.web = DEBUG
logging.level.org.hibernate = DEBUG
The pre-last 3 properties that may help you overcome the difficulties are toughest to solve. I picked a knowledge from this post here, last answer. It has also link to Spring Boot 1.4.1.RELEASE documentation.
Last but not the least, you have to make sure that your max-idle
properties were actually picked up by Spring. That is why I added two
last logging and debugging properties.
If you look carefully at your log file, please check to which values they were set. Here is how that line looks for me
2016-11-17 11:40:27.875 DEBUG 32079 --- [ main] o.hibernate.internal.SessionFactoryImpl : Instantiating session factory with properties: {java.vendor=Oracle Corporation, sun.java.launcher=SUN_STANDARD, catalina.base=/tmp/tomcat.736868414125414090.8080, sun.management.compiler=HotSpot 64-Bit Tiered Compilers, catalina.useNaming=false, hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy, os.name=Linux, sun.boot.class.path=/usr/users/nikiforo/src/jdk1.8.0_73/jre/lib/resources.jar:/usr/users/nikiforo/src/jdk1.8.0_73/jre/lib/rt.jar:/usr/users/nikiforo/src/jdk1.8.0_73/jre/lib/sunrsasign.jar:/usr/users/nikiforo/src/jdk1.8.0_73/jre/lib/jsse.jar:/usr/users/nikiforo/src/jdk1.8.0_73/jre/lib/jce.jar:/usr/users/nikiforo/src/jdk1.8.0_73/jre/lib/charsets.jar:/usr/users/nikiforo/src/jdk1.8.0_73/jre/lib/jfr.jar:/usr/users/nikiforo/src/jdk1.8.0_73/jre/classes, hibernate.current_session_context_class=org.springframework.orm.hibernate4.SpringSessionContext, java.vm.specification.vendor=Oracle Corporation, java.runtime.version=1.8.0_73-b02, user.name=nikiforo, javax.persistence.validation.mode=AUTO, user.language=en, sun.boot.library.path=/usr/users/nikiforo/src/jdk1.8.0_73/jre/lib/amd64, PID=32079, java.version=1.8.0_73, user.timezone=Europe/Berlin, sun.arch.data.model=64, java.endorsed.dirs=/usr/users/nikiforo/src/jdk1.8.0_73/jre/lib/endorsed, sun.cpu.isalist=, sun.jnu.encoding=UTF-8, file.encoding.pkg=sun.io, file.separator=/, java.specification.name=Java Platform API Specification, java.class.version=52.0, user.country=US, java.home=/usr/users/nikiforo/src/jdk1.8.0_73/jre, java.vm.info=mixed mode, os.version=4.1.20-11-default, hibernate.boot.CfgXmlAccessService.key=org.hibernate.boot.cfgxml.spi.LoadedConfig@6abb7b7d, hibernate.connection.datasource=org.apache.tomcat.jdbc.pool.DataSource@5c7dfc05{ConnectionPool[defaultAutoCommit=null; defaultReadOnly=null; defaultTransactionIsolation=-1; defaultCatalog=null; driverClassName=org.apache.derby.jdbc.EmbeddedDriver; maxActive=100
It is a long line, but as you see for me max-active
was set.
If you want to see in which simple Spring-Data-REST app I tried derby and following properties, check this mine GitHub project: derby-tomcat-database-error branch
It may help, may not, let me know if I'm wrong, I'll delete post.