欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

常见的异常

程序员文章站 2022-04-30 09:09:52
...

1、 ClassNotFoundException: oracle.jdbc.oracleDriver
解决方法:1) 检查Class.forName(“”)参数中的全限定名拼写
2) 检查是否导ojdbc.jar包
2、 SQLException:No suitable driver found for jdbc:oracdle:thin:@localhost:1521:xe
解决方法:检查url字符串
3、 SQLException: IO 错误: The Network Adapter could not establish the connection
解决方法:检查ip地址或port端口号

5、 SQLException:值过多 标识符无效 表或视图不存在…………
并且,使用异常堆栈信息,定位错误行到 stm.executeUpdate/Query
解决方法:检查SQL语句

6、 SQLException: 索引中丢失 IN 或 OUT 参数:: 1
解决方法:检查是否给所有的?占位符,都设置值
7.java.net.BindException: Address already in use: JVM_Bind 端口冲突
解决方法:重启电脑即可
8.1.java.lang.NullPointerException 空指针异常
如果接收的数据类型是对象
解决方法:
1.检查表单的name属性是否和对象的属性以及接收数据的类型一致
比如:name=user.name (相当于user.setName(name))
2.检查form表单的访问路径是否和structs的action的name属性一致

	3.return的跳转的属性是否和result的name属性一致,以及跳转方式(type)是否考虑到点数据传递或者重定向
	4.null.方法();	

2.如果接收的数据类型是其他
解决方法:
解决方法同上(例子除外)

9.ClassCastNotFound:
检查Action中的类型转换是否和DAO层以及对象的类型一致
10. Cause: java.sql.SQLException: ORA-00933: SQL 命令未正确结束
检查Mapper文件是
11. UsersDAO is not known to the MapperRegistry.
检查DAOMapper是否注册
12,java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for com.baizhi.userdao.UsersDAO.update
检查DAO接口实现类声明的实现接口是否正确
13.无效的列类型: 1111]
,jdbcType=VARCHAR ,jdbcType=NUMERIC
14.Expected one result (or null) to be returned by selectOne(), but found: 2
重复数据
15. Unsupported major
jdk版本太低了
项目中jre 移除
Bulid Path 中Configure Bulid Path
add Library 选jre 选INstalled Jre add Standard VM 1.7路径 找能看到bin的目录
16. Address already in use: bind 端口冲突
运行cmd, 输入netstat -ano看那个端口冲突
17 set names utf8; 乱码
18 . 1.建库utf8
2.建表
utf8
create table(…)engin=innodb default charset=utf8;
3.url==jdbc:mysql://192.168.52.128:3306/db139?useUnicode=true&characterEncoding=utf8
& == &

19.Exception异常
下标越界 空指针 类型转换异常 数字格式转换异常