实现管理系统过程中遇到的问题

相关错误以及解决方法:

错误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

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值