91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 0.02M
    文件類型: .txt
    金幣: 1
    下載: 0 次
    發布日期: 2021-02-01
  • 語言: Java
  • 標簽: java??

資源簡介

java常見異常

0、 需要標識符 
a) 不在函數內 

1、 非法表達式開始 
b) 可能:丟失括號 . 

2. no data found 
a) 可能:setInt(1,100)中,沒有100這個值 

3. 找不到符號 
a) 可能:沒導入包 

4. 指定了無效URL 
a) 可能:數據庫名或IP錯誤,即連接出錯 

5. 類路徑沒有找到 
a) 可能: ClassNotFoundException: oracle.jdbc.driver.OracleDriver 
b) 原因: 一般是指包名寫錯,或者沒有import包,或者沒有在類路徑中找到jar文件 
c) 解決: 沒有加載Oracle驅動jar,在.bash_profile中把ojdbc14.jar加進來 

6. 空指針異常 
a) 可能: 數據源錯誤 比如數據庫名或IP錯誤 

7. 不能執行查詢 
a) 可能: 數據庫中表的問題,比如列名不存在 

8. invalid identity 
a) 可能: 列名出錯 

9. 若在數據庫中創建了 兩個sequence ,運行時出現異常可能是先后執行了多次select語句,導致與原有的序列號產生沖突 

10. 表名或列名不存在 
a) 可能:表不存在或者沒有插入數據到表中 

11. 不支持的類,類的版本錯誤 
a) 可能:沒有導入jdk5.0,或者編譯器仍為1.4 

12. MappingNotFoundException 
a) Maybe: In the Eclipse Not refersh , or not exist in the dirctory 

13. HibernateException: /hibernate.cfg.xml not found 
a) Maybe1: hibernate.cfg.xml not in the root directory 
b) Maybe2: Could not parse configuration . 
c) resolve: database not connect or use another database 

14. ConstraintViolationException 
a) Maybe: used a not true database 

15. 驅動沒有找到 或者 JDBC Driver not found 
可能:連接數據庫的驅動jar包不存在或者版本不一致,比如將舊的版本換成新的會造成該類錯誤 


16. 空指針異常 , java.lang.NullPointerException 
a) 可能1:數據庫連接出錯,比如在hibernate.cfg.xml中的數據錯誤會導致異常。 

17. 數據插入異常 ,GenericJDBCException: could not insert 
a) 可能1:沒有建立表或者表中沒有任何數據 
b) 可能2:插入數據后沒有執行提交語句:commit 

18. LazyInitializationException 或者延遲加載異常 
a) 可能1:沒有在查詢語句中加fetch 

19. IdentifierGenerationException 
a) 可能1:高位表沒有初始化(比如hi_value中沒有記錄) 

20. could not initialize a collection: [hibernate.entity.Role.modules#32768] Syntax error: Encountered "-" at line 1, column 132. 
a) 錯誤原因:<set name="modules" table="module-role" lazy="false">紅色字部分中“-”為非法字符,替換為module_role 

