我试图将一个非常基本的Spring启动应用程序部署到Websphere 8.5.5.8(使用IBM J6 VM,在Java 1.6.0上)。同一个应用程序适用于Glassfish但在Websphere上抛出异常。我一直试图按照网上的每个指南来使其工作,但仍然无济于事,有人可以对我的错误有所了解吗?
例外日志如下:
[8/4/16 9:36:52:031 HKT] 00000094 SystemErr R com.ibm.ws.exception.RuntimeWarning: com.ibm.ws.webcontainer.exception.WebAppNotLoadedException: Failed to load webapp: Failed to load webapp: Unable to load configuration filesnull
[8/4/16 9:36:52:032 HKT] 00000094 SystemErr R at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:433)null
[8/4/16 9:36:52:032 HKT] 00000094 SystemErr R at com.ibm.ws.webcontainer.component.WebContainerImpl.start(WebContainerImpl.java:719)null
[8/4/16 9:36:52:032 HKT] 00000094 SystemErr R at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:1177)null
[8/4/16 9:36:52:032 HKT] 00000094 SystemErr R at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:1382)null
[8/4/16 9:36:52:032 HKT] 00000094 SystemErr R at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:639)null
[8/4/16 9:36:52:032 HKT] 00000094 SystemErr R at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:971)null
[8/4/16 9:36:52:032 HKT] 00000094 SystemErr R at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:776)null
[8/4/16 9:36:52:032 HKT] 00000094 SystemErr R at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplicationDynamically(ApplicationMgrImpl.java:1379)null
[8/4/16 9:36:52:032 HKT] 00000094 SystemErr R at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:2189)null
下面的Websphere版本信息:
Installation
--------------------------------------------------------------------------------
Product Directory /opt/IBM/WebSphere/AppServer
Version Directory /opt/IBM/WebSphere/AppServer/properties/version
DTD Directory /opt/IBM/WebSphere/AppServer/properties/version/dtd
Log Directory /var/ibm/InstallationManager/logs
Product List
--------------------------------------------------------------------------------
ND installed
Installed Product
--------------------------------------------------------------------------------
Name IBM WebSphere Application Server Network Deployment
Version 8.5.5.8
ID ND
Build Level cf081545.03
Build Date 11/12/15
Package com.ibm.websphere.ND.v85_8.5.5008.20151112_0939
Architecture x86-64 (64 bit)
Installed Features IBM 64-bit WebSphere SDK for Java
WebSphere Application Server Full Profile
EJBDeploy tool for pre-EJB 3.0 modules
Embeddable EJB container
Stand-alone thin clients and resource adapters
我的POM文件:
<packaging>war</packaging>
<name>test-server</name>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.3.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<start-class>com.test.ServletInitializer</start-class>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.6</java.version>
</properties>
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
<configuration>
<skip>true</skip>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
</plugin>
</plugins>
</build>
最后是我的主要课程:
@SpringBootApplication(exclude = MessageSourceAutoConfiguration.class)
public class ServletInitializer extends SpringBootServletInitializer {
/*public static void main(String[] args) {
SpringApplication.run(ServletInitializer.class, args);
}*/
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(ServletInitializer.class);
}
}
答案 0 :(得分:3)
此处的问题看起来您的ServletInitializer
类是使用与运行WebSphere不同的版本编译的。根据{{3}},WAS 8.5.5.8随Java 68一起提供。
查看您的pom.xml,您的ServletInitializer
建筑使用Java 7:
<properties>
<start-class>com.test.ServletInitializer</start-class>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.7</java.version>
</properties>
然后将其降低到<java.version>1.6</java.version>
,希望这样可以解决您的问题。
旁注:
您在Java EE 7的pom.xml中有一个依赖项,但是在9.0版之前,WebSphere traditional不符合EE7,因此我建议您将javaee-api
版本降低到6.0
。