首页 文章

无法在Spring Boot中构建Hibernate SessionFactory

提问于
浏览
4

我有一个Spring Boot应用程序,我正在尝试使用Postgres,但每次都无法启动应用程序 . 这是堆栈跟踪:

"C:\Program Files\Java\jdk1.8.0_141\bin\java.exe" "-javaagent:D:\Programs\IntelliJ IDEA Community Edition 2018.2.1\lib\idea_rt.jar=55780:D:\Programs\IntelliJ IDEA Community Edition 2018.2.1\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\Java\jdk1.8.0_141\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_141\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_141\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.8.0_141\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_141\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_141\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_141\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_141\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_141\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_141\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_141\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_141\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_141\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.8.0_141\jre\lib\ext\zipfs.jar;C:\Program Files\Java\jdk1.8.0_141\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.8.0_141\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_141\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_141\jre\lib\jfxswt.jar;C:\Program Files\Java\jdk1.8.0_141\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_141\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.8.0_141\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.8.0_141\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_141\jre\lib\rt.jar;D:\main\gdrive\core\fooapp\api-module\target\classes;D:\main\gdrive\core\fooapp\commons-module\target\classes;C:\Users\andromeda\.m2\repository\javax\validation\validation-api\2.0.1.Final\validation-api-2.0.1.Final.jar;C:\Users\andromeda\.m2\repository\org\postgresql\postgresql\42.2.1\postgresql-42.2.1.jar;C:\Users\andromeda\.m2\repository\org\springframework\boot\spring-boot-starter-data-jpa\2.0.0.RELEASE\spring-boot-starter-data-jpa-2.0.0.RELEASE.jar;C:\Users\andromeda\.m2\repository\org\springframework\boot\spring-boot-starter-aop\2.0.0.RELEASE\spring-boot-starter-aop-2.0.0.RELEASE.jar;C:\Users\andromeda\.m2\repository\org\aspectj\aspectjweaver\1.8.13\aspectjweaver-1.8.13.jar;C:\Users\andromeda\.m2\repository\org\springframework\boot\spring-boot-starter-jdbc\2.0.0.RELEASE\spring-boot-starter-jdbc-2.0.0.RELEASE.jar;C:\Users\andromeda\.m2\repository\com\zaxxer\HikariCP\2.7.8\HikariCP-2.7.8.jar;C:\Users\andromeda\.m2\repository\org\springframework\spring-jdbc\5.0.4.RELEASE\spring-jdbc-5.0.4.RELEASE.jar;C:\Users\andromeda\.m2\repository\org\hibernate\hibernate-core\5.2.14.Final\hibernate-core-5.2.14.Final.jar;C:\Users\andromeda\.m2\repository\org\hibernate\javax\persistence\hibernate-jpa-2.1-api\1.0.0.Final\hibernate-jpa-2.1-api-1.0.0.Final.jar;C:\Users\andromeda\.m2\repository\org\javassist\javassist\3.22.0-GA\javassist-3.22.0-GA.jar;C:\Users\andromeda\.m2\repository\antlr\antlr\2.7.7\antlr-2.7.7.jar;C:\Users\andromeda\.m2\repository\org\jboss\jandex\2.0.3.Final\jandex-2.0.3.Final.jar;C:\Users\andromeda\.m2\repository\dom4j\dom4j\1.6.1\dom4j-1.6.1.jar;C:\Users\andromeda\.m2\repository\org\hibernate\common\hibernate-commons-annotations\5.0.1.Final\hibernate-commons-annotations-5.0.1.Final.jar;C:\Users\andromeda\.m2\repository\javax\transaction\javax.transaction-api\1.2\javax.transaction-api-1.2.jar;C:\Users\andromeda\.m2\repository\org\springframework\data\spring-data-jpa\2.0.5.RELEASE\spring-data-jpa-2.0.5.RELEASE.jar;C:\Users\andromeda\.m2\repository\org\springframework\data\spring-data-commons\2.0.5.RELEASE\spring-data-commons-2.0.5.RELEASE.jar;C:\Users\andromeda\.m2\repository\org\springframework\spring-orm\5.0.4.RELEASE\spring-orm-5.0.4.RELEASE.jar;C:\Users\andromeda\.m2\repository\org\springframework\spring-tx\5.0.4.RELEASE\spring-tx-5.0.4.RELEASE.jar;C:\Users\andromeda\.m2\repository\org\springframework\spring-aspects\5.0.4.RELEASE\spring-aspects-5.0.4.RELEASE.jar;C:\Users\andromeda\.m2\repository\org\springframework\boot\spring-boot-starter-mail\2.0.0.RELEASE\spring-boot-starter-mail-2.0.0.RELEASE.jar;C:\Users\andromeda\.m2\repository\org\springframework\spring-context\5.0.4.RELEASE\spring-context-5.0.4.RELEASE.jar;C:\Users\andromeda\.m2\repository\org\springframework\spring-context-support\5.0.4.RELEASE\spring-context-support-5.0.4.RELEASE.jar;C:\Users\andromeda\.m2\repository\com\sun\mail\javax.mail\1.6.1\javax.mail-1.6.1.jar;C:\Users\andromeda\.m2\repository\javax\activation\activation\1.1\activation-1.1.jar;C:\Users\andromeda\.m2\repository\org\springframework\boot\spring-boot-starter-freemarker\2.0.0.RELEASE\spring-boot-starter-freemarker-2.0.0.RELEASE.jar;C:\Users\andromeda\.m2\repository\org\freemarker\freemarker\2.3.27-incubating\freemarker-2.3.27-incubating.jar;C:\Users\andromeda\.m2\repository\commons-validator\commons-validator\1.6\commons-validator-1.6.jar;C:\Users\andromeda\.m2\repository\commons-beanutils\commons-beanutils\1.9.2\commons-beanutils-1.9.2.jar;C:\Users\andromeda\.m2\repository\commons-digester\commons-digester\1.8.1\commons-digester-1.8.1.jar;C:\Users\andromeda\.m2\repository\commons-logging\commons-logging\1.2\commons-logging-1.2.jar;C:\Users\andromeda\.m2\repository\commons-collections\commons-collections\3.2.2\commons-collections-3.2.2.jar;C:\Users\andromeda\.m2\repository\org\springframework\boot\spring-boot-starter-amqp\2.0.0.RELEASE\spring-boot-starter-amqp-2.0.0.RELEASE.jar;C:\Users\andromeda\.m2\repository\org\springframework\spring-messaging\5.0.4.RELEASE\spring-messaging-5.0.4.RELEASE.jar;C:\Users\andromeda\.m2\repository\org\springframework\amqp\spring-rabbit\2.0.2.RELEASE\spring-rabbit-2.0.2.RELEASE.jar;C:\Users\andromeda\.m2\repository\org\springframework\amqp\spring-amqp\2.0.2.RELEASE\spring-amqp-2.0.2.RELEASE.jar;C:\Users\andromeda\.m2\repository\com\rabbitmq\amqp-client\5.1.2\amqp-client-5.1.2.jar;C:\Users\andromeda\.m2\repository\com\rabbitmq\http-client\1.3.1.RELEASE\http-client-1.3.1.RELEASE.jar;C:\Users\andromeda\.m2\repository\org\apache\httpcomponents\httpclient\4.5.5\httpclient-4.5.5.jar;C:\Users\andromeda\.m2\repository\org\apache\httpcomponents\httpcore\4.4.9\httpcore-4.4.9.jar;C:\Users\andromeda\.m2\repository\org\springframework\retry\spring-retry\1.2.2.RELEASE\spring-retry-1.2.2.RELEASE.jar;C:\Users\andromeda\.m2\repository\org\springframework\boot\spring-boot-starter-data-redis\2.0.0.RELEASE\spring-boot-starter-data-redis-2.0.0.RELEASE.jar;C:\Users\andromeda\.m2\repository\org\springframework\data\spring-data-redis\2.0.5.RELEASE\spring-data-redis-2.0.5.RELEASE.jar;C:\Users\andromeda\.m2\repository\org\springframework\data\spring-data-keyvalue\2.0.5.RELEASE\spring-data-keyvalue-2.0.5.RELEASE.jar;C:\Users\andromeda\.m2\repository\org\springframework\spring-oxm\5.0.4.RELEASE\spring-oxm-5.0.4.RELEASE.jar;C:\Users\andromeda\.m2\repository\redis\clients\jedis\2.9.0\jedis-2.9.0.jar;C:\Users\andromeda\.m2\repository\org\apache\commons\commons-pool2\2.5.0\commons-pool2-2.5.0.jar;C:\Users\andromeda\.m2\repository\org\springframework\boot\spring-boot-starter-web\2.0.0.RELEASE\spring-boot-starter-web-2.0.0.RELEASE.jar;C:\Users\andromeda\.m2\repository\org\springframework\boot\spring-boot-starter-json\2.0.0.RELEASE\spring-boot-starter-json-2.0.0.RELEASE.jar;C:\Users\andromeda\.m2\repository\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.9.4\jackson-datatype-jdk8-2.9.4.jar;C:\Users\andromeda\.m2\repository\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.9.4\jackson-datatype-jsr310-2.9.4.jar;C:\Users\andromeda\.m2\repository\com\fasterxml\jackson\module\jackson-module-parameter-names\2.9.4\jackson-module-parameter-names-2.9.4.jar;C:\Users\andromeda\.m2\repository\org\springframework\boot\spring-boot-starter-tomcat\2.0.0.RELEASE\spring-boot-starter-tomcat-2.0.0.RELEASE.jar;C:\Users\andromeda\.m2\repository\org\apache\tomcat\embed\tomcat-embed-core\8.5.28\tomcat-embed-core-8.5.28.jar;C:\Users\andromeda\.m2\repository\org\apache\tomcat\embed\tomcat-embed-el\8.5.28\tomcat-embed-el-8.5.28.jar;C:\Users\andromeda\.m2\repository\org\apache\tomcat\embed\tomcat-embed-websocket\8.5.28\tomcat-embed-websocket-8.5.28.jar;C:\Users\andromeda\.m2\repository\org\hibernate\validator\hibernate-validator\6.0.7.Final\hibernate-validator-6.0.7.Final.jar;C:\Users\andromeda\.m2\repository\org\jboss\logging\jboss-logging\3.3.2.Final\jboss-logging-3.3.2.Final.jar;C:\Users\andromeda\.m2\repository\org\springframework\spring-web\5.0.4.RELEASE\spring-web-5.0.4.RELEASE.jar;C:\Users\andromeda\.m2\repository\org\springframework\spring-beans\5.0.4.RELEASE\spring-beans-5.0.4.RELEASE.jar;C:\Users\andromeda\.m2\repository\org\springframework\spring-webmvc\5.0.4.RELEASE\spring-webmvc-5.0.4.RELEASE.jar;C:\Users\andromeda\.m2\repository\org\springframework\spring-expression\5.0.4.RELEASE\spring-expression-5.0.4.RELEASE.jar;C:\Users\andromeda\.m2\repository\org\springframework\boot\spring-boot-starter-security\2.0.0.RELEASE\spring-boot-starter-security-2.0.0.RELEASE.jar;C:\Users\andromeda\.m2\repository\org\springframework\spring-aop\5.0.4.RELEASE\spring-aop-5.0.4.RELEASE.jar;C:\Users\andromeda\.m2\repository\org\springframework\security\spring-security-config\5.0.3.RELEASE\spring-security-config-5.0.3.RELEASE.jar;C:\Users\andromeda\.m2\repository\org\springframework\security\spring-security-web\5.0.3.RELEASE\spring-security-web-5.0.3.RELEASE.jar;C:\Users\andromeda\.m2\repository\org\springframework\security\spring-security-core\5.0.3.RELEASE\spring-security-core-5.0.3.RELEASE.jar;C:\Users\andromeda\.m2\repository\org\springframework\spring-core\5.0.4.RELEASE\spring-core-5.0.4.RELEASE.jar;C:\Users\andromeda\.m2\repository\org\springframework\spring-jcl\5.0.4.RELEASE\spring-jcl-5.0.4.RELEASE.jar;C:\Users\andromeda\.m2\repository\net\bytebuddy\byte-buddy\1.7.10\byte-buddy-1.7.10.jar;C:\Users\andromeda\.m2\repository\com\fasterxml\jackson\dataformat\jackson-dataformat-yaml\2.9.4\jackson-dataformat-yaml-2.9.4.jar;C:\Users\andromeda\.m2\repository\org\yaml\snakeyaml\1.19\snakeyaml-1.19.jar;C:\Users\andromeda\.m2\repository\com\fasterxml\jackson\core\jackson-core\2.9.4\jackson-core-2.9.4.jar;C:\Users\andromeda\.m2\repository\com\fasterxml\jackson\core\jackson-databind\2.9.4\jackson-databind-2.9.4.jar;C:\Users\andromeda\.m2\repository\com\fasterxml\jackson\core\jackson-annotations\2.9.0\jackson-annotations-2.9.0.jar;C:\Users\andromeda\.m2\repository\io\jsonwebtoken\jjwt\0.9.0\jjwt-0.9.0.jar;C:\Users\andromeda\.m2\repository\io\springfox\springfox-swagger2\2.7.0\springfox-swagger2-2.7.0.jar;C:\Users\andromeda\.m2\repository\io\swagger\swagger-annotations\1.5.13\swagger-annotations-1.5.13.jar;C:\Users\andromeda\.m2\repository\io\swagger\swagger-models\1.5.13\swagger-models-1.5.13.jar;C:\Users\andromeda\.m2\repository\io\springfox\springfox-spi\2.7.0\springfox-spi-2.7.0.jar;C:\Users\andromeda\.m2\repository\io\springfox\springfox-core\2.7.0\springfox-core-2.7.0.jar;C:\Users\andromeda\.m2\repository\io\springfox\springfox-schema\2.7.0\springfox-schema-2.7.0.jar;C:\Users\andromeda\.m2\repository\io\springfox\springfox-swagger-common\2.7.0\springfox-swagger-common-2.7.0.jar;C:\Users\andromeda\.m2\repository\io\springfox\springfox-spring-web\2.7.0\springfox-spring-web-2.7.0.jar;C:\Users\andromeda\.m2\repository\org\reflections\reflections\0.9.11\reflections-0.9.11.jar;C:\Users\andromeda\.m2\repository\com\google\guava\guava\18.0\guava-18.0.jar;C:\Users\andromeda\.m2\repository\com\fasterxml\classmate\1.3.4\classmate-1.3.4.jar;C:\Users\andromeda\.m2\repository\org\slf4j\slf4j-api\1.7.25\slf4j-api-1.7.25.jar;C:\Users\andromeda\.m2\repository\org\springframework\plugin\spring-plugin-core\1.2.0.RELEASE\spring-plugin-core-1.2.0.RELEASE.jar;C:\Users\andromeda\.m2\repository\org\springframework\plugin\spring-plugin-metadata\1.2.0.RELEASE\spring-plugin-metadata-1.2.0.RELEASE.jar;C:\Users\andromeda\.m2\repository\org\mapstruct\mapstruct\1.1.0.Final\mapstruct-1.1.0.Final.jar;C:\Users\andromeda\.m2\repository\io\springfox\springfox-swagger-ui\2.7.0\springfox-swagger-ui-2.7.0.jar;C:\Users\andromeda\.m2\repository\com\chargebee\chargebee-java\2.6.0\chargebee-java-2.6.0.jar;C:\Users\andromeda\.m2\repository\org\json\json\20090211\json-20090211.jar;C:\Users\andromeda\.m2\repository\commons-codec\commons-codec\1.11\commons-codec-1.11.jar;C:\Users\andromeda\.m2\repository\org\springframework\boot\spring-boot-starter\2.0.0.RELEASE\spring-boot-starter-2.0.0.RELEASE.jar;C:\Users\andromeda\.m2\repository\org\springframework\boot\spring-boot\2.0.0.RELEASE\spring-boot-2.0.0.RELEASE.jar;C:\Users\andromeda\.m2\repository\org\springframework\boot\spring-boot-autoconfigure\2.0.0.RELEASE\spring-boot-autoconfigure-2.0.0.RELEASE.jar;C:\Users\andromeda\.m2\repository\org\springframework\boot\spring-boot-starter-logging\2.0.0.RELEASE\spring-boot-starter-logging-2.0.0.RELEASE.jar;C:\Users\andromeda\.m2\repository\ch\qos\logback\logback-classic\1.2.3\logback-classic-1.2.3.jar;C:\Users\andromeda\.m2\repository\ch\qos\logback\logback-core\1.2.3\logback-core-1.2.3.jar;C:\Users\andromeda\.m2\repository\org\apache\logging\log4j\log4j-to-slf4j\2.10.0\log4j-to-slf4j-2.10.0.jar;C:\Users\andromeda\.m2\repository\org\apache\logging\log4j\log4j-api\2.10.0\log4j-api-2.10.0.jar;C:\Users\andromeda\.m2\repository\org\slf4j\jul-to-slf4j\1.7.25\jul-to-slf4j-1.7.25.jar;C:\Users\andromeda\.m2\repository\javax\annotation\javax.annotation-api\1.3.2\javax.annotation-api-1.3.2.jar;C:\Users\andromeda\.m2\repository\commons-lang\commons-lang\2.6\commons-lang-2.6.jar" com.fooapp.api.ApiMain

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.0.0.RELEASE)

2018-10-17 00:52:38.255  INFO 16916 --- [           main] com.fooapp.api.ApiMain             : Starting ApiMain on andromeda with PID 16916 (D:\main\gdrive\core\fooapp\api-module\target\classes started by kaustubh in D:\main\gdrive\core\fooapp)
2018-10-17 00:52:38.258  INFO 16916 --- [           main] com.fooapp.api.ApiMain             : The following profiles are active: development
2018-10-17 00:52:38.367  INFO 16916 --- [           main] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@28f2a10f: startup date [Wed Oct 17 00:52:38 IST 2018]; root of context hierarchy
2018-10-17 00:52:40.215  INFO 16916 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
2018-10-17 00:52:40.549  INFO 16916 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Overriding bean definition for bean 'rabbitTemplate' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=rabbitMQConfig; factoryMethodName=rabbitTemplate; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [com/fooapp/commons/RabbitMQConfig.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration$RabbitTemplateConfiguration; factoryMethodName=rabbitTemplate; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/amqp/RabbitAutoConfiguration$RabbitTemplateConfiguration.class]]
2018-10-17 00:52:40.601  INFO 16916 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
2018-10-17 00:52:41.180  INFO 16916 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.amqp.rabbit.annotation.RabbitBootstrapConfiguration' of type [org.springframework.amqp.rabbit.annotation.RabbitBootstrapConfiguration$$EnhancerBySpringCGLIB$$63d9e2b9] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-10-17 00:52:41.429  INFO 16916 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$9d6e248b] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-10-17 00:52:42.226  INFO 16916 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2018-10-17 00:52:42.274  INFO 16916 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2018-10-17 00:52:42.275  INFO 16916 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.5.28
2018-10-17 00:52:42.290  INFO 16916 --- [ost-startStop-1] o.a.catalina.core.AprLifecycleListener   : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [C:\Program Files\Java\jdk1.8.0_141\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files (x86)\Windows Resource Kits\Tools\;C:\Program Files (x86)\Python36-32\Scripts\;C:\Program Files (x86)\Python36-32\;C:\Program Files\Microsoft MPI\Bin\;C:\Program Files\ConEmu\ConEmu\Scripts;C:\Program Files\ConEmu;C:\Program Files\ConEmu\ConEmu;C:\Python36\Scripts\;C:\Python36\;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\ProgramData\chocolatey\bin;C:\Program Files\Java\jdk1.8.0_141\bin;C:\Program Files (x86)\Boxcryptor\bin\;C:\Users\andromeda\AppData\Local\Microsoft\WindowsApps;C:\Users\andromeda\.lein\bin;C:\Users\andromeda\AppData\Local\Programs\Fiddler;C:\Program Files\MongoDB\Server\3.4\bin;C:\Program Files (x86)\GTK2-Runtime\bin;C:\Program Files\Mercurial;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;D:\Programs\Git\cmd;D:\Programs\Git\mingw64\bin;D:\Programs\Git\usr\bin;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;D:\Programs\Calibre2\;C:\Program Files (x86)\sbt\bin;C:\Program Files (x86)\scala\bin;C:\WINDOWS\System32\OpenSSH\;C:\Utilities\;D:\ProgramData\chocolatey\bin;C:\Program Files (x86)\Pandoc\;D:\Programs\PostgreSQL\9.5\bin;C:\influxdb-1.6.1_windows_amd64;C:\SysinternalsSuite;C:\nssm-2.24-101-g897c7ad\win64;C:\Users\andromeda\AppData\Local\Microsoft\WindowsApps;C:\Users\andromeda\.lein\bin;C:\Users\andromeda\AppData\Local\Programs\Fiddler;C:\Program Files\Mercurial\;C:\Users\andromeda\AppData\Local\Microsoft\WindowsApps;.]
2018-10-17 00:52:42.476  INFO 16916 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2018-10-17 00:52:42.476  INFO 16916 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 4116 ms
2018-10-17 00:52:42.709  INFO 16916 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'characterEncodingFilter' to: [/*]
2018-10-17 00:52:42.709  INFO 16916 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2018-10-17 00:52:42.709  INFO 16916 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2018-10-17 00:52:42.710  INFO 16916 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'requestContextFilter' to: [/*]
2018-10-17 00:52:42.710  INFO 16916 --- [ost-startStop-1] .s.DelegatingFilterProxyRegistrationBean : Mapping filter: 'springSecurityFilterChain' to: [/*]
2018-10-17 00:52:42.710  INFO 16916 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean  : Servlet dispatcherServlet mapped to [/]
2018-10-17 00:52:42.960  INFO 16916 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...
2018-10-17 00:52:43.104  INFO 16916 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Start completed.
2018-10-17 00:52:43.178  INFO 16916 --- [           main] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'
2018-10-17 00:52:43.205  INFO 16916 --- [           main] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [
    name: default
    ...]
2018-10-17 00:52:43.326  INFO 16916 --- [           main] org.hibernate.Version                    : HHH000412: Hibernate Core {5.2.14.Final}
2018-10-17 00:52:43.328  INFO 16916 --- [           main] org.hibernate.cfg.Environment            : HHH000206: hibernate.properties not found
2018-10-17 00:52:43.379  INFO 16916 --- [           main] o.hibernate.annotations.common.Version   : HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
2018-10-17 00:52:43.594  INFO 16916 --- [           main] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.PostgreSQLDialect
2018-10-17 00:52:43.739  INFO 16916 --- [           main] o.h.e.j.e.i.LobCreatorBuilderImpl        : HHH000421: Disabling contextual LOB creation as hibernate.jdbc.lob.non_contextual_creation is true
2018-10-17 00:52:43.741  INFO 16916 --- [           main] org.hibernate.type.BasicTypeRegistry     : HHH000270: Type registration [java.util.UUID] overrides previous : org.hibernate.type.UUIDBinaryType@108e9837
2018-10-17 00:52:44.111  WARN 16916 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory
2018-10-17 00:52:44.111  INFO 16916 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown initiated...
2018-10-17 00:52:44.123  INFO 16916 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown completed.
2018-10-17 00:52:44.126  INFO 16916 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]

Process finished with exit code 1

这里也是配置文件的相关部分:

spring:
  datasource:
    url: jdbc:postgresql://localhost/mydatabase?createDatabaseIfNotExist=true
    username: postgres
    password: mypassword
    driver-class-name: org.postgresql.Driver

  jpa:
    show-sql: true
    properties:
      hibernate:
        jdbc:
          lob:
            non_contextual_creation: true
        dialect: org.hibernate.dialect.PostgreSQLDialect
    hibernate:
      ddl-auto: create

有些人在不同的问题上提到如果数据库在执行之前不存在会发生这种错误,所以我手动创建了数据库,但我仍然遇到这个错误 .

EDIT: Here is the TRACE log of app. As there is too much text, I have uploaded it as a file: https://ufile.io/zuk69

2 回答

  • 0

    你可以尝试将你的yaml文件更改为

    spring:
        jpa:
            show-sql: true
            hibernate:
              ddl-auto: create-drop
            database: postgresql
            database-platform: org.hibernate.dialect.PostgreSQLDialect
        datasource:
            url: jdbc:postgresql://localhost:5432/mydatabase?createDatabaseIfNotExist=true
            username: postgres
            password: mypassword    
            driver-class-name: org.postgresql.Driver
    

    修复Postgres JPA错误(方法org.postgresql.jdbc.PgConnection.createClob()尚未实现) .

    您需要将其添加到您的应用程序属性: spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true

  • 0

    它可能与糟糕的@annotations有关,你检查了你的源代码,还有Hibernate注释,喜欢?

    @OneToOne
    @ManyToOne
    

    它与数据库结构的一致性?

相关问题