2015.11.04日
404是浏览器无法连接到服务器,500是IIS无法解析ASP,总结了一下自己的错误,
404:
1.hibernate配置文件配错,多写了主键
2.spring里面JSP跳转配错
3.DAO层没有继承HibernateDaoSupport类
4.vo层和Hibernate配置文件缺少实体映射联系
500:
1.Action里面注入的方法跟struts里面注入的方法写错了。
2.hibernate配置文件用了数据库的关键字order
对于404和500的区分还不是很明显,需要后来在根据实战经验来理解。
2015.10.30日
详细错误
错误1:“The prefix"context" for element "context:property-placeholder" is notbound. ”
解决:
只需要在文件头中引入:xmlns:context="http://www.springframework.org/schema/context"即可
错误2:Element 'beans' cannothave character [children],because the type's content type is element-only
解决:注释写错了。
错误3:Invalid content was found starting with element'prop'.
解决:
源代码
修改后代码
错误4:
HTTP Status 500 - Unableto instantiate Action, userAction, defined for 'user_registPage' in namespace'/'Cannot find class [cn.itcast.shop.user.action.IndexAction] for bean withname 'userAction' defined in class path resource [applicationContext.xml]; nestedexception is java.lang.ClassNotFoundException:cn.itcast.shop.user.action.IndexAction
解决:
spring
Struts
其中【*】号代表占位符,而【{1}】表示【*】所对于的action中的方法.
错误5:
HTTP Status 500 - Unableto instantiate Action, userAction, defined for 'user_registPage' in namespace'/'Error creating bean with name 'userAction' defined in class path resource[applicationContext.xml]: Instantiation of bean failed; nested exception isorg.springframework.beans.BeanInstantiationException: Could not instantiatebean class [cn.itcast.shop.user.action.UserAction]: Constructor threwexception; nested exception is java.lang.Error: Unresolved compilation problem:
解决:
重新修改applicationContext.xml,把有关的Action,service,dao文件的注入重新粘贴了一遍,检查了一下各个具体的类文件里面是否有对应的注入。问题就解决了。
错误6:
解决:Hibernate配置文件错误。里面多配置一个参数,删掉就可以了。
错误7:
HTTP Status 404 - Noresult defined for action cn.itcast.shop.user.action.UserAction and resultinput
解决:Spring配置文件错误。
错误8:
显示404
Error creating bean with name 'sessionFactory' defined in class pathresource [applicationContext.xml]: Invocation of init method failed; neste
解决:
方法1:继承HibernateDaoSupport这个类
方法2:Vo层缺少外键属性,缺少实体关系。
Hibernate配置文件:product.hbm.xml
<!-- order-by用于排序--><!-- many-to-one是多对一的关系,懒加载,关联类都查出来 -->
错误9
could not insert: [cn.itcast.shop.order.vo.Order]; SQL [insert intoorders (total, ordertime, state, name, addr, phone, uid) values (?, ?, ?, ?, ?,?, ?)]; nested exception is org.hibernate.exception.DataException: could notinsert: [cn.itcast.shop.order.vo.Order]
解决:
总结
bug很多,这些都是帮助我们成长的阶梯。More bugs more improvement!
------------------------------------------常见的http错误-----------------------------------------------------------
400 Bad request(错误请求)
401.1 Logon failed(登录失败)
401.2 Logon failed due to server configuration(由于服务器配置,登录失败)
401.3 Unauthorized due to ACL on resource(由于资源上的 ACL,未授权)
401.4 Authorization failed by filter(由于筛选器,授权失败)
401.5 Authorization failed by ISAPI/CGI application (由于 ISAPI/CGI 应用程序,授权失败)
403.1 Execute access forbidden(执行访问被禁止)
403.2 Read access forbidden(读取访问被禁止)
403.3 Write access forbidden(写入访问被禁止)
403.4 SSL required(要求 SSL )
403.5 SSL 128 required(要求 SSL 128)
403.6 IP address rejected (IP 地址被拒绝)
403.7 Client certificate required(要求客户证书)
403.8 Site access denied(站点访问被拒绝)
403.9 Too many users(用户太多)
403.10 Invalid configuration(无效的配置)
403.11 Password change(密码更改)
403.12 Mapper denied access(映射程序拒绝访问)
403.13 Client certificate revoked(客户证书被取消)
403.14 Directory listing denied(目录列表被拒绝)
403.15 Client Access Licenses exceeded(超出客户访问许可证)
403.16 Client certificate untrusted or invalid(客户证书不受信任或无效)
403.17 Client certificate has expired or is not yet valid(客户证书已过期或无效)
404 Not found(没有找到)
404.1 Site not found(站点没有找到)
405 Method not allowed(不允许使用该方法)
406 Not acceptable(不接受)
407 Proxy authentication required(要求代理身份验证)
412 Precondition Failed(前提条件不正确)
414 Request-URL too long(请求的 URL 太长)
500 Internal server error(内部服务器错误)
500.12 Application restarting(应用程序重新启动)
500.13 Server too busy(服务器太忙)
500.15 Requests for Global.asa not allowed(不允许请求 Global.asa)
500-100.asp ASP 错误
501 Not implemented(没有实施)
502 Bad gateway(错误网关)
----------------------------------原来错误也这样有规律~嘎嘎开心--------------------------------------------------