原因: 发现 dao 实例、 manage 实例等需要注入的东西没有被注入
解决:这个时候,你应该查看日志文件;默认是应用服务器的 log 文件,比如 Tomcat 就是 [Tomcat 安装目录 ]/logs ;你会发现提示你:
可能是:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sf' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Initialization of bean failed; nested exception is org.hibernate.HibernateException: could not configure from URL: file:src/hibernate.cfg.xml
org.hibernate.HibernateException: could not configure from URL: file:src/hibernate.cfg.xml
……………………….
Caused by: java.io.FileNotFoundException: src\hibernate.cfg.xml
可能是:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Initialization of bean failed; nested exception is org.hibernate.MappingException: Resource: com/mcc/coupon/model/UserRole.hbm.xml not found
org.hibernate.MappingException: Resource: com/mcc/coupon/model/UserRole.hbm.xml not found
然后你就知道原因是因为配置文件的解析出了错误,这个通过 Web 页面是看不出来的。
更多的是持久化影射文件出的错误;导致了没有被解析;当然你需要的功能就无法使用了。
2. 错误:
StandardWrapperValve[action]: Servlet.service() for servlet action threw exception
javax.servlet.jsp.JspException: Cannot retrieve mapping for action /settlementTypeManage
或者:
type Status report
message Servlet action is not available
description The requested resource (Servlet action is not available) is not available.
原因: 同 1
3. 错误
StandardWrapperValve[jsp]: Servlet.service() for servlet jsp threw exception
java.lang.ClassNotFoundException: org.apache.struts.taglib.bean.CookieTei
界面错误具体描述:
org.apache.jasper.JasperException: Failed to load or instantiate TagExtraInfo class: org.apache.struts.taglib.bean.CookieTei
原因与解决:
<方案一>你的“html:”开头的标签没有放在一个<html:form>中
<方案二>重新启动你的应用服务器,自动就没有这个问题了