常见错误处理
平常碰到的错误处理集合。
tea-Sir
实践才是检验真理的唯一标准。
展开
-
Eclipse 报错: “Workspace in use or cannot be created, chose a different one.”
打开eclipse报错:“Workspace in use or cannot be created, chose a different one.” 意识是“正在使用或无法创建工作区,选择另一个”在删除 .lock文件得时候他会报说 ‘此文件已经被xxxxx占用’,就算你把eclipse关闭了也不行。此时最方便的方法就是关机重启,再删除.lock文件即可,简单无脑。解决办法: 找到你eclipse得工作区,打开 .metadata 文件夹把.lock 文件删除掉。原创 2022-10-27 14:19:51 · 1154 阅读 · 1 评论 -
org.eclipse.swt.SWTError: No more handles的解决
解决方案找到目录 eclipse\workspace.metadata.plugins\org.eclipse.e4.workbench把这个目录下的所有文件删除。原创 2021-08-22 15:59:53 · 1081 阅读 · 0 评论 -
Could not load JDBC driver class [com.mysql.cj.jdbc.Driver]
今天使用JdbcTemplate连接数据库时,配置驱动类,结果报错如下:Could not load JDBC driver class [com.mysql.cj.jdbc.Driver]分析是没有找到驱动类,修改配置如下: dataSource.setDriverClassName("com.mysql.jdbc.Driver");问题出现是因为驱动类跟数据库版本不一致。...原创 2021-08-12 23:30:52 · 532 阅读 · 0 评论 -
java.lang.ClassCastException: com.sun.proxy.$Proxy* cannot be cast to***问题解决方案(spring-ioc+aop动态代理出错)
临床表现:使用Spring AOP动态代理;使用Spring管理的bean类继承自某个接口;Spring容器中有你要代理的bean的id,但是该id不能强制转换成Bean类。病例:定义代理类:@Transactional@Repositorypublic UserDaoImpl implements UserDao extends BaseDaoImpl{/*没有实现任何接口*/}获取代理类:ApplicationContext ctx = new ClassPathXmlApp原创 2021-08-11 23:13:56 · 4548 阅读 · 0 评论 -
Java web项目中出现import javax.servlet 没有导入的错误
问题:在Eclipse中导入一个新项目,项目中出现import javax.servlet 没有导入的错误。分析:在项目lib中没有发现相关servlet依赖包。解决办法:把下载的tomcat文件夹下lib包中的servlet-api.jar添加到web项目中的lib下,重新导入lib就不会爆红了。...原创 2020-07-09 10:53:38 · 1115 阅读 · 0 评论 -
解决Caused by: com.mysql.cj.exceptions.InvalidConnectionAttributeException: The server time zone value
连接数据库遇到如下问题:Caused by: com.mysql.cj.exceptions.InvalidConnectionAttributeException: The server time zone value ‘Öйú±ê׼ʱ¼ä’ is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezon原创 2020-07-06 15:03:09 · 280 阅读 · 0 评论 -
连接mysql数据库报错java.sql.SQLException: The server time zone value '�й���ʱ��' is unrecognized...解决方法
今天mysql遇到了以下问题:java.sql.SQLException: The server time zone value '�й���ʱ��' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the server...原创 2020-04-21 20:27:39 · 1458 阅读 · 0 评论 -
解决org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)错误
!!!此类问题出现的原因是——不细心一般的原因Mapper interface和xml文件的定义对应不上,需要检查包名,namespace,函数名称等能否对应上。按以下步骤一一执行:1、检查xml文件所在的package名称是否和interface对应的package名称一一对应2、检查xml文件的namespace是否和xml文件的package名称一一对应3、检查函数名称能否对应上...原创 2019-08-15 14:17:32 · 344 阅读 · 0 评论 -
idea报“Usage of API documented as @since 1.7”这一问题的解决方法
今天重写equals时,遇到了“Usage of API documented as @since 1.7”这一问题,在此记录一下,报错如下:因为equals方法是jdk1.7后的新特性,而当前开发环境无法解析jdk的新特性或者是开发环境版本较低导致的。解决方法:①查看项目的jdk版本(Ctrl+Alt+shift+S)File ->Project Structure->P...原创 2020-03-02 22:22:58 · 333 阅读 · 0 评论 -
The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path
答案链接:https://blog.csdn.net/testcs_dn/article/details/36455669原创 2019-07-29 17:38:18 · 84 阅读 · 0 评论 -
java.lang.NoSuchMethodException: com.wh.entity.User.<init>()
Caused by: java.lang.NoSuchMethodException: com.wh.entity.User.()at java.lang.Class.getConstructor0(Unknown Source)at java.lang.Class.getDeclaredConstructor(Unknown Source)at org.apache.ibatis.refl...原创 2019-03-03 19:35:24 · 882 阅读 · 0 评论 -
Caused by: org.hibernate.boot.MappingException: Association [com.wh.entity.User.setUserVister] refer
Caused by: org.hibernate.boot.MappingException: Association [com.wh.entity.User.setUserVister] references an unmapped entity [com.wh.entity.User.setUserVister] : origin(com/wh/entity/User.hbm.xml)原因:...原创 2019-02-01 11:40:19 · 340 阅读 · 0 评论 -
Caused by: java.lang.NoClassDefFoundError: org/hibernate/engine/SessionFactoryImplementor
Caused by: java.lang.NoClassDefFoundError: org/hibernate/engine/SessionFactoryImplementor出现这个问题是由于在spring和hibernate整合时版本不一致的原因:class=“org.springframework.orm.hibernate5.LocalSessionFactoryBean”clas...原创 2019-01-24 15:24:30 · 570 阅读 · 0 评论 -
com.mysql.jdbc.exceptions.jdbc4.MySQLTransactionRollbackException: Lock wait timeout exceeded;
这个错误是因为回滚的设置有问题,仔细检查回滚这部分的代码,重新打开服务器测试就没问题了。com.mysql.jdbc.exceptions.jdbc4.MySQLTransactionRollbackException: Lock wait timeout exceeded; try restarting transactionat sun.reflect.GeneratedConstruct...原创 2018-12-20 12:48:03 · 7690 阅读 · 0 评论 -
The method setDate(int, java.sql.Date) in the type PreparedStatement is not applicable for the argum
The method setDate(int, java.sql.Date) in the type PreparedStatement is not applicable for the arguments (int, java.util.Date)preparedStatement.setDate(7, student.getRegdate());出现这种问题是因为Date的两个包 ja...原创 2018-12-21 21:00:00 · 7281 阅读 · 1 评论 -
java.lang.Exception: No tests found matching [{ExactMatcher:fDisplayName=testUSer(java.lang.String)]
java.lang.Exception: No tests found matching [{ExactMatcher:fDisplayName=testUSer(java.lang.String)], {LeadingIdentifierMatcher:fClassName=java.lang.String,fLeadingIdentifier=testUSer]] from org.junit...原创 2018-12-27 20:33:59 · 301 阅读 · 0 评论 -
HTTP Status 404 - /studentManager/login.jsp type Status report message /studentManager/login.jsp
HTTP Status 404 - /studentManager/login.jsptype Status reportmessage /studentManager/login.jspdescription The requested resource is not available.Apache Tomcat/7.0.81出现原因:web.xml文件没有配置。解决方法:重新配置...原创 2018-12-22 13:13:21 · 5390 阅读 · 3 评论 -
java.lang.Exception: No tests found matching错误解决
java.lang.Exception: No tests found matching [{ExactMatcher:fDisplayName=TestRegister], {ExactMatcher:fDisplayName=TestRegister(com.wh.test.TestRegisterService)], {LeadingIdentifierMatcher:fClassName=...原创 2018-12-18 09:00:45 · 855 阅读 · 4 评论 -
java.lang.NoClassDefFoundError: org/springframework/expression/ExpressionParser at org.springframew
java.lang.NoClassDefFoundError: org/springframework/expression/ExpressionParser at org.springframework.context.support.AbstractApplicationContext.prepareBeanFactory(AbstractApplicationContext.java:55...原创 2018-12-23 16:22:20 · 858 阅读 · 0 评论 -
HTML 文档的字符编码未声明。如果该文件包含 US-ASCII 范围之外的字符,该文件将在某些浏览浏览器配置中呈现为乱码。页面的字符编码必须在文档或传输协议层声明。
出现原因是HTML 文档的字符编码未声明,所以会在某些浏览浏览器配置中呈现为乱码。解决方法:为HTML写一个配置文件,防止乱码。response.setContentType("text/html;charset=utf-8");...原创 2018-12-18 10:22:30 · 1465 阅读 · 0 评论 -
提交表单到servlet时出现空白页面,但又不报错
碰到问题时的部分问题代码如下:<form action="<%=request.getContextPath() %>/LoginServlet" onsubmit="return login();" method="post">我在里面加了一段:?function=login后就可以正常运行了。<form action="<%=request原创 2018-12-18 19:42:52 · 6917 阅读 · 0 评论 -
Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cann
Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Access denied for user '16572'@'localhost' 试遍了网上的方法都没有解决我的问题,...原创 2018-12-30 17:06:44 · 8537 阅读 · 0 评论 -
paint画出线后原来正常白色背景变成黑色背景
解决方法:加上super.paint(g);原创 2019-01-13 10:43:15 · 1328 阅读 · 1 评论 -
java.lang.Exception: No tests found matching [{ExactMatcher:fDisplayName=testQueryById],
有时候测试的时候会出现下面的错误,明明代码和环境都没有问题,就是出现不匹配的想象。解决方法:不通过run as打开单元测试,直接运行测试程序,会发现竟然并没有错误。java.lang.Exception: No tests found matching [{ExactMatcher:fDisplayName=testQueryById], {ExactMatcher:fDisplayName=...原创 2018-12-20 10:02:57 · 871 阅读 · 0 评论