如果我离开" spring-boot-starter-tomcat"插件依赖项设置为gradle构建文件中的编译我收到以下错误消息部署到独立的Tomcat 7服务器:
INFO: validateJarFile(/usr/share/tomcat/webapps/ROOT/WEB-INF/lib/tomcat-embed-core-8.0.36.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/servlet/Servlet.class
Aug 18, 2016 2:51:19 AM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(/usr/share/tomcat/webapps/ROOT/WEB-INF/lib/tomcat-embed-el-8.0.36.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/el/Expression.class
如果我将依赖项更改为提供,我可以部署到Tomcat,但尝试在IntelliJ IDEA 15中运行或调试时出现以下错误:
ERROR org.springframework.boot.SpringApplication - Application startup failed
org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [orderserver.Application]; nested exception is java.lang.IllegalStateException: Failed to introspect annotated methods on class org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport
...
Caused by: java.lang.IllegalStateException: Failed to introspect annotated methods on class org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport
...
Caused by: java.lang.NoClassDefFoundError: javax/servlet/ServletContext
...
Caused by: java.lang.ClassNotFoundException: javax.servlet.ServletContext
如何在保留在IDEA中运行/调试的能力的同时从war文件生成中排除这些依赖项?
更好的办法是生成一个单独的war文件,该文件嵌入了Tomcat以进行独立执行,也可以部署到Tomcat容器中吗?
答案 0 :(得分:0)
通过将依赖关系更改为提供并使用" Grails"解决了此问题。运行/调试配置而不是"应用程序"使用IDEA 15创建项目时设置的配置。