基于Spring的Web应用程序在WAS Liberty

时间:2018-04-19 16:16:47

标签: spring websphere-liberty

我正在编写一个简单的基于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部署:{ {1}}。

我已尝试对项目进行各种修改,并且在绝望中,我已将其剪切为只有以下源代码:

gradle clean build deploy

您能否告诉我如何解决此服务启动问题?

server.xml中:

@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);
  }
}

1 个答案:

答案 0 :(得分:0)

此错误似乎是由某些构建工具生成带有Servlet 3.1架构的web-fragment.xml引起的。

目前,您已启用jsp-2.2功能,默认情况下会启用servlet-3.0

要解决此问题,我建议从jsp-2.2升级到jsp-2.3(将引入servlet-3.1),或者添加<feature>webProfile-7.0</feature>以启用所有Java EE 7 Web配置文件功能(servlet,JPA,bean验证,cdi,jsf等)。

所以你的新server.xml看起来像这样:

<server description="new server">

    <!-- Enable features -->
    <featureManager>
      <feature>jsp-2.3</feature>
      <feature>adminCenter-1.0</feature>
    </featureManager>

<!-- rest of file unchanged.... -->