gpt4 book ai didi

java - 尝试在 websphere 8.5.5.13 上部署 Ear 时出现 AnnotationException?

转载 作者:行者123 更新时间:2023-12-02 00:45:37 27 4
gpt4 key购买 nike

spring 4.13有申请因此,当尝试在 websphere 8.5.5.13 上部署 Ear-file 时 - 出现错误消息

[12/18/18 14:56:41:946 MSK] 00000086 AnnotationCon E CWMDF0002E: Annotation processing failed with the following error: com.ibm.ws.metadata.annotations.AnnotationException: Annotation processing failed for class: META-INF/versions/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;
}
}

配置是

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 {
}

测试 Controller 是:

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";
}

}

最佳答案

错误消息提示 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 列表如下。请注意,3 个 APAR 包含在 8.5.5.14 中,另外 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

关于java - 尝试在 websphere 8.5.5.13 上部署 Ear 时出现 AnnotationException?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57900488/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com