日韩黑丝制服一区视频播放|日韩欧美人妻丝袜视频在线观看|九九影院一级蜜桃|亚洲中文在线导航|青草草视频在线观看|婷婷五月色伊人网站|日本一区二区在线|国产AV一二三四区毛片|正在播放久草视频|亚洲色图精品一区

分享

struts+hibernate項(xiàng)目debug總結(jié)

 Long_way 2007-04-23

轉(zhuǎn):

javax.servlet.ServletException: Cannot retrieve mapping for action /companyNews

struts-config.xml中沒有寫相關(guān)companyNews的action.

============================================
在myeclipse 增加一個(gè)jar包時(shí)候,先打開項(xiàng)目properties,選擇java build path --> libraries -->add external JARs 選擇到需要的jar包,加入后,發(fā)現(xiàn),他這個(gè)包加載的是絕對(duì)路徑,而我們的項(xiàng)目需要cvs共享,無法

commit到cvs服務(wù)器。myeclipse有以下提示信息:
2 build path entries are missing.

解決辦法是,關(guān)閉myeclipse,用notepad打開項(xiàng)目目錄下的 .classpath, 手動(dòng)修改成相對(duì)路徑,并且檢查,指定的相對(duì)路徑中是否真正添加了jar包,
啟動(dòng)myeclipse就可以上傳新添加的jar包了。


=============================================
在使用junit/StrutsTest時(shí)候,報(bào)錯(cuò):
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的相關(guān)信息。


============================================================

org.apache.jasper.JasperException: The absolute uri:
http://java./jstl/core cannot be resolved in either web.xml or the jar files deployed with this application


缺少jstl的相關(guān)jar和web.xml配置
jstl.jar
<taglib>
  <taglib-uri>
http://java./jstl/fmt</taglib-uri>
  <taglib-location>/WEB-INF/fmt.tld</taglib-location>
</taglib>

<taglib>
  <taglib-uri>
http://java./jstl/fmt-rt</taglib-uri>
  <taglib-location>/WEB-INF/fmt-rt.tld</taglib-location>
</taglib>

<taglib>
  <taglib-uri>
http://java./jstl/core</taglib-uri>
  <taglib-location>/WEB-INF/c.tld</taglib-location>
</taglib>

<taglib>
  <taglib-uri>
http://java./jstl/core-rt</taglib-uri>
  <taglib-location>/WEB-INF/c-rt.tld</taglib-location>
</taglib>

<taglib>
  <taglib-uri>
http://java./jstl/sql</taglib-uri>
  <taglib-location>/WEB-INF/sql.tld</taglib-location>
</taglib>

<taglib>
  <taglib-uri>
http://java./jstl/sql-rt</taglib-uri>
  <taglib-location>/WEB-INF/sql-rt.tld</taglib-location>
</taglib>

<taglib>
  <taglib-uri>
http://java./jstl/x</taglib-uri>
  <taglib-location>/WEB-INF/x.tld</taglib-location>
</taglib>

<taglib>
  <taglib-uri>
http://java./jstl/x-rt</taglib-uri>
  <taglib-location>/WEB-INF/x-rt.tld</taglib-location>
</taglib>


==========================================================

Failed to load or instantiate TagLibraryValidator class: org.apache.taglibs.standard.tlv.JstlCoreTLV


standard.jar沒有放在lib里面


===========================================================

創(chuàng)建oracle表的時(shí)候,使用了,role和comment關(guān)鍵字,建議不要將這兩個(gè)關(guān)鍵字作為表名和字段名。
建議用toad或plsql developer創(chuàng)建表,這樣軟件會(huì)提示關(guān)鍵字。
=============================================================

[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 <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.>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 語法錯(cuò)誤,key語法中應(yīng)該類似這樣的寫法 <key column="id">
=============================================================
hibernate3,對(duì)象中一對(duì)多的one方,必須寫private Set pays=new HashSet();,否則包錯(cuò)java.lang.NullPointerException ,
而hibernate2中private Set pays;卻不報(bào)錯(cuò);

=============================================================
[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)

<many to one >中的設(shè)置應(yīng)該設(shè)置為not-null="false" ,設(shè)置為not-null="true"則報(bào)以上錯(cuò)誤
================================================================


org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: com.xxx.yyy.Company

在save的同時(shí)也需要save其他的表,然后再flush()
=========================================================================

Parse Fatal Error at line 12 column 1

struts-config.xml文件被修改,語法錯(cuò)誤。檢查語法。

========================================

org.hibernate.QueryException: could not resolve property: userid of: com.xxx.yyy.Pay

使用到外鍵userid的時(shí)候,必須使用userinfo.userid方法才能得到。

=========================================
javax.naming.NameNotFoundException: Name hibernate_connection_factory is not bound in this Context
原因:hibernate的數(shù)據(jù)庫映射.xml文件有配置錯(cuò)誤,導(dǎo)致hibernate_connection_factory無法綁定數(shù)據(jù)庫。
例如many-to-one設(shè)置了以后,仍然在其中設(shè)置相沖突的<property>屬性。

==========================================

[WARN] RequestProcessor - Unhandled Exception thrown: class java.lang.NullPointerException
必須將使用到的對(duì)象new起來。

============================================
GROUP BY 表達(dá)式的查詢必須滿足如下:
select 子句后的每一項(xiàng)必需出現(xiàn)在group by 子句中,除非該項(xiàng)使用了聚集函數(shù)。

===========================================
org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: com.xxx.yyy.Company

要級(jí)聯(lián)保存,多次session.save()
==============================================
java.lang.IllegalArgumentException: id to load is required for loading
原因:

session.load(Company.class,payForm.getCompanyId());
load()方法第二個(gè)參數(shù)必須是searlizable,并且必須是和數(shù)據(jù)庫映射類的屬性值類型一致,即使強(qiáng)制轉(zhuǎn)換都不行。


=============================================
[INFO] DefaultLoadEventListener - Error performing load command <org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [com.xxx.yyy.Company#0]

>org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [com.xxx.yyy.Company#0]


表示你現(xiàn)在查詢的對(duì)象所關(guān)聯(lián)的對(duì)象有問題,一般是因?yàn)閿?shù)據(jù)的問題(該對(duì)象所關(guān)聯(lián)的對(duì)象找不到),數(shù)據(jù)的錯(cuò)誤,影響了程序正常執(zhí)行。

========================================================
eclipse 3.1,myeclipse 4錯(cuò)誤
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 中部署的某個(gè)文件的拒絕訪問影響了部署。
重啟后,去除tomcat中部署的文件。重新在eclipse中設(shè)置部署。
為什么需要重啟?
因?yàn)椋篻oogle desktop軟件正在對(duì)我部署的一個(gè)300MB大文件進(jìn)行索引,鎖定了這個(gè)大文件,我估計(jì)google desktop需要對(duì)這個(gè)文件索引半個(gè)小時(shí)以上。因此,eclipse無法對(duì)過去部署的文件,做先刪除后重新部署的工作。

===================================================
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);//強(qiáng)制初始化cmpy,否則ss.close()后,cmpy將消失.

====================================================
javascript錯(cuò)誤
行: 56
字符: 45
錯(cuò)誤: 未結(jié)束的字符串常量
代碼: 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]

>org.hibernate.exception.SQLGrammarException: could not load an entity: [com.xxx.yyy.Sellinfo#1]

***.hbm.xml文件中的某個(gè)列名和數(shù)據(jù)庫中的不同。


=======================================================
ConnectionManager - unclosed connection, forgot to call close() on your session?


原因:沒有關(guān)閉hibernate的session的transaction?;蛘邲]有關(guān)閉session

=======================================================
[WARN] SellCommentDAO - org.hibernate.ObjectDeletedException: deleted object would be re-saved by cascade (remove deleted object from associations): [com.xxx.yyy.SellComment#7]

原因:父親對(duì)象(one方)設(shè)置cascade="save-update" 時(shí),直接刪除子對(duì)象時(shí),會(huì)報(bào)錯(cuò),
處理方法:save信息需要級(jí)聯(lián)操作,delete時(shí)候也要用相同的原理。
SellComment sellComment=new SellComment();
sellComment = (SellComment)session.load(SellComment.class,sellCommentId);//獲取兒子對(duì)象
Long sellInfoId=sellComment.getSellInfo().getSellId();//獲取父親id
SellInfo sellinfo=(SellInfo)session.load(SellInfo.class,sellInfoId);//獲取父親對(duì)象
sellInfo.getSellComments().remove(sellComment);//斷絕父子關(guān)系
sellComment.setSellInfo(null);//斷絕子父關(guān)系
session.delete(sellComment);//刪除兒子
session.flush();

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶 評(píng)論公約

    類似文章 更多