【发布时间】:2019-05-18 23:13:30
【问题描述】:
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/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 {
}
测试控制器是:
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";
}
}
【问题讨论】: