尝试在 websphere 8.5.5.13 上部署 ear 时出现 AnnotationException?

Rob*_*rto 6 java websphere spring

spring 4.13 上有应用程序 所以,当尝试在 websphere 8.5.5.13 上部署 ear-file 时 - 有错误消息

[12/18/18 14:56:41:946 MSK] 00000086 AnnotationCon E CWMDF0002E:注释处理失败,错误如下:com.ibm.ws.metadata.annotations.AnnotationException:类的注释处理失败:META-INF/版本/9/javax/xml/bind/ModuleUtil.class

这是一个什么样的问题?这可能是应用程序和服务器库的安装错误或错误不兼容?

应用程序有入口点

@Configuration
@EnableWebMvc
@ComponentScan(basePackages = {"spring"})
public class WebAppInitalizer implements WebApplicationInitializer {
    private static final String CONFIG_LOCATION = "spring.config";
    private static final String MAPPING_URL = "/*";

    @Override
    public void onStartup(ServletContext servletContext) throws ServletException {
        System.out.println(">>>>>>>>>>>>>>>>>>>>>>> ONSTARTUP <<<<<<<<<<<<<<<<<<<<<<<<");
        WebApplicationContext context = getContext();
        servletContext.addListener(new ContextLoaderListener(context));
        ServletRegistration.Dynamic dispatcher = servletContext.addServlet("DispatcherServlet", new DispatcherServlet(context));
        dispatcher.setLoadOnStartup(1);
        dispatcher.addMapping(MAPPING_URL);
        System.out.println(">>>>>>>>>>>>>>>>>>>>>>> ONSTARTUP END <<<<<<<<<<<<<<<<<<<<<<<<");
    }

    private AnnotationConfigWebApplicationContext getContext() {
        AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext();
        context.setConfigLocation(CONFIG_LOCATION);
        return context;
    }
}
Run Code Online (Sandbox Code Playgroud)

和配置是

package spring.config;

import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

@Configuration
@ComponentScan(basePackages = "spring")
public class AppConfig {
}


   package spring.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@Configuration
@EnableWebMvc
public class WebConfig extends WebMvcConfigurerAdapter {
}
Run Code Online (Sandbox Code Playgroud)

和测试控制器是:

package spring.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TestController {

    @RequestMapping(value = "/greeting")
    public String healthCheck() {
        return "greeting";
    }

}
Run Code Online (Sandbox Code Playgroud)

jbl*_*lye 7

错误消息是抱怨 META-INF/versions/9 目录下的类。该位置表明您有一个带有 Java V9 类的多版本 JAR。WAS 不支持 Java V9 类,但已添加代码以在多版本 JAR 中容忍它们。

多版本 JAR 直到 WAS 8.5.5 和 WAS 9.0 发布后才存在。为 WAS 8.5.5 创建了五个 APAR,以解决在多版本 JAR 开始添加到应用程序时发现的问题。APAR 列表如下。请注意,8.5.5.14 中包含了 3 个 APAR,另外 2 个包含在 8.5.5.15 中。您可能不需要所有这些。这取决于您的应用程序,在一种情况下,扫描应用程序类的顺序。

WAS V9 有第 6 个 APAR,仅用于性能。它不适用于 WAS 8.5.5。

底线:要完全容忍多版本 JAR,您需要升级到 8.5.5.15 或 9.0.0.10 或应用以下所有 APAR。

  1. PI89708 – 8.5.5.14、9.0.0.7
  2. PI93744 – 8.5.5.14、9.0.0.8
  3. PI96826 – 8.5.5.14、9.0.0.8
  4. PH02014 – 8.5.5.15、9.0.0.10
  5. PH03710 – 8.5.5.15、9.0.0.10
  6. PI98450 - 不适用,9.0.0.9


cov*_*ner 4

您需要在下一个修复包中使用 PI96826

https://www-01.ibm.com/support/docview.wss?uid=swg1PI96826

Java V9 多版本 JAR 包含 META-INF 目录树下的 Java V9 类。Java V9 类的存在导致应用程序启动失败,并出现类似于以下内容的异常: