struts+hibernate項目debug總結
轉:
javax.servlet.ServletException: Cannot retrieve mapping for action /companyNews
struts-config.xml中沒有寫相關companyNews的action.
============================================
在myeclipse增加一個jar包時候,先打開項目properties,選擇java build path --> libraries -->add external JARs 選擇到需要的jar包,加入后,發現,他這個包加載的是絕對路徑,而我們的項目需要cvs共享,無法
commit到cvs服務器。myeclipse有以下提示信息:
2 build path entries are missing.
解決辦法是,關閉myeclipse,用notepad打開項目目錄下的 .classpath, 手動修改成相對路徑,并且檢查,指定的相對路徑中是否真正添加了jar包,
啟動myeclipse就可以上傳新添加的jar包了。
=============================================
在使用junit/StrutsTest時候,報錯:
java.lang.UnsupportedClassVersionError: junit/framework/TestListener (Unsupported major.minor version 49.0)
原因是如果是jdk1.4的話,只能使用junit3.8以下版本,如果是使用jdk1.5的話,必須使用junit4.0以上版本。
==========================================================
Cannot find ActionMappings or ActionformBeans collection
原因是:web.xml文件中沒有配置struts-config.xml的相關信息。
============================================================
org.apache.jasper.JasperException: The absolute uri: http://java.sun.com/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application
缺少jstl的相關jar和web.xml配置
jstl.jar
?
http://java.sun.com/jstl/fmt
?/WEB-INF/fmt.tld
?
http://java.sun.com/jstl/fmt-rt
?/WEB-INF/fmt-rt.tld
?
http://java.sun.com/jstl/core
?/WEB-INF/c.tld
?
http://java.sun.com/jstl/core-rt
?/WEB-INF/c-rt.tld
?
http://java.sun.com/jstl/sql
?/WEB-INF/sql.tld
?
http://java.sun.com/jstl/sql-rt
?/WEB-INF/sql-rt.tld
?
http://java.sun.com/jstl/x
?/WEB-INF/x.tld
?
http://java.sun.com/jstl/x-rt
?/WEB-INF/x-rt.tld
==========================================================
Failed to load or instantiate TagLibraryValidator class: org.apache.taglibs.standard.tlv.JstlCoreTLV
standard.jar沒有放在lib里面
===========================================================
創建oracle表的時候,使用了,role和comment關鍵字,建議不要將這兩個關鍵字作為表名和字段名。
建議用toad或plsql developer創建表,這樣軟件會提示關鍵字。
=============================================================
[ERROR] XMLHelper - Error parsing XML: XML InputStream(18) Attribute name "column" associated with an element type "key" must be followed by the ' = ' character.
[ERROR] Configuration - Could not configure datastore from input stream
must be followed by the ' = ' character. Nested exception: Attribute name "column" associated with an element type "key" must be followed by the ' = ' character.>org.dom4j.DocumentException: Error
on line 18 of document : Attribute name "column" associated with an element type "key" must be followed by the ' = ' character. Nested exception: Attribute name "column" associated with an element
type "key" must be followed by the ' = ' character.
xml 語法錯誤,key語法中應該類似這樣的寫法
=============================================================
hibernate3,對象中一對多的one方,必須寫private Set pays=new HashSet();,否則包錯java.lang.NullPointerException ,
而hibernate2中private Set pays;卻不報錯;
=============================================================
[DEBUG] AbstractSaveEventListener - generated identifier: 1, using strategy: org.hibernate.id.IncrementGenerator
org.hibernate.PropertyValueException: not-null property references a null or transient value: com.xxx.yyy.company
at org.hibernate.engine.Nullability.checkNullability(Nullability.java:72)
中的設置應該設置為not-null="false" ,設置為not-null="true"則報以上錯誤
================================================================
org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: com.xxx.yyy.Company
在save的同時也需要save其他的表,然后再flush()
=========================================================================
Parse Fatal Error at line 12 column 1
struts-config.xml文件被修改,語法錯誤。檢查語法。
========================================
org.hibernate.QueryException: could not resolve property: userid of: com.xxx.yyy.Pay
使用到外鍵userid的時候,必須使用userinfo.userid方法才能得到。
=========================================
javax.naming.NameNotFoundException: Name hibernate_connection_factory is not bound in this Context
原因:hibernate的數據庫映射.xml文件有配置錯誤,導致hibernate_connection_factory無法綁定數據庫。
例如many-to-one設置了以后,仍然在其中設置相沖突的屬性。
==========================================
[WARN] RequestProcessor - Unhandled Exception thrown: class java.lang.NullPointerException
必須將使用到的對象new起來。
============================================
GROUP BY 表達式的查詢必須滿足如下:
select 子句后的每一項必需出現在group by 子句中,除非該項使用了聚集函數。
===========================================
org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: com.xxx.yyy.Company
要級聯保存,多次session.save()
==============================================
java.lang.IllegalArgumentException: id to load is required for loading
原因:
session.load(Company.class,payForm.getCompanyId());
load()方法第二個參數必須是searlizable,并且必須是和數據庫映射類的屬性值類型一致,即使強制轉換都不行。
=============================================
[INFO] DefaultLoadEventListener - Error performing load command
>org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [com.xxx.yyy.Company#0]
表示你現在查詢的對象所關聯的對象有問題,一般是因為數據的問題(該對象所關聯的對象找不到),數據的錯誤,影響了程序正常執行。
========================================================
eclipse 3.1,myeclipse 4錯誤
Deployment is out of date due to changes in the underlying project contents . You'll need to mannally 'Redeploy' the project to update the deployed archive.
原因
tomcat 中部署的某個文件的拒絕訪問影響了部署。
重啟后,去除tomcat中部署的文件。重新在eclipse中設置部署。
為什么需要重啟?
因為:google desktop軟件正在對我部署的一個300MB大文件進行索引,鎖定了這個大文件,我估計google desktop需要對這個文件索引半個小時以上。因此,eclipse無法對過去部署的文件,做先刪除后重新部署的工作。
===================================================
ERROR LazyInitializationException:19 - could not initialize proxy - the owning Session was closed
org.hibernate.LazyInitializationException: could not initialize proxy - the owning Session was closed
解決辦法。
cmpy=(CompanyEdit)ss.load(CompanyEdit.class,companyId1);
? Hibernate.initialize(cmpy);//強制初始化cmpy,否則ss.close()后,cmpy將消失.
====================================================
javascript錯誤
行: 56
字符: 45
錯誤: 未結束的字符串常量
代碼: 0
是編碼的問題!用ANSI編碼另存后就好了。
====================================================
[WARN] JDBCExceptionReporter - SQL Error: 904, SQLState: 42000
[ERROR] JDBCExceptionReporter - ORA-00904: 無效列名
[INFO] DefaultLoadEventListener - Error performing load command
>org.hibernate.exception.SQLGrammarException: could not load an entity: [com.xxx.yyy.Sellinfo#1]
***.hbm.xml文件中的某個列名和數據庫中的不同。
=======================================================
ConnectionManager - unclosed connection, forgot to call close() on your session?
原因:沒有關閉hibernate的session的transaction。或者沒有關閉session
=======================================================
[WARN] SellCommentDAO - org.hibernate.ObjectDeletedException: deleted object would be re-saved by cascade (remove deleted object from associations): [com.xxx.yyy.SellComment#7]
原因:父親對象(one方)設置cascade="save-update" 時,直接刪除子對象時,會報錯,
處理方法:save信息需要級聯操作,delete時候也要用相同的原理。
SellComment sellComment=new SellComment();
sellComment = (SellComment)session.load(SellComment.class,sellCommentId);//獲取兒子對象
Long sellInfoId=sellComment.getSellInfo().getSellId();//獲取父親id
SellInfo sellinfo=(SellInfo)session.load(SellInfo.class,sellInfoId);//獲取父親對象
sellInfo.getSellComments().remove(sellComment);//斷絕父子關系
sellComment.setSellInfo(null);//斷絕子父關系
session.delete(sellComment);//刪除兒子
session.flush();
javax.servlet.ServletException: Cannot retrieve mapping for action /companyNews
struts-config.xml中沒有寫相關companyNews的action.
============================================
在myeclipse增加一個jar包時候,先打開項目properties,選擇java build path --> libraries -->add external JARs 選擇到需要的jar包,加入后,發現,他這個包加載的是絕對路徑,而我們的項目需要cvs共享,無法
commit到cvs服務器。myeclipse有以下提示信息:
2 build path entries are missing.
解決辦法是,關閉myeclipse,用notepad打開項目目錄下的 .classpath, 手動修改成相對路徑,并且檢查,指定的相對路徑中是否真正添加了jar包,
啟動myeclipse就可以上傳新添加的jar包了。
=============================================
在使用junit/StrutsTest時候,報錯:
java.lang.UnsupportedClassVersionError: junit/framework/TestListener (Unsupported major.minor version 49.0)
原因是如果是jdk1.4的話,只能使用junit3.8以下版本,如果是使用jdk1.5的話,必須使用junit4.0以上版本。
==========================================================
Cannot find ActionMappings or ActionformBeans collection
原因是:web.xml文件中沒有配置struts-config.xml的相關信息。
============================================================
org.apache.jasper.JasperException: The absolute uri: http://java.sun.com/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application
缺少jstl的相關jar和web.xml配置
jstl.jar
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
==========================================================
Failed to load or instantiate TagLibraryValidator class: org.apache.taglibs.standard.tlv.JstlCoreTLV
standard.jar沒有放在lib里面
===========================================================
創建oracle表的時候,使用了,role和comment關鍵字,建議不要將這兩個關鍵字作為表名和字段名。
建議用toad或plsql developer創建表,這樣軟件會提示關鍵字。
=============================================================
[ERROR] XMLHelper - Error parsing XML: XML InputStream(18) Attribute name "column" associated with an element type "key" must be followed by the ' = ' character.
[ERROR] Configuration - Could not configure datastore from input stream
must be followed by the ' = ' character. Nested exception: Attribute name "column" associated with an element type "key" must be followed by the ' = ' character.>org.dom4j.DocumentException: Error
on line 18 of document : Attribute name "column" associated with an element type "key" must be followed by the ' = ' character. Nested exception: Attribute name "column" associated with an element
type "key" must be followed by the ' = ' character.
xml 語法錯誤,key語法中應該類似這樣的寫法
=============================================================
hibernate3,對象中一對多的one方,必須寫private Set pays=new HashSet();,否則包錯java.lang.NullPointerException ,
而hibernate2中private Set pays;卻不報錯;
=============================================================
[DEBUG] AbstractSaveEventListener - generated identifier: 1, using strategy: org.hibernate.id.IncrementGenerator
org.hibernate.PropertyValueException: not-null property references a null or transient value: com.xxx.yyy.company
at org.hibernate.engine.Nullability.checkNullability(Nullability.java:72)
================================================================
org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: com.xxx.yyy.Company
在save的同時也需要save其他的表,然后再flush()
=========================================================================
Parse Fatal Error at line 12 column 1
struts-config.xml文件被修改,語法錯誤。檢查語法。
========================================
org.hibernate.QueryException: could not resolve property: userid of: com.xxx.yyy.Pay
使用到外鍵userid的時候,必須使用userinfo.userid方法才能得到。
=========================================
javax.naming.NameNotFoundException: Name hibernate_connection_factory is not bound in this Context
原因:hibernate的數據庫映射.xml文件有配置錯誤,導致hibernate_connection_factory無法綁定數據庫。
例如many-to-one設置了以后,仍然在其中設置相沖突的
==========================================
[WARN] RequestProcessor - Unhandled Exception thrown: class java.lang.NullPointerException
必須將使用到的對象new起來。
============================================
GROUP BY 表達式的查詢必須滿足如下:
select 子句后的每一項必需出現在group by 子句中,除非該項使用了聚集函數。
===========================================
org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: com.xxx.yyy.Company
要級聯保存,多次session.save()
==============================================
java.lang.IllegalArgumentException: id to load is required for loading
原因:
session.load(Company.class,payForm.getCompanyId());
load()方法第二個參數必須是searlizable,并且必須是和數據庫映射類的屬性值類型一致,即使強制轉換都不行。
=============================================
[INFO] DefaultLoadEventListener - Error performing load command
>org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [com.xxx.yyy.Company#0]
表示你現在查詢的對象所關聯的對象有問題,一般是因為數據的問題(該對象所關聯的對象找不到),數據的錯誤,影響了程序正常執行。
========================================================
eclipse 3.1,myeclipse 4錯誤
Deployment is out of date due to changes in the underlying project contents . You'll need to mannally 'Redeploy' the project to update the deployed archive.
原因
tomcat 中部署的某個文件的拒絕訪問影響了部署。
重啟后,去除tomcat中部署的文件。重新在eclipse中設置部署。
為什么需要重啟?
因為:google desktop軟件正在對我部署的一個300MB大文件進行索引,鎖定了這個大文件,我估計google desktop需要對這個文件索引半個小時以上。因此,eclipse無法對過去部署的文件,做先刪除后重新部署的工作。
===================================================
ERROR LazyInitializationException:19 - could not initialize proxy - the owning Session was closed
org.hibernate.LazyInitializationException: could not initialize proxy - the owning Session was closed
解決辦法。
cmpy=(CompanyEdit)ss.load(CompanyEdit.class,companyId1);
? Hibernate.initialize(cmpy);//強制初始化cmpy,否則ss.close()后,cmpy將消失.
====================================================
javascript錯誤
行: 56
字符: 45
錯誤: 未結束的字符串常量
代碼: 0
是編碼的問題!用ANSI編碼另存后就好了。
====================================================
[WARN] JDBCExceptionReporter - SQL Error: 904, SQLState: 42000
[ERROR] JDBCExceptionReporter - ORA-00904: 無效列名
[INFO] DefaultLoadEventListener - Error performing load command
>org.hibernate.exception.SQLGrammarException: could not load an entity: [com.xxx.yyy.Sellinfo#1]
***.hbm.xml文件中的某個列名和數據庫中的不同。
=======================================================
ConnectionManager - unclosed connection, forgot to call close() on your session?
原因:沒有關閉hibernate的session的transaction。或者沒有關閉session
=======================================================
[WARN] SellCommentDAO - org.hibernate.ObjectDeletedException: deleted object would be re-saved by cascade (remove deleted object from associations): [com.xxx.yyy.SellComment#7]
原因:父親對象(one方)設置cascade="save-update" 時,直接刪除子對象時,會報錯,
處理方法:save信息需要級聯操作,delete時候也要用相同的原理。
SellComment sellComment=new SellComment();
sellComment = (SellComment)session.load(SellComment.class,sellCommentId);//獲取兒子對象
Long sellInfoId=sellComment.getSellInfo().getSellId();//獲取父親id
SellInfo sellinfo=(SellInfo)session.load(SellInfo.class,sellInfoId);//獲取父親對象
sellInfo.getSellComments().remove(sellComment);//斷絕父子關系
sellComment.setSellInfo(null);//斷絕子父關系
session.delete(sellComment);//刪除兒子
session.flush();
posted on 2007-03-09 18:12 junky 閱讀(758) 評論(0) 編輯 收藏 所屬分類: hibernate