caoni大业 spring boot 跳坑记
IDEA环境
win10 跑得刚刚,到xp系统就戈壁
报错
Caused by: java.lang.NoSuchMethodError: javax.servlet.ServletContext.getVirtualServerName()Ljava/lang/String;
原因:tomcat版本引起
解决加入
<properties>
<tomcat.version>7.0.69</tomcat.version>
</properties>
又报错
Caused by: java.lang.NoClassDefFoundError: org/apache/juli/logging/LogFactory
解决加入
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-juli</artifactId>
<version>7.0.69</version>
</dependency>
又报错
Caused by: java.lang.NoClassDefFoundError: javax/el/ELManager
解决将spring-boot降到
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.2.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
至此可正常运行
付源码 Sb20180328Application.java
@RestController
@SpringBootApplication
public class Sb20180328Application { public static void main(String[] args) {
SpringApplication.run(Sb20180328Application.class, args);
} @RequestMapping(value = "/",produces = "text/plain;charset=UTF-8")
String index(){
return "Hello Spring Boot!";
}
}
引入springboot修改tomcat版本
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>${springboot.version}</version> <exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency> <dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-core</artifactId>
<version>${tomcat.version}</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-el</artifactId>
<version>${tomcat.version}</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-websocket</artifactId>
<version>${tomcat.version}</version>
</dependency> <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>1.4.2.RELEASE</version>
<scope>test</scope>
</dependency> <dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-juli</artifactId>
<version>${tomcat.version}</version>
</dependency> </dependencies>
拦截器中的跳转
httpServletResponse.sendRedirect("/err/cscascd");
不管用,应该用
httpServletRequest.getRequestDispatcher("/err/cscascd").forward(httpServletRequest,httpServletResponse);
=20181127===附加解决办法
2.x版本需要1.8的jdk,但一定要到72版本以上,否则
java.lang.NoSuchMethodError: javax.servlet.ServletContext.getVirtualServerName()Ljava/lang/String
还有需要下载tcnative-1.dll到 c:\windiws\system32下面,注意版本,否则会报错啥APR什么玩意的错误
http://mirrors.shu.edu.cn/apache/tomcat/tomcat-connectors/native/1.2.18/binaries/tomcat-native-1.2.18-openssl-1.0.2p-win32-bin.zip
caoni大业 spring boot 跳坑记的更多相关文章
- spring boot踩坑记
Resolved exception caused by handler execution: org.springframework.http.converter.HttpMessageNotWri ...
- Spring boot采坑记--- 在启动时RequstMappingHandlerMapping无法找到部分contorller类文件的解决方案
最近有一个心得需求,需要在一个现有的springboot项目中增加一些新的功能,于是就在controller文件包下面创建新的包和类文件,但是后端开发完之后,本地测试发现前端访问报404错误,第一反应 ...
- Spring @Transactional踩坑记
@Transactional踩坑记 总述 Spring在1.2引入@Transactional注解, 该注解的引入使得我们可以简单地通过在方法或者类上添加@Transactional注解,实现事务 ...
- Spring Boot学习随记
由于早年在管理领域耕耘了一段时间,完美错过了Spring的活跃期, 多少对这个经典的技术带有一种遗憾的心态在里面的, 从下面的我的生涯手绘图中大概可以看出来我的经历. 最近由于新介入到了工业数字化领域 ...
- Spring Boot踩坑之路一
Takes an opinionated view of building production-ready Spring applications. Spring Boot favors conve ...
- spring boot 采坑
2019年2月19日19:25:42 版本 2.1.3.RELEASE 1,本地开发需要加依赖库,保存实时热更新 <dependency> <groupId>org.sprin ...
- Spring Boot 踩坑之路之 Configuration Annotation Proessor not found in classpath
1. 出现spring boot Configuration Annotation Proessor not found in classpath的提示是在用了@ConfigurationProper ...
- Spring Boot 学习随记
微架构的思想在各大互联网公司越来越普及,特此记录Spring Boot的一些细节问题! 网上spring-boot的教程一堆一堆,就没有必要再详细记录了 1:建议通过Idea 来创建spring-bo ...
- 小程序红包开发跳坑记 微信小程序红包接口开发过程中遇到的问题 微信小程序红包开发
现在做小程序的越来越多,商家推广也是一个瓶颈,谁不发点红包,都很难找到人来用你的微信小程序了.于是不管你开发什么小程序功能,你或多或少都要用到小程序来发红包吧. 我们自己之前做公众号发红包,做了两三 ...
随机推荐
- Windows驱动开发
http://blog.csdn.net/sagittarius_warrior/article/details/51000241
- C#编程经验-enum and struct
enum,store fixed values,use array replace,not use this data-structurestruct,store several variables, ...
- SpringCloud和Springboot
SpringBoot+SpringCloud+SpringMVC+SpringData 我们把这种架构也称之为spring全家桶 什么是SpringCloudSpring Cloud是一系列框架的有序 ...
- greendao3.2.0使用
源代码地址 https://github.com/greenrobot/greenDAO buildscript { repositories { jcenter() mavenCentral() } ...
- [UE4]瞬移
1.设置Input,事件名称设置为Teleport 2.设置事件Teleport 3.
- .net 调用 Matlab生成dll出现的问题(The type initializer for 'MathWorks.MATLAB.NET.Utility.MWMCR' threw an exception.)
https://cn.mathworks.com/matlabcentral/answers/278399-i-get-an-error-saying-the-type-initializer-for ...
- 04-模拟String去除空格trim()方法
/** * 模拟String去除左右两边空格 * @param str */ public static String trim(String str) { char[] list = str.toC ...
- 用GDB调试程序(三)
四.维护停止点 上面说了如何设置程序的停止点,GDB中的停止点也就是上述的三类.在GDB中,如果你觉得已定义好的停止点没有用了,你可以使用delete.clear.disable.enable这几个命 ...
- 教你phpstudy如何搭建本地多站点
经常做多个网站同时开发,如何才能在本地能使部署多个站点,今天就来分享一下如何用PHPstudy搭建本地多站点. 点击上图中的 其它选项菜单 ,就会弹出下面的对话框,然后点击 站点域名管理 然后在 网站 ...
- Ubuntu 14.03 安装jdk
安装python-software-properties $sudo apt-get install python-software-properties $sudo apt-get install ...