相关错误以及解决方法:
错误1.
org.hibernate.MappingException: Could not determine type for: String, at table: information, for columns: [org.hibernate.mapping.Column(delaycause)]
解决方法:配置文件Information.hbm.xml中的字段delaycause的类型应该为string,而非String.
错误2:
Could not parse mapping document from resource com/threat/org/po/Users.hbm.xml
解决方法:在Users.hbm.xml中 将每个对应的列名和数据库中的列名一一对应。
错误3:
严重: Servlet.service() for servlet [action] in context with path [/secureSys] threw exception [org.hibernate.hql.ast.QuerySyntaxException: users is not mapped [select u from users as u order by createtime]] with root cause
org.hibernate.hql.ast.QuerySyntaxException: users is not mapped [select u from users as u order by createtime]
解决方法:http://blog.csdn.net/kiss_vicente/article/details/6942666
将select u from users as u order by createtime中的user改成User
错误 4:严重: Servlet.service() for servlet [action] in context with path [/secureSys] threw exception [org.apache.struts.chain.commands.InvalidPathException: No action config found for the specified url.] with root cause
org.apache.struts.chain.commands.InvalidPathException: No action config found for the specified url.
解决方法: leftTitle中的url写错了,将原先的addInfo修改为addinformation。所有的Info修改为information。
错误5:严重: Servlet.service() for servlet [action] in context with path [/secureSys] threw exception [org.hibernate.exception.SQLGrammarException: could not execute query] with root cause
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'informatio0_.number' in 'field list'
解决方法:在listinformation.jsp中添加 <td height="22" align="center" >执行操作</td> 在运行就可以了。
错误6:严重: Servlet.service() for servlet [action] in context with path [/secureSys] threw exception [org.hibernate.hql.ast.QuerySyntaxException: Invalid path: 'e.number' [select i from com.threat.org.po.Information as i order by e.number]] with root cause
org.hibernate.hql.ast.QuerySyntaxException: Invalid path: 'e.number' [select i from com.threat.org.po.Information as i order by e.number]
解决方法:修改为select i from com.threat.org.po.Information as i order by e.reporttime.
错误7:严重: Servlet.service() for servlet [action] in context with path [/secureSys] threw exception [org.hibernate.exception.SQLGrammarException: could not execute query] with root cause
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'as 隐患名称3_1_, informatio0_.隐患上报人* as 隐患上报人4_1_, infor' at line 1
解决方法:配置文件information.hbm.xml中的name和数据库中的字段不相同,加入column=‘数据库中的字段名’
可以尝试select '隐患上报人' from information在数据库中运行,如果运行不成功,则存在问题。通过修改字段名来完成配置文件中的列和数据库中的字段想对应。
修改字段的数据库语句为:alter table information change '危害
程度' ‘危害程度’ varchar(100)
因为我的数据库中的原字段写法为‘危害
程度’ ,即中间有转行,所以这里也需要这要写。
错误8:Value '62 20150930_0089寰佷俊绯荤粺涓撶綉娴嬭瘯鏁版嵁搴撴病鏈夋惌寤哄鐏剧幆澧?褰渤璐?2015-09-30 楂樺彲鐢?浣庝寰佷俊绯荤粺涓撶綉娴嬭瘯鏁版嵁搴撶幆澧冩病鏈夋惌寤哄鐏剧幆澧冿紝涓嶅埄浜庣敓浜х幆澧冨簲鎬ュ垏鎹㈡柟闈㈢殑鍏堣娴嬭瘯鍜岄棶棰樺垎鏋愶紱涓嶅叿澶囬珮绛夌骇鐨勫彲鐢ㄦ?锛屽奖鍝嶆祴璇曞鎴峰拰绋嬪簭寮?彂浜哄憳鐨勬甯镐娇鐢ㄣ?杩愯缁存姢涓績 褰渤璐蝶 鏆備笉澶勭悊
0000-00-00鸔鍙互浣跨敤鐢熶骇鐜鏇挎崲璁惧鎼缓瀹圭伨鐜锛屾棤闇?喘涔版柊璁惧銆傷 ' can not be represented as java.sql.Timestamp
解决方法:http://www.blogjava.net/dashi99/archive/2009/06/20/283355.html
试过上面的方法,无法解决,查看数据库后,发现数据库中确实存在0000-00-00这样的数据,之所以存在该数据,是因为原数据在时间字段(设置类型为date)中添加了文字,导致导入时无法识别文字,因此将文字转换为了0000-00-00,于是乎,将数据表中的所有的0000-00-00全部更改为null,具体的修改的语句:
-看笔记本
修改完成后,在运行就不会出现错误了。
错误9:Data truncated for column ‘整改预计费用(万元)' at row 1
解决方法:因数据库中字段的类型为double,而在java后台中设置的该字段类型为String,因不一致导致了错误。将字段类型改成一致即可成功。
错误10:严重: Servlet.service() for servlet [action] in context with path [/secureSys] threw exception [org.apache.jasper.JasperException: javax.servlet.ServletException: java.lang.NoSuchMethodError: com.threat.org.po.Information.getCost()Ljava/lang/String;] with root cause
java.lang.NoSuchMethodError: com.threat.org.po.Information.getCost()Ljava/lang/String;
解决方法:重新在Informtion,java中生成了cost的getter和setter方法。
错误11:严重: Servlet.service() for servlet [action] in context with path [/secureSys] threw exception [Servlet execution threw an exception] with root cause
java.lang.NoSuchMethodError: antlr.collections.AST.getLine()I
解决方法:参考http://blog.csdn.net/hnzhangshilong/article/details/6694731,http://blog.csdn.net/zongzhankui/article/details/6099552
我的解决方法:Hibernate 3.2.7Libraries中将antlr-2.7.6jar(存储位置为:E:\MyEclipse 2015\configuration\org.eclipse.osgi\47\0\.cp\myeclipse-data\3.2\lib\core)替换到Struts 1.3.8Libraries中的antlr-2.7.2.jar(其存储位置为:E:\MyEclipse 2015\configuration\org.eclipse.osgi\25\0\.cp\data\1.3\lib),该jar包删除,并将替换的jar包更改名称为antlr-2.7.2.jar。
错误12:http://blog.sina.com.cn/s/blog_794d4bfd0102uz4i.html