我正在使用spring boot 1.4.x开发一个Web服务,并将其部署在支持java 6的Websphere 8.5中。但是当我在WAS中部署我的战争时,我遇到了错误。
看起来Spring引导中的一个jar依赖项(spring-ws-core-2.3.1.RELEASE.jar)有使用java编译的类7.Which导致以下错误。
使用Spring Boot 1.4.x需要什么样的最低java版本? 在我的情况下,是否可以单独覆盖上面的依赖项以降低版本?
错误:
2/16/17 10:58:08:296 EST] 000000f2 CompositionUn E WSVR0194E: Composition unit WebSphere:cuname=testpp-1_0_0-SNAPSHOT_war in BLA WebSphere:blaname=testpp-1_0_0-SNAPSHOT_war failed to start.
[2/16/17 10:58:08:299 EST] 000000f2 MBeanHelper E Could not invoke an operation on object: WebSphere:name=ApplicationManager,process=server1,platform=proxy,node=MyNode,version=8.5.5.2,type=ApplicationManager,mbeanIdentifier=ApplicationManager,cell=MyCell,spec=1.0 because of an mbean exception: com.ibm.ws.exception.RuntimeWarning: com.ibm.ws.webcontainer.exception.WebAppNotLoadedException: Failed to load webapp: Failed to load webapp: JVMCFRE003 bad major version&#59; class=org/springframework/ws/transport/http/support/AbstractMessageDispatcherServletInitializer, offset=6
[2/16/17 10:58:08:299 EST] 000000f2 SystemErr R com.ibm.ws.exception.RuntimeWarning: com.ibm.ws.webcontainer.exception.WebAppNotLoadedException: Failed to load webapp: Failed to load webapp: JVMCFRE003 bad major version&#59; class=org/springframework/ws/transport/http/support/AbstractMessageDispatcherServletInitializer, offset=6
[2/16/17 10:58:08:300 EST] 000000f2 SystemErr R at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:432)
[2/16/17 10:58:08:300 EST] 000000f2 SystemErr R at com.ibm.ws.webcontainer.component.WebContainerImpl.start(WebContainerImpl.java:718)
[2/16/17 10:58:08:300 EST] 000000f2 SystemErr R at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:1177)
[2/16/17 10:58:08:300 EST] 000000f2 SystemErr R at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:1370)
[2/16/17 10:58:08:300 EST] 000000f2 SystemErr R at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:639)
[2/16/17 10:58:08:300 EST] 000000f2 SystemErr R at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:968)
POM配置
testap Spring Boot的演示项目
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.4.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.6</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web-services</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
答案 0 :(得分:2)
According to the reference documentation:
默认情况下,Spring Boot 1.4.4.RELEASE需要Java 7和Spring Framework 4.3.6.RELEASE或更高版本。您可以使用带有Java 6的Spring Boot和一些其他配置。有关详细信息,请参阅Section 81.11, “How to use Java 6”。为Maven(3.2+)和Gradle(1.12或2.x)提供显式构建支持。不推荐支持Gradle 2.8及更早版本。不支持Gradle 3。
您遇到问题的依赖项不是Spring Boot,而是单独的Spring Web Services which is only compatible with Java 7:
Spring Web Services需要标准的Java 7运行时环境。 Java 8也受支持。 Spring-WS构建于Spring Framework 4.0.9之上,但支持更高版本。
你可以尝试降级或排除依赖关系,但是你有很高的风险会破坏某些东西。