【发布时间】:2018-09-30 05:36:49
【问题描述】:
我正在编写一个简单的基于 Spring 的 Web 应用程序并将其部署到 Websphere Liberty 8.5.5.9。部署失败,因为应用程序启动失败。 console.log中的消息是
[ERROR ] CWWKZ0002E: An exception occurred while starting the application userSetting.
The exception message was: com.ibm.ws.container.service.metadata.MetaDataException:
com.ibm.wsspi.adaptable.module.UnableToAdaptException:
com.ibm.ws.javaee.ddmodel.DDParser$ParseException: CWWKC2262E: The server is
unable to process the 3.1 version and the http://xmlns.jcp.org/xml/ns/javaee namespace
in the /META-INF/web-fragment.xml deployment descriptor on line 23.
消息的最后一部分现在很有意义,因为我在应用程序的 Eclipse 项目中没有 /META-INF 或 /WEB-INF,因为我正在使用 Gradle 进行部署:gradle clean build deploy。
我尝试了对项目的各种修改,无奈之下,我将其缩减为只有以下源代码:
@SpringBootApplication
public class UserSettingApplication {
private static final LoggerUtils logger = new LoggerUtils( UserSettingApplication.class );
public static void main(String[] args) {
logger.debug( "Entering UserSettingApplication.main()" );
SpringApplication.run(UserSettingApplication.class, args);
}
}
你能告诉我如何解决这个服务启动问题吗?
server.xml:
<?xml version="1.0" encoding="UTF-8"?>
<server description="new server">
<!-- Enable features -->
<featureManager>
<feature>jsp-2.2</feature>
</featureManager>
<featureManager>
<feature>adminCenter-1.0</feature>
</featureManager>
<!-- Define the host name for use by the collective.
If the host name needs to be changed, the server should be
removed from the collective and re-joined. -->
<variable name="defaultHostName" value="localhost" />
<!-- Define an Administrator and non-Administrator -->
<basicRegistry id="basic">
<user name="admin" password="********" />
<user name="nonadmin" password="***********" />
</basicRegistry>
<!-- Assign 'admin' to Administrator -->
<administrator-role>
<user>admin</user>
</administrator-role>
<keyStore id="defaultKeyStore" password="*******" />
<!-- To access this server from a remote client add a host attribute to the following element, e.g. host="*" -->
<httpEndpoint id="defaultHttpEndpoint"
host="*"
httpPort="9080"
httpsPort="9443" />
<!-- Automatically expand WAR files and EAR files -->
<applicationManager autoExpand="false"/>
</server>
【问题讨论】:
-
你能用你的 server.xml 更新你的问题吗?我怀疑你没有启用
servlet-3.1功能 -
添加了 server.xml;和/但是,我能够使用同一台服务器成功部署另一个基于 Spring 的 Web 应用程序。