基于springboot搭建框架问题记录 java.lang.NoClassDefFoundError: javax/el/ELManager

1、集成jersey后访问接口报404

通过注解初始化jersey代码:

//@Component
//@ApplicationPath("/webapi/*")
public class AppResourceConfig extends ResourceConfig {
    public AppResourceConfig() {
        packages("com.zgl.springboot.rs");
        register(MultiPartFeature.class);
    }
}

修改为在Application后,可正常访问:

@Bean
public ServletRegistrationBean jersetServlet(){
   ServletRegistrationBean registration = new ServletRegistrationBean(new ServletContainer(), "/webapi/*");
   // our rest resources will be available in the path /webapi/*
   registration.addInitParameter(ServletProperties.JAXRS_APPLICATION_CLASS, AppResourceConfig.class.getName());
   return registration;
}

2、发布到独立tomcat时,报错 

java.lang.NoSuchMethodError:org.springframework.boot.builder.SpringApplicationBuilder.<init>([Ljava/lang/Object;)V

原代码:

<parent>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-starter-parent</artifactId>
   <version>2.0.3.RELEASE</version>
   <relativePath/> <!-- lookup parent from repository -->
</parent>

修改后代码:

<parent>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-starter-parent</artifactId>
   <version>1.5.14.RELEASE</version>
   <relativePath/> <!-- lookup parent from repository -->
</parent>

3、发布到独立tomcat时,报错

java.lang.NoClassDefFoundError: javax/el/ELManager

tomcat的版本匹配度,7.0版本tomcat的lib下el-api.jar包无该类,发布到tomcat8版本后正常


猜你喜欢

转载自blog.csdn.net/long2010110/article/details/80764709