Grails 3:GenericJDBCException:无法准备语句
Grails 3 : GenericJDBCException: could not prepare statement
有些读取查询失败了十分之一,并显示以下消息:
org.hibernate.exception.GenericJDBCException: could not prepare statement
端点本身仅调用 Myclass.findById(myInstanceId),因此这是一个 plugin/library/framework 问题。
阅读 here 这可能是由于与 hibernate 的依赖冲突,这里是我的依赖:
dependencies {
compile "org.springframework.boot:spring-boot-starter-logging"
compile "org.springframework.boot:spring-boot-autoconfigure"
compile "org.grails:grails-core"
compile "org.springframework.boot:spring-boot-starter-actuator"
provided "org.springframework.boot:spring-boot-starter-tomcat"
compile "org.grails:grails-plugin-url-mappings"
compile "org.grails:grails-plugin-rest"
compile "org.grails:grails-plugin-codecs"
compile "org.grails:grails-plugin-interceptors"
compile "org.grails:grails-plugin-services"
compile "org.grails:grails-plugin-datasource"
compile "org.grails:grails-plugin-databinding"
compile "org.grails:grails-web-boot"
compile "org.grails:grails-logging"
compile "org.grails.plugins:cache"
compile "org.grails.plugins:async"
compile "org.grails.plugins:events"
compile "org.grails.plugins:hibernate5"
compile "org.hibernate:hibernate-core:5.1.5.Final"
compile "org.grails.plugins:views-json"
compile "org.grails.plugins:views-json-templates"
console "org.grails:grails-console"
compile 'com.oracle:ojdbc6:11.2.0.3'
compile group: 'org.jdbi', name: 'jdbi', version: '2.78'
compile "co.freeside.jdbi-time:jdbi-time:1.1"
compile "org.eurekanetwork.libs:errorhandling:0.3.2"
compile "org.eurekanetwork.plugin:render-command-errors:0.1.4"
compile 'org.grails.plugins:database-migration:3.0.3'
compile 'org.liquibase:liquibase-core:3.5.3'
compile 'org.grails.plugins:rabbitmq-native:3.3.0'
compile 'javax.el:javax.el-api:3.0.0'
compile 'org.glassfish:javax.el:3.0.0'
compile 'org.grails:grails-datastore-rest-client:4.0.7.RELEASE'
compile group: 'net.bytebuddy', name: 'byte-buddy', version: '1.6.4'
compile group: 'cglib', name: 'cglib-nodep', version: '3.2.9'
profile "org.grails.profiles:rest-api"
runtime "com.h2database:h2"
runtime "org.apache.tomcat:tomcat-jdbc"
testCompile "org.grails:grails-gorm-testing-support"
testCompile "org.grails:grails-web-testing-support"
testCompile "org.eurekanetwork.libs:grails3-test-libraries:0.0.4"
testCompile "org.grails:grails-plugin-testing"
}
堆栈跟踪:
[timestamp=Mon Jan 14 15:03:20 CET 2019] [hostname=polydeuces]
[logtype=JAVASTACK_TRACE] [javaclass=class org.eurekanetwork.project.ProjectParticipantController] [loglevel=CRITICAL] [clientip=0:0:0:0:0:0:0:1] [user-agent=PostmanRuntime/7.6.0] [exception=org.hibernate.exception.GenericJDBCException: could not prepare statement] [stacktrace=[org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:47), org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:111), org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:182),
2019-01-14 15:03:35.594 错误 --- [nio-8080-exec-1] o.h.engine.jdbc.spi.SqlExceptionHelper:无法验证新建立的连接。
堆栈跟踪:
org.hibernate.exception.GenericJDBCException: 无法准备语句
在 org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:47) ~[hibernate-core-5.1.5.Final.jar:5.1.5.Final]
注意:我发现这个 question,类似于我的问题。将 testOnBorrow 设置设置为 false 似乎可以解决问题。
这个问题类似于 this question。
将 testOnBorrow 设置为 false 可解决问题。
有些读取查询失败了十分之一,并显示以下消息:
org.hibernate.exception.GenericJDBCException: could not prepare statement
端点本身仅调用 Myclass.findById(myInstanceId),因此这是一个 plugin/library/framework 问题。
阅读 here 这可能是由于与 hibernate 的依赖冲突,这里是我的依赖:
dependencies {
compile "org.springframework.boot:spring-boot-starter-logging"
compile "org.springframework.boot:spring-boot-autoconfigure"
compile "org.grails:grails-core"
compile "org.springframework.boot:spring-boot-starter-actuator"
provided "org.springframework.boot:spring-boot-starter-tomcat"
compile "org.grails:grails-plugin-url-mappings"
compile "org.grails:grails-plugin-rest"
compile "org.grails:grails-plugin-codecs"
compile "org.grails:grails-plugin-interceptors"
compile "org.grails:grails-plugin-services"
compile "org.grails:grails-plugin-datasource"
compile "org.grails:grails-plugin-databinding"
compile "org.grails:grails-web-boot"
compile "org.grails:grails-logging"
compile "org.grails.plugins:cache"
compile "org.grails.plugins:async"
compile "org.grails.plugins:events"
compile "org.grails.plugins:hibernate5"
compile "org.hibernate:hibernate-core:5.1.5.Final"
compile "org.grails.plugins:views-json"
compile "org.grails.plugins:views-json-templates"
console "org.grails:grails-console"
compile 'com.oracle:ojdbc6:11.2.0.3'
compile group: 'org.jdbi', name: 'jdbi', version: '2.78'
compile "co.freeside.jdbi-time:jdbi-time:1.1"
compile "org.eurekanetwork.libs:errorhandling:0.3.2"
compile "org.eurekanetwork.plugin:render-command-errors:0.1.4"
compile 'org.grails.plugins:database-migration:3.0.3'
compile 'org.liquibase:liquibase-core:3.5.3'
compile 'org.grails.plugins:rabbitmq-native:3.3.0'
compile 'javax.el:javax.el-api:3.0.0'
compile 'org.glassfish:javax.el:3.0.0'
compile 'org.grails:grails-datastore-rest-client:4.0.7.RELEASE'
compile group: 'net.bytebuddy', name: 'byte-buddy', version: '1.6.4'
compile group: 'cglib', name: 'cglib-nodep', version: '3.2.9'
profile "org.grails.profiles:rest-api"
runtime "com.h2database:h2"
runtime "org.apache.tomcat:tomcat-jdbc"
testCompile "org.grails:grails-gorm-testing-support"
testCompile "org.grails:grails-web-testing-support"
testCompile "org.eurekanetwork.libs:grails3-test-libraries:0.0.4"
testCompile "org.grails:grails-plugin-testing"
}
堆栈跟踪:
[timestamp=Mon Jan 14 15:03:20 CET 2019] [hostname=polydeuces]
[logtype=JAVASTACK_TRACE] [javaclass=class org.eurekanetwork.project.ProjectParticipantController] [loglevel=CRITICAL] [clientip=0:0:0:0:0:0:0:1] [user-agent=PostmanRuntime/7.6.0] [exception=org.hibernate.exception.GenericJDBCException: could not prepare statement] [stacktrace=[org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:47), org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:111), org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:182),
2019-01-14 15:03:35.594 错误 --- [nio-8080-exec-1] o.h.engine.jdbc.spi.SqlExceptionHelper:无法验证新建立的连接。 堆栈跟踪: org.hibernate.exception.GenericJDBCException: 无法准备语句 在 org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:47) ~[hibernate-core-5.1.5.Final.jar:5.1.5.Final]
注意:我发现这个 question,类似于我的问题。将 testOnBorrow 设置设置为 false 似乎可以解决问题。
这个问题类似于 this question。
将 testOnBorrow 设置为 false 可解决问题。