21. could not insert collection rows: [hibernate.entity.Module.roles#1] 
在Module.hbm.xml文件的如下配置中加入inverse=”true” 
<set name="roles" table="module_role" inverse="true"> 

22.在部署Struts時,出現如下錯誤信息: 
HTTP Status 404 - Servlet action is not available 
type Status report 
message Servlet action is not available 
description The requested resource (Servlet action is not available) is not available. 
問題原因: 
1.、web.xml文件中未配置ActionServlet。 
2、struts-config.xml文件未配置你要訪問的Action。 
3、你的jsp文件form標記中action屬性的路徑名稱錯誤。 
4、非以上三種情況。 
針對以上4種情況相應的解決方案如下: 
1、在web.xml文件中加上ActionServlet的配置信息 
?????? /WEB-INF/struts-config.xml? 
?2、在struts-config.xml文件檢查你要訪問的Action配置文件。 
3、檢查jsp文件form標記中action屬性的路徑名稱是否與struts-config.xml文件中action標記的path屬性的路徑名稱一致。 
4、非以上情況的解決辦法就是檢查web容器的log日志,如果時tomcat則檢查下logs目錄下的localhost_log文件,看里邊是否記錄有錯誤信息,然后根據錯誤信息提示將其糾正。 

23.java.lang.NoClassDefFoundError: org/apache/commons/beanutils/Converter 
缺少spring-framework-2.0.3\lib\jakarta-commons\commons-beanutils.jar 

24. 
java 代碼Caused by: java.lang.NoClassDefFoundError: org/objectweb/asm/Type 
缺少spring-framework-2.0.3\lib\asm\asm-2.2.2.jar包,版本不同,該包的名字有相應的區別 

java 代碼Caused by: java.lang.NoClassDefFoundError: org/dom4j/DocumentException 
缺少spring-framework-2.0.3\lib\dom4j\dom4j-1.6.1.jar包,版本不同,該包的名字有相應的區別 
把這個包進去就可以了:\Spring206\lib\dom4j、dom4j-1.6.1.jar 

java 代碼Caused by: java.lang.NoClassDefFoundError: org/apache/commons/collections/SequencedHashMap 
缺少spring-framework-2.0.3\lib\jakarta-commons\commons-collections.jar包,版本不同,該包的名字有相應的區別 

java 代碼Caused by: java.lang.NoClassDefFoundError: net/sf/cglib/proxy/CallbackFilter 
缺少spring-framework-2.0.3\lib\cglib\cglib-nodep-2.1_3.jar包,版本不同,該包的名字有相應的區別 

java 代碼Caused by: java.lang.NoClassDefFoundError: org/objectweb/asm/CodeVisitor 
缺少hibernate-3.2\lib\asm.jar包,版本不同,該包的名字有相應的區別 

java 代碼 
org.hibernate.exception.SQLGrammarException: could not load an entity: [www.proudsoul.xml.User#1] 
JAVA工程與WEB工程包的區別:一個是asm.jar,一個是jta.jar 

java 代碼Caused by: java.lang.NoClassDefFoundError: javax/transaction/TransactionManager 
缺少spring-framework-2.0.3\lib\j2ee\jta.jar包,版本不同,該包的名字有相應的區別此種錯誤請檢查相應的***.hbm.xml配置文件的配置 

25, 
Exception in thread "main" org.springframework.dao.InvalidDataAccessResourceUsageException: could not get next sequence value; nested exception is org.hibernate.exception.SQLGrammarException: could not get next sequence value 
Caused by: org.hibernate.exception.SQLGrammarException: could not get next sequence value 
原因:沒有加Sequence或者數據庫的方言寫錯了 

26, 
我的配置文件 
<id name="id" column="id"> 
<generator class="native" /> 
</id> 
然后我運行保存一條數據進去 
The database returned no natively generated identity value 
就會報這個錯誤 
因為你native是根據看底層數據庫的能力選擇identity, sequence 或者hilo中的一個 
而我建表的時候id沒有指定 
alter table `student` change `id` `id` int auto_increment 
我們把我們的表的結構小小的改動一下就沒問題了 

27, 
UpdateManager無法啟動2007-08-09 15:21如果在應用程序安裝過程中,暴力中斷安裝程序,會出現如下狀況:1.apt-get remove 和dpkg --remove 無法刪除軟件 2.UpdateManager無法啟動3.新立得軟件包管理程序無法啟動 
以上可能是deb損壞之類造成的 
sudo dpkg -r sqldveloper 
正在讀取軟件包列表... 完成 
正在分析軟件包的依賴關系樹... 完成 
E: 軟件包 sqldeveloper 需要重新安裝,但是我無法找到相應的安裝文件。 
解決方法:1.從 /var/lib/dpkg/status 中把對應的段刪掉 
重要:修改之前請先備份 
在status中找到你對應的包刪除就OK了... 

28, 
Exception in thread "main" java.lang.NoClassDefFoundError: antlr/ANTLRException 
少了antlr-2.7.5H3.jar包,從D:\eclipse\eclipse\plugins\com.genuitec.org.hibernate.eclipse_4.1.1\myeclipse-data\3.0\lib 

29, 
Caused by: 
java.lang.NoClassDefFoundError: javax/transaction/Synchronization 
缺少Spring206\lib\j2ee\jta.jar 

30, 
Caused by: 
java.lang.IllegalArgumentException: Cannot convert value of type [$Proxy3] to required type [business.impl.PriceBiz] for property 'priceBiz': no matching editors or conversion strategy found 
在java類中設置priceBiz時應該設置的是接口PriceBizIf,而非實現類 

31, 數組越界 
可能1: 在命令行后面需要加入參數. 
可能2:加入的參數錯誤 
32, car is not mapped 
可能1: 在cfg.xml中沒有增加映射的hbm.xml文件在<mapping.../>中 

33, 屬性沒有找到 
可能1: hbm.xml文件中的 <property name =""> 有問題, 也許是name的值與對應類中的成員名不一致 

34,SQLException: 無當前連接 可能1:在比如創建帳戶時沒有對相應的方法添加到<list>中去,比如這個沒有加入:<value>newAccount</value> 



<bean id="transactionAdvisor" class="org.springframework.aop.support.NameMatchMethodPointcutAdvisor">   
   <property name="advice">   
    <ref bean="advice"/>   
   </property>   
   <property name="mappedNames">   
    <list>   
     <value>transfer</value>   
    </list>   
</bean>  

35,SQLException: Syntax error: Encountered "table" at line 1, column 8. 
可能1;執行SQL時出現沖突,可能是SQL語句中使用了關鍵字作為變量來用,比如 
update order set balance=1000000; 
其中order被用作表名來使用,這是錯誤的,因為order是個關鍵字,用在order by中 

36, Servlet /Spring-WebMvc threw load() exception 
org.xml.sax.SAXParseException: Document root element "beans", must match DOCTYPE root "null". 
jar包的沖突,spring-1.2.6.jar和spring.jar出現在一個war的目錄中:JBoss/server/all/deploy/Spring-WebMvc.war/WEB-INF/lib 

37, java.sql.SQLException: 當事務仍處于活動狀態時,無法關閉連接。 


38 , 
validateJarFile(/home/soft01/Tomcat/webapps/sms-token-struts/WEB-INF/lib/servlet-api.jar) 
Servlet /sms-struts-tiles threw load() exception 
java.lang.ClassNotFoundException: org.apache.struts.action.ActionServlet 
原因:在WEB-INF/lib/ 目錄下有servlet-api.jar與/Tomcat/common/lib目錄下的servlet-api.jar沖突了,把WEB-INF/lib/下的servlet-api.jar刪除就可以了 

39,java.lang.ClassNotFoundException: org.springframework.web.struts.ContextLoaderPlugIn 
Marking servlet action as unavailable 
10:30:47,088 ERROR [/NetCT_OSS]:3953 - Servlet /NetCT_OSS threw load() exception 
javax.servlet.UnavailableException 

40,org.xml.sax.SAXParseException: Document root element "beans", must match DOCTYPE root "null". 
缺少MyEclipse/eclipse/plugins/com.genuitec.eclipse.springframework_5.5.0/data/2.0/dist/modules/spring-struts.jar 

41,Caused by: java.sql.BatchUpdateException: ORA-02291: integrity constraint (SD0702.FK82D343CF49A4B831) violated - parent key not found 
Caused by: org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update 
有可能是ID生成策略的問題,我將它XML映射文件改成<generator class="increment" />就好了 

42, 
2007-08-19 16:21:43,290 ERROR [org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/OSS].[action]] - Servlet.service() for servlet action threw exception 
org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [entity.Module#2] 
java.util.ConcurrentModificationException 
原因:已經有對象擁有了所選擇的module,用clear(),而不是remove(); 

43, 
ERROR [org.apache.catalina.session.ManagerBase] - IOException while loading persisted sessions: java.io.InvalidClassException: entity.Module; local class incompatible: stream classdesc serialVersionUID = -5988350031935445758, local class serialVersionUID = -297934247726484429 
java.io.InvalidClassException: entity.Module; local class incompatible: stream classdesc serialVersionUID = -5988350031935445758, local class serialVersionUID = -297934247726484429 
在Module中加上一個關鍵字:transient 

44, 
Caused by: java.sql.BatchUpdateException: ORA-02292: integrity constraint (SD0702.SYS_C00132664) violated - child record found 
原因:有其他的表引用了該表的外建,所以報這個異常,如果沒有引用就不會出現 

45, 
出現數組越界的時候,看看是不是循環時沒有加=,比如: 
for(int i = 1; i<arr.length;i )可以改成 
for(int i = 1; i<=arr.length;i ) 


46.如果使用Ant和Junit是被報找不到test,檢查一下是否誤用了private 
出錯信息: 
<failure message="No tests found in test.AllTest" type="junit.framework.AssertionFailedError">junit.framework.AssertionFailedError: No tests found in test.AllTest 
該錯誤有個很特別的特點,當你不通過ant來運行測試,而是通過AllTest類來運行的話,可以正常運行。小心哦 

47.如果遇到報:表名無效,且jvm報嚴重錯誤,看看是不是用了數據庫的保留關鍵字來做表名了,如User。 

48.使用ant時必須小心ant的classpath它用的不是IDE的classpath,小心! 

49.小心下邊的異常, 
exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of xp.bean.Users.?" type="net.sf.hibernate.PropertyAccessException">java.lang.ClassCastException at xp.bean.UsersMetaClass1.setPropertyValues(<generated>) at net.sf.hibernate.persister.AbstractEntityPersister.setPropertyValues 
上次出現該錯錯誤的原因是: 
源文件里我的class類型為一個類Contact contact 
而跑到mapping里卻成了Set,呵呵厲害。 

50.突然間冒出大量的NullPointException 
重新build一下。 

51.="Flush during cascade is dangerous - this might occur if an object was deleted and then re-saved by cascade" 

52.Tapestry的出錯信息: 
Class com.bookshop.Hello does not implement the IPage interface. 
location: context:/WEB-INF/Home.page, line 6 
原因:與顯示有關的哪個java類沒有從IPage家族繼承。 

53.使用ant時給出的路徑好象不允許出現空格。 

54.由于使用ant時用junit做測試的話,classpath中出現j2ee.jar的話,問題多多。例如xml格式的log文件生成不了,莫名其妙的NullPointException等。所以我設置了兩個包個包含j2ee.jar,為編譯用;一個沒有,為junit用 

55.進行單元測試時,在查詢返回后應馬上assertNotNull(),這樣可以更快速的定位NullPointException 

56.要使用ResourceBundle的話,要千萬小心。必須用日志記錄下它的狀態。還有該屬性文件應該放在classes下面。 

57.當要顯示任何頁面時,都被提示無效,那么應該檢查一下lib目錄了,還有一些很奇怪的異常,例如你明明可以找到一個類但是服務器卻提示 ClassNotDefException,那么估計是缺少了該類所必須的包了。或者多了不兼容的包,如, xdoclet系列包不被struts的lib目錄所兼容 

58.編寫clone時從Java編程思想(2nd)上學到的(732): 
.引數傳遞過程中會自動產生別名(alias)。 
.沒有局域對象(local objects),只有局域性的(local)references。 
.reference受范圍(scope)的限制,對象則否。 
.對象的壽命從來不是Java的討論議題(因為有垃圾回收機制) 

59.try catch finally的域居然是分離的。 

60.jsp亂碼的其中一個原因:charset="gb2312" 等號"="的兩邊不允許有空格。 

61.我的基于Displaytag的簡單報表解決方案。 
http://displaytag.sourceforge.net/ 
下載displaytag.jar和displaytag.tld 
displaytag.jar放在lib目錄,而displaytag.tld放在WEB-INF目錄,在web.xml中為displaytag.tld聲明一下。 
<taglib> 
<taglib-uri>http://displaytag.org</taglib-uri> 
<taglib-location>/WEB-INF/displaytag.tld</taglib-location> 
</taglib> 
在jsp里使用前,加上 
<%@ taglib uri="http://displaytag.org" prefix="display" %> 

注意該軟件有個bug,他要用的一個包common-lang.jar版本必須在2.0以上。 
如果碰到下面異常,則應堅持一下是否該包的版本問題。 
java.lang.NoSuchMethodError: org.apache.commons.lang.StringUtils.capitalize(Ljava/lang/String;)Ljava/lang/String; 
然后就可放心使用了 
<display:column property = "xxx"/>其中xxx為對象中的帶有getter的變量>。 
定義表格的樣子,用css定義。如 
TABLE.its THEAD TR { 
BACKGROUND-COLOR: #69c 

TABLE.its TR.even { 
BACKGROUND-COLOR: #def 

在使用分頁時,可能會出現這種情況,點擊其他頁時,彈出下載窗口,讓你下載當前jsp頁面,這是因為你在當前頁面讀取了數據的緣故。解決辦法為在action里讀取數據而不是在jsp里。可以參考 
http://www.displaytag.org/example-paging.jsp?d-26189-p=2 

62.使用displaytag時,在一列中放入多個元素 
必須在display:table中定義一個id 
<display:table name = "allBooks" class = "its" pagesize = "5" id = "item"> 
<display:column title = "操作"> 
<a href = "/Bookshop/admin/bookManagement.do?action=view&id=<%=((Book)item).getId()%>" target = "_blank" >查看</a> 
<a href = "/Bookshop/admin/bookManagement.do?action=edit&id=<%=((Book)item).getId()%>">編輯</a> 
<a href = "/Bookshop/admin/bookManagement.do?action=delete&id=<%=((Book)item).getId()%>">刪除</a> 
</display:column> 
要在displaytag中使用鏈接,必須具備paramId,否則不顯示為鏈接 
<display:column property = "product.name" href = "viewDetailV2.0.jsp" title = "書名" paramId="item" paramProperty="product.id"/> 
可以這樣使用display 
<display:column property = "product.id" title = "ID"/> 
其中product為對象 

63.<bean:write name = "xxxx" property = "xxx"/> 可以直接取到session.getAttribute()取到的東西。 

64.實驗struts-upload例子時要注意的地方: 
1.If you would rather write this file to another file, please check here: 
這一行要打鉤 
2.If you checked the box to write to a file, please specify the file path here: 
在這里要重命名如:c:\b.jpg 
上傳成功的話,會出現提示 The file has been written to "c:\b.jpg" 

65.Hibernate的like可以這么用: 
Query query = session.createQuery("from src.persistent.Book as book where upper(book.name) like :name "); 
query.setString("name", "%"); 
result = query.list(); 

66.Hibernate出現 duplicate import : className 
異常也可能是因為忘了為持久類在configuration中addClass了 

67.<logic:iterate id = "author" name = "authors"> 
name所引用的是session里的attribute。 

68.如果發現要出現詢問下載的情況,有可能是因為要跳轉的頁面出現了問題。試試在要跳轉到的頁刪掉 
<%@ page contentType="text/html; charset=gb2312"%> 

69.如果JSP頁面跳轉時出現下邊的錯誤信息: 
The request sent by the client was syntactically incorrect (Invalid path /web/shoppingCart was requested). 
原因是struts-config的action = "x" 寫成了 action = "x.do" 

70.在struts中,strut-config.xml中,forward時使用redirect = "true"可以將.do重定向為.jsp 

71.以后在判斷相等性之前先用logger把兩個值顯示出來。 

72.從session里getAttribute后,修改并不需要重新setAttribute一次。 

73.在hibernate中使用subclass是一棵繼承樹共用一個表,僅生成個mapping。 
每個類中必須有discrimator-value。在最上層的類中必須聲明: 
@hibernate.discriminator column = "class"。 
不可以將子類添加到configuration里去。(即不可addClass(子類)) 
使用Xdoclet的建立subclass的例子(該類是父類) 
/** 
* @hibernate.class discriminator-value = "customer" 
* @hibernate.discriminator column = "class" 
*/ 

而使用joined-subclass則是一類一表,也不許將子類添加進configuration里去。 
/** 
* @hibernate.joined-subclass 
* @hibernate.joined-subclass-key 
* column="customer_id" 
*/ 
如果發現生成的mapping文件中joined-subclass的key column為空,那么可能是@hibernate.joined-subclass-key這句沒有寫對。 
用joined-subclass生成的表,仔細看。Member extends Customer 
create table Customer ( 
id VARCHAR2(255) not null, 
name VARCHAR2(255), 
description VARCHAR2(255), 
primary key (id) 

create table Member ( 
customer_id VARCHAR2(255) not null, 
password VARCHAR2(255), 
primary key (customer_id) 


74.在junit中盡量使用assertEquals代替assertTrue; 

75.Hibernate 
如果Child extends Parent 
那么from Parent as parent 也將會將Child選出來,而from Child as child 則不會選出Parent 

76.Hibernate 
使用hibernate的one-to-one時,應該兩方向都set,否則會報save NullPointException 
parent.setChild(child); 
child.setParent(parent); 

77.Hibernate 
遇到下邊的異常,估計是與因為外鍵出現了問題: 

java.lang.NullPointerException 
at net.sf.hibernate.persister.AbstractEntityPersister.getPropertyValue(AbstractEntityPersister.java:675) 
at net.sf.hibernate.id.ForeignGenerator.generate(ForeignGenerator.java:33) 
如: 
* @hibernate.id generator-class = "foreign" 
* @hibernate.generator-param name = "property" value = "customer" 
* @hibernate.one-to-one name = "custmoer" class = "src.persistent.Customer" 
value的值和one-to-one 中name的值不符,則會出現上邊的異常。如果不顯示指定name則默認取成員變量名 
如 
Customer a 
則name = "a" 需要小心的是不是類名。所以,以后最好顯示指定名字為好。 

78.出現異常: 
Exceptionobject references an unsaved transient instance - save the transient instance before flushing: src.persistent.Product 
原因沒有為某對象進行set設置, 如上邊的這個就是某對象沒有調用setProduct 

79. 
"xxx action = "/a" 不用.do和根目錄名 
<a href = "b.do" 需要.do和根目錄名 

80. 
Caused by: java.sql.SQLException: ORA-02291: 違反完整約束條件 (BOOKSHOP.FK4AAEE 
47687CCA6B) - 未找到父項關鍵字 
如果你覺得該做的e是出現這個問題,那么檢查一下,是否將類的繼承關系在hibernate的mapping中反映了出來。joined-subclass或subclass 
例如a extends b 
如果持久類c 需要Set的是持久類a,那么你把b傳入,而b又沒有在mapping中將父子關系反映出來的話,就會出現該異常 

81.使用DynaActionForm需要注意的問題 
在struts-config聲明 
<form-bean name="memberloginForm" dynamic ="true" type="org.apache.struts.action.DynaActionForm"> 
<form-property name = "name" type = "java.lang.String"/> 
<form-property name = "password" type = "java.lang.String"/> 
</form-bean> 
在Action里將form強制轉化成DynaActionForm,然后get("屬性名")就可以了 

82.struts的validate最簡單實現 
1.首先準備好錯誤提示信息。 
xxx.properties 里 
errors.required={0} is required.(默認已有) 
2.Form必須從ValidatorForm繼承 
3.不可以重載ValidatorForm的validate函數 
4.在validate.xml中為你想驗證的表單進行驗證設計。例如 
<form name="logonForm"> 
<field property="userName" depends="required"> 
<arg0 key="prompt.userName"/> 
(該參數將在顯示錯誤信息是從xxx.properties讀取prompt.userName,填入{}方括號里,取代0。如果是arg1將將填入{1}位置,以此類推。 
</field> 
</form> 
不需要在action里做任何處理。只管forward就行了。作為forward的目標頁,不需要任何有關用于處理出錯信息的處理。 

83.服務器報 
The requested resource (/xxxx/xxx.htm) is not available.的很奇怪的一個的可能原因 
在web.xml中定義的tld,沒有找到 
或者是lib目錄下的包太多出現了問題。 
如 
<taglib> 
<taglib-uri>/spring</taglib-uri> 
<taglib-location>/WEB-INF/spring.tld</taglib-location> 
</taglib> 
如WEB-INF目錄下不存在spring.tld的話,就會報上邊的錯誤 

84. 
spring的xxx-servlet.xml的使用SimpleFormController系列的類問題: 
<bean id = "priceIncreaseForm" class="PriceIncreaseFormController"> 
<property name="sessionForm"><value>true</value></property> 
<property name="beanName"><value>priceIncrease</value></property> 
<property name="commandClass"><value>PriceIncrease</value></property> 
<property name="formView"><value>priceIncrease</value></property> 
<property name="successView"><value>hello</value></property> 
<property name="productManager"> 
<ref bean="prodMan"/> 
</property> 
</bean> 
這里要注意幾個問題: 
(1)上邊的PriceIncrease是了類名,必須在classes里存在該類,否則報: 
PropertyVetoExceptionsException: 1 errors:-- ErrorCodedPropertyVetoException: message=[Failed to convert property value of type [java.lang.String] to required type [java.lang.Class] for property named 'commandClass'; nested exception is: 
java.lang.IllegalArgumentException: Invalid class name [PriceIncrease]: PriceIncrease]; errorCode=[typeMismatch] 
java.lang.IllegalArgumentException: Invalid class name [PriceIncrease]: PriceIncrease 
(2)<property name="formView"><value>priceIncrease</value></property> 
這一行必不可少,priceIncrease是頁面的名字,他將會是prefix priceIncrease suffix 
如果缺少該行,則報: 
javax.servlet.ServletException: Error in ModelAndView object or View resolution encountered by servlet with name 'pocketSpring': View to render cannot be null with ModelAndView [ModelAndView: materialized View is [null]; Model=[{priceIncrease=PriceIncrease@148e798, org.springframework.validation.BindException.priceIncrease=org.springframework.validation.BindException: BindException: 0 errors}]] 

使用Errors的rejectValue相關問題: 
rejectValue(java.lang.String field, java.lang.String errorCode, java.lang.Object[] errorArgs, java.lang.String defaultMessage) 
Reject the given field of the current object, using the given error description. 
當前對象指的是xxx-servlet.xml中與validator類有聯系的哪個對象。 

第一個是:當前對象的屬性名,必須存在 
第二個是:將要從屬性文件中讀取的消息 
第三個是:傳遞給所讀取的消息的參數,如: 
error.too-low=You have to specify a percentage higher than {0}! 
第四個是:當從屬性文件中讀取消息不成功時,所reject的值 

以后從request中讀取parameter可以借用spring的RequestUtils包里的 
getStringParameter 
public static java.lang.String getStringParameter(javax.servlet.http.HttpServletRequest request, 
&bsp; java.lang.String name, 
java.lang.String defaultVal) 
Get a string parameter, with a fallback value. Never throws an exception. Can pass a distinguished value to default to enable checks of whether it was supplied. 
不會拋異常 
Hibernate的問題:2.1rc的問題 
INFO: cache provider: net.sf.ehcache.hibernate.Provider 
net.sf.hibernate.HibernateException: could not instantiate CacheProvider: 
解決辦法,2.1rc比以前的版本多需要一個包 
ehcache.jar 

85.static的問題 
static函數只可以訪問static成員變量。 
而static變量可以被任何成員函數訪問。 

86. 
java.lang.NoClassDefFoundError: javax/transaction/Synchronization]; 
需要添加JTA.jar

本文來自CSDN博客,轉載請標明出處:http://blog.csdn.net/mfnevi/archive/2008/05/05/2395226.aspx

資源截圖

代碼片段和文件信息

評論

共有 條評論