部署到我的Spring Boot应用程序的Pivotal Cloud Foundry失败,并出现以下错误:
Error creating bean with name 'tomcatEmbeddedServletContainerFactory' defined in class path resource [org/springframework/boot/autoconfigure/web/EmbeddedServletContainerAutoConfiguration$EmbeddedTomcat.class]:
java.lang.NoClassDefFoundError: Could not initialize class org.hibernate.validator.internal.engine.ConfigurationImpl
使用其Java buildpack 4.17.2
仅在Cloud Foundry部署中存在问题,本地工作正常。 使用spring boot 1.5.19及其启动的验证器清理依赖关系。
如何摆脱这种缺失的依赖关系? spring-boot-starter-validation包含休眠验证器。
[INFO] +- org.springframework.boot:spring-boot-starter:jar:1.5.19.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot:jar:1.5.19.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-autoconfigure:jar:1.5.19.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-logging:jar:1.5.19.RELEASE:compile
[INFO] | | +- org.slf4j:jul-to-slf4j:jar:1.7.25:compile
[INFO] | | \- org.slf4j:log4j-over-slf4j:jar:1.7.25:compile
[INFO] | +- org.springframework:spring-core:jar:4.3.22.RELEASE:compile
[INFO] | \- org.yaml:snakeyaml:jar:1.17:compile
[INFO] +- org.springframework.boot:spring-boot-starter-web:jar:1.5.19.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-tomcat:jar:1.5.19.RELEASE:compile
[INFO] | | +- org.apache.tomcat.embed:tomcat-embed-core:jar:8.5.37:compile
[INFO] | | | \- org.apache.tomcat:tomcat-annotations-api:jar:8.5.37:compile
[INFO] | | \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:8.5.37:compile
[INFO] | +- org.springframework:spring-web:jar:4.3.22.RELEASE:compile
[INFO] | | \- org.springframework:spring-beans:jar:4.3.22.RELEASE:compile
[INFO] | \- org.springframework:spring-webmvc:jar:4.3.22.RELEASE:compile
[INFO] | \- org.springframework:spring-expression:jar:4.3.22.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-validation:jar:1.5.19.RELEASE:compile
[INFO] | +- org.apache.tomcat.embed:tomcat-embed-el:jar:8.5.37:compile
[INFO] | \- org.hibernate:hibernate-validator:jar:5.3.6.Final:compile
[INFO] | +- org.jboss.logging:jboss-logging:jar:3.3.0.Final:compile
[INFO] | \- com.fasterxml:classmate:jar:1.3.1:compile
[INFO] +- org.springframework.boot:spring-boot-starter-data-jpa:jar:1.5.19.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-aop:jar:1.5.19.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-jdbc:jar:1.5.19.RELEASE:compile
[INFO] | | \- org.springframework:spring-jdbc:jar:4.3.22.RELEASE:compile
[INFO] | +- org.hibernate:hibernate-core:jar:5.0.12.Final:compile
[INFO] | | +- org.hibernate.javax.persistence:hibernate-jpa-2.1-api:jar:1.0.0.Final:compile
[INFO] | | +- org.javassist:javassist:jar:3.18.1-GA:compile
[INFO] | | +- antlr:antlr:jar:2.7.7:compile
[INFO] | | +- org.jboss:jandex:jar:2.0.0.Final:compile
[INFO] | | +- dom4j:dom4j:jar:1.6.1:compile
[INFO] | | \- org.hibernate.common:hibernate-commons-annotations:jar:5.0.1.Final:compile
[INFO] | +- org.hibernate:hibernate-entitymanager:jar:5.0.12.Final:compile
[INFO] | +- javax.transaction:javax.transaction-api:jar:1.2:compile
[INFO] | +- org.springframework.data:spring-data-jpa:jar:1.11.18.RELEASE:compile
[INFO] | | +- org.springframework.data:spring-data-commons:jar:1.13.18.RELEASE:compile
[INFO] | | +- org.springframework:spring-orm:jar:4.3.22.RELEASE:compile
[INFO] | | \- org.springframework:spring-tx:jar:4.3.22.RELEASE:compile
[INFO] | \- org.springframework:spring-aspects:jar:4.3.22.RELEASE:compile
[INFO] +- org.liquibase:liquibase-core:jar:3.6.3:compile
[INFO] | \- ch.qos.logback:logback-classic:jar:1.2.3:compile
[INFO] | \- ch.qos.logback:logback-core:jar:1.2.3:compile
[INFO] +- org.springframework.boot:spring-boot-starter-security:jar:1.5.19.RELEASE:compile
[INFO] | +- org.springframework:spring-aop:jar:4.3.22.RELEASE:compile
[INFO] | +- org.springframework.security:spring-security-config:jar:4.2.11.RELEASE:compile
[INFO] | | \- org.springframework.security:spring-security-core:jar:4.2.11.RELEASE:compile
[INFO] | \- org.springframework.security:spring-security-web:jar:4.2.11.RELEASE:compile
[INFO] +- wsl-java-validate:wslvalidate4:jar:4.0.1:compile
[INFO] +- wsl-java-validate:asn1:jar:4.0.1:compile
[INFO] +- wsl-java-validate:jsafe:jar:4.0.1:compile
[INFO] +- wsl-java-validate:certj:jar:4.0.1:compile
[INFO] +- org.aspectj:aspectjweaver:jar:1.8.6:compile
[INFO] +- javax.ws.rs:javax.ws.rs-api:jar:2.0.1:compile
[INFO] +- org.springframework.security:spring-security-jwt:jar:1.0.9.RELEASE:compile
[INFO] | \- org.bouncycastle:bcpkix-jdk15on:jar:1.56:compile
[INFO] | \- org.bouncycastle:bcprov-jdk15on:jar:1.56:compile
[INFO] +- org.springframework.boot:spring-boot-starter-quartz:jar:2.1.4.RELEASE:compile
[INFO] | \- org.quartz-scheduler:quartz:jar:2.3.1:compile
[INFO] | +- com.mchange:mchange-commons-java:jar:0.2.15:compile
[INFO] | \- com.zaxxer:HikariCP-java7:jar:2.4.13:compile
[INFO] +- org.springframework.boot:spring-boot-starter-test:jar:1.5.19.RELEASE:test
[INFO] | +- org.springframework.boot:spring-boot-test:jar:1.5.19.RELEASE:test
[INFO] | +- org.springframework.boot:spring-boot-test-autoconfigure:jar:1.5.19.RELEASE:test
[INFO] | +- com.jayway.jsonpath:json-path:jar:2.2.0:test
[INFO] | | \- net.minidev:json-smart:jar:2.2.1:test
[INFO] | | \- net.minidev:accessors-smart:jar:1.1:test
[INFO] | | \- org.ow2.asm:asm:jar:5.0.3:test
[INFO] | +- org.assertj:assertj-core:jar:2.6.0:test
[INFO] | \- org.springframework:spring-test:jar:4.3.22.RELEASE:test
编辑:
已修复。。事实证明,这是我从Web应用程序的另一个模块中拾取的以下jboss库引起的问题。 从目标jar文件中排除以下库后,所有工作均按预期进行。 仍然很奇怪,我的本地部署没有检测到类似的休眠验证器问题,需要了解PCF Java构建包与本地Java运行时之间的更多区别。
[INFO] | +- com.sun.xml.messaging.saaj:saaj-impl:jar:1.3.2:compile
[INFO] | | \- javax.xml.soap:saaj-api:jar:1.3:compile
[INFO] | +- xml-security:xmlsec:jar:1.3.0:compile
[INFO] | +- com.sun.xml.rpc:jaxrpc-impl:jar:1.1.3_01:compile
[INFO] | +- com.sun.xml.rpc:jaxrpc-spi:jar:1.1.3_01:compile
[INFO] | +- com.sun.xml.fastinfoset:FastInfoset:jar:1.0.2:compile
[INFO] | +- jboss:jbossws-core:jar:1.0.4.GA:compile
[INFO] | +- jboss:jboss-common-client:jar:4.0.4.GA:compile
[INFO] | +- jboss.jbossws:jboss-jaxws-ext:jar:3.0.1-native-2.0.4.GA:compile
[INFO] | \- org.jboss:jbossxb:jar:2.0.3.GA:compile
[INFO] | +- org.jboss.logging:jboss-logging-spi:jar:2.0.5.GA:compile
[INFO] | +- org.jboss:jboss-common-core:jar:2.2.9.GA:compile
[INFO] | +- org.jboss:jboss-reflect:jar:2.0.2.GA:compile
[INFO] | +- xml-apis:xml-apis:jar:1.3.04:compile
[INFO] | +- xerces:xercesImpl:jar:2.9.1:compile
[INFO] | +- com.wutka:dtdparser:jar:1.21:compile
[INFO] | \- sun-jaxb:jaxb-api:jar:2.1.9:compile