非常感謝你的閱讀,如果你覺得好或者對你有幫助,請積極給一個留言反饋以示鼓勵。
1.?????
錯誤:
java.lang.NullPointerException
原因:
發現
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>中
????
<方案二>重新啟動你的應用服務器,自動就沒有這個問題了
4.????? 錯誤:
Exception in thread "main" org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update
原因與解決:
??? 因為Hibernate Tools(或者Eclipse本身的Database Explorer)生成*.hbn.xml工具中包含有catalog="***"(*表示數據庫名稱)這樣的屬性,將該屬性刪除就可以了
5.????? 錯誤:
org.hibernate.ObjectDeletedException: deleted object would be re-saved by cascade (remove deleted object from associations)
原因與解決:
方法1 刪除Set方的cascade
方法2 解決關聯關系后,再刪除
方法3 在many-to-one方增加cascade 但值不能是none
最后一招:
檢查一下hashCode equals是否使用了id作為唯一標示的選項了;我用uuid.hex時是沒有問題的;但是用了native,就不行了,怎么辦?刪除??!
這個錯誤可以參見我的blog文章:
http://www.tkk7.com/crazycy/archive/2006/06/24/54939.html
6.????? 錯誤:
exception javax.servlet.ServletException: BeanUtils.populat
root cause
java.lang.IllegalArgumentException:Cannot invoke ***Form.set*** - argument type mismatch
原因
????? 這個問題很奇怪的說,為啥說奇怪呢?
????? 先說問題的原因:問題發生如下兩種情況:
???????? Form中是Date類型
???????? 上傳文件時
為什么說奇怪呢?主要針對Form是日期型的來說的;因為我做過N多系統Form中都是用java.util.Date,界面使用<html:text property=”date”/>;都是沒有問題的。所以第一次遇到這個錯誤時,搗鼓了一個下午。
解決:
第一個問題:你把Date換成String;在Action中進行轉換;當然轉換要借助于SimpleDateFormate方法嘍
第二個問題:記得在form中增加enctype="multipart/form-data" 呵呵
7.????? 問題:
今天用Tomcat5.5.12,發現原來很好用的系統不能用了,反復測試發現頁面中不能包含 taglib,否則會出現以下提示:
HTTP Status 500 -type Exception report
Message ?
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: /index.jsp(1,1) Unable to read TLD "META-INF/tlds/struts-bean.tld" from JAR file "file:*****/WEB-INF/lib/struts.jar":
原因:
更新了工程用的lib文件夾下的jar,發布時也發布了servlet.jar和jsp-api.jar。
解決:
把jsp-api.jar刪除就解決這個問題了。
8.????? 問題:Tomcat5.0.20中差錯可以通過[Tomcat安裝目錄]/logs下的localhost_log.2006-07-14.txt類似的文件看具體的錯誤日志,但是在5.5中就找不到了
原因與解決:
我把[Tomcat安裝目錄]/bin下的tomcat5w.exe的logging標簽搗鼓了一會,然后重起就有了。
原因具體說不準,用非安裝版也有這個問題。
最終解決方案:
???http://tomcat.apache.org/tomcat-5.5-doc/logging.html
???
???Thanks very much to visit blog,? welcome your feedback,? your feedback is the Driver && Power to me