个人错误集
1. 控制台之 tomcat
access: this web application instance has been stopped already. Could not load [].
原因:tomcat线程有遗留存在,停止服务器的运行,重新启动
2、框架之常见错误
类型:NoClassDeFoundError
原因:缺少jar包支持
类型:at com.mysql.cj.jdbc.AbandonedConnectionCleanupThread.checkContextClassLoaders
原因:1、数据库服务未启动
类型:启动tomcat时报错:java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException:A child container failed during start
原因:servlet于jsp的jar包版本协调出错,或引错jar包
类型:SpringMVC Controller中方法return 请求转发页面拦截资源
解决:spring-mvc.xml 中添加资源映射
<!--将css、js、img等资源文件映射到我可以访问到的地方-->
<mvc:resources mapping="/css/**" location="/WEB-INF/css/"/>
<mvc:resources mapping="/js/**" location="/WEB-INF/js/"/>
<mvc:resources mapping="/images/**" location="/WEB-INF/images/"/>
<mvc:resources mapping="/fonts/**" location="/WEB-INF/fonts/"/>
<mvc:resources mapping="/iconfont/**" location="/WEB-INF/iconfont/"/>
类型:pom.xml错误(此问题发现在springboot中)
Downloading: http://maven.aliyun.com/nexus/content/groups/public/org/springframework/boot/spring-boot-starter-parent/2.2.2.RELEASE/spring-boot-starter-parent-2.2.2.RELEASE.pom
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[FATAL] Non-resolvable parent POM for com.enhe.springboot:springboot-web01:1.0.0: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:2.2.2.RELEASE from/to nexus-aliyun (http://maven.aliyun.com/nexus/content/groups/public): maven.aliyun.com and 'parent.relativePath' points at no local POM @ line 6, column 13
原因:阿里云镜像映射
解决:如下图所示:
- 文件所在位置
- 修改:
3、数据传输问题
类型:使用设置表单属性enctype="multipart/form-data"之后传值问题
解决:在spring工程配置文件applicationContext.xml中配置文件上传解析器
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<property name="maxUploadSize" value="10000000"/>
</bean>
4、前端错误
类型:jsp中 #{...} is not allowed in template text
原因:该属性指示在JSP页面的模板文本中是否允许出现字符序列#{。如果该属性的值为false(默认值),当模板文本中出现字符序列#{时,将引发页面转换错误。
注意,该属性是在JSP 2.1规范中引入的,JSP 2.1规范对JSP 2.0和Java Server Faces 1.1中的表达式语言进行了统一。在JSP 2.1中,字符序列#{被保留给表达式语言使用,你不能在模板本中使用字符序列#{。如果JSP页面运行在JSP 2.1之前版本的容器中,则没有这个限制。对于JSP 2.1的容器,如果在模板文本中需要出现字符序列 #{ ,那么可以将该属性设置为true。
解决:<%@ page contentType="text/html;charset=UTF-8" language="java" deferredSyntaxAllowedAsLiteral="true"%>
类型:<fmt:formatDate /> 无法解析符号,排除无jar包问题
解决:<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt_rt" %>
头部添加此引用,如有请删除使用此引用替换
问题:前端向后端传值乱码,字符集不匹配问题
具体问题:对象属性装填乱码
解决:将装填对象属性的对应的set方法中做字符集转换
/**
* 解决了从前端向后端传值乱码的问题,将字符编码转换
* @param name
*/
public void setName(String name) {
try {
name = new String(name.getBytes("ISO8859_1") , "utf-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
this.name = name;
}
5、腾讯COS存储
问题:储存对象链接不能直接访问
原因:权限私有
解决:将权限扩大
-
问题类型:对象地址不能直接访问,访问受限,对象内容不出现
-
首先:找到该存储桶的权限管理
-
其次:将权限修改为第二个或者第三个