天天看点

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??,????娌℃???ㄧ被璺?寰?涓??惧??ar??浠?

c) 瑙e?? 娌℃????杞?racle椹卞??ar,??bash_profile涓???ojdbc14.jar??杩???

6. 绌烘????寮?甯?

a) ???? ?版??婧???璇? 姣?濡??版??搴?????IP??璇?

7. 涓??芥?ц??ヨ??

a) ???? ?版??搴?涓?琛ㄧ????棰?,姣?濡?????涓?瀛???

8. invalid identity

a) ???? ?????洪??

9. ?ュ?ㄦ?版??搴?涓???寤轰? 涓や釜sequence ,杩?琛??跺?虹?板?甯稿???芥???????ц?浜?澶?娆?elect璇???瀵艰?翠???????搴????蜂骇???茬??

10. 琛ㄥ????????涓?瀛???

a) ????琛ㄤ?瀛??ㄦ????娌℃?????ユ?版???拌〃涓?

11. 涓???????绫?绫荤????????璇?

a) ????娌℃??瀵煎??dk5.0,????缂?璇??ㄤ?涓?.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

???斤?杩??ユ?版??搴???椹卞??ar??涓?瀛??ㄦ????????涓?涓??达?姣?濡?灏??х???????㈡???扮??浼?????璇ョ被??璇?

16. 绌烘????寮?甯?锛? java.lang.NullPointerException

a) ????锛??版??搴?杩??ュ?洪??锛?姣?濡???ibernate.cfg.xml涓????版????璇?浼?瀵艰?村?甯搞??

17. ?版?????ュ?甯?锛?GenericJDBCException: could not insert

a) ????锛?娌℃??寤虹??琛ㄦ????琛ㄤ腑娌℃??浠讳??版??

b) ????锛????ユ?版????娌℃???ц???浜よ???ワ?commit

18. LazyInitializationException ????寤惰???杞藉?甯?

a) ????锛?娌℃???ㄦ?ヨ?㈣???ヤ腑??fetch

19. IdentifierGenerationException

a) ????锛?楂?浣?琛ㄦ病????濮???锛?姣?濡?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]

??odule.hbm.xml??浠剁??濡?涓???缃?涓?????nverse=??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??浠?orm??璁颁腑action灞??х??璺?寰???绉伴??璇???

4????浠ヤ?涓?绉????点??

??瀵逛互涓?4绉????电?稿???瑙e?虫?规?濡?涓?锛?

1????eb.xml??浠朵腑??涓?ActionServlet????缃?淇℃??

?????? /WEB-INF/struts-config.xml?

?2????truts-config.xml??浠舵??ヤ?瑕?璁块????Action??缃???浠躲??

3??妫???sp??浠?orm??璁颁腑action灞??х??璺?寰???绉版?????struts-config.xml??浠朵腑action??璁扮??path灞??х??璺?寰???绉颁??淬??

4????浠ヤ????电??瑙e?冲??娉?灏辨??妫???eb瀹瑰?ㄧ??log?ュ?锛?濡?????omcat??妫??ヤ?logs??褰?涓???localhost_log??浠讹?????杈规?????板?????璇?淇℃??锛??跺???规????璇?淇℃????绀哄??剁?姝c??

23锛?java.lang.NoClassDefFoundError: org/apache/commons/beanutils/Converter

缂哄?spring-framework-2.0.3/lib/jakarta-commons/commons-beanutils.jar

24.

ava 浠g??Caused by: java.lang.NoClassDefFoundError: org/objectweb/asm/Type??

缂哄?spring-framework-2.0.3/lib/asm/asm-2.2.2.jar??,????涓???,璇ュ??????瀛????稿????哄??

java 浠g??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 浠g??Caused by: java.lang.NoClassDefFoundError: org/apache/commons/collections/SequencedHashMap??

缂哄?spring-framework-2.0.3/lib/jakarta-commons/commons-collections.jar??,????涓???,璇ュ??????瀛????稿????哄??

java 浠g??Caused by: java.lang.NoClassDefFoundError: net/sf/cglib/proxy/CallbackFilter??

缂哄?spring-framework-2.0.3/lib/cglib/cglib-nodep-2.1_3.jar??,????涓???,璇ュ??????瀛????稿????哄??

java 浠g??Caused by: java.lang.NoClassDefFoundError: org/objectweb/asm/CodeVisitor??

缂哄?hibernate-3.2/lib/asm.jar??,????涓???,璇ュ??????瀛????稿????哄??

java 浠g??

org.hibernate.exception.SQLGrammarException: could not load an entity: [www.proudsoul.xml.User#1]

JAVA宸ョ?涓?WEB宸ョ??????哄??:涓?涓???asm.jar,涓?涓???jta.jar

java 浠g??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???规????搴?灞??版??搴????藉??????dentity, sequence ????hilo涓???涓?涓?

????寤鸿〃???跺??id娌℃????瀹?

alter table `student` change `id` `id` int auto_increment

??浠?????浠???琛ㄧ??缁???灏?灏????瑰?ㄤ?涓?灏辨病??棰?浜?

27,

UpdateManager??娉?????007-08-09 15:21濡????ㄥ??ㄧ?搴?瀹?瑁?杩?绋?涓?锛??村??涓???瀹?瑁?绋?搴?锛?浼??虹?板?涓??跺?碉?1.apt-get remove ??dpkg --remove ??娉????よ蒋浠?2.UpdateManager??娉?????.?扮??寰?杞?浠跺??绠$??绋?搴???娉?????

浠ヤ????芥??deb????涔?绫婚??????

sudo dpkg -r sqldveloper

姝e?ㄨ?诲??杞?浠跺????琛?.. 瀹???

姝e?ㄥ????杞?浠跺????渚?璧??崇郴??... 瀹???

E: 杞?浠跺?? sqldeveloper ??瑕????板??瑁?锛?浣???????娉??惧?扮?稿???瀹?瑁???浠躲??

瑙e?虫?规?锛?1.浠? /var/lib/dpkg/status 涓???瀵瑰???娈靛????

??瑕?锛?淇??逛???璇峰??澶?浠?

??tatus涓??惧?颁?瀵瑰????????ゅ氨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

??ava绫讳腑璁剧疆priceBiz?跺?璇ヨ?剧疆?????ュ??riceBizIf锛?????瀹??扮被

31, ?扮?瓒???

????: ?ㄥ?戒护琛????㈤??瑕????ュ????

????:???ョ?????伴??璇?

32, car is not mapped

????: ??fg.xml涓?娌℃??澧?????灏???hbm.xml??浠跺??lt;mapping.../>涓??

?

33, 灞??ф病???惧??

????: hbm.xml??浠朵腑?? <property name =""> ????棰?, 涔?璁告??name???间?瀵瑰?绫讳腑????????涓?涓???

34,SQLException: ??褰???杩??ヂ????????? ????:?ㄦ??濡???寤哄??锋?舵病??瀵圭?稿????规?娣诲????lt;list>涓???姣?濡?杩?涓?娌℃??????<value>newAccount</value>

Java浠g??

  1. <bean?id= "transactionAdvisor" ? class = "org.springframework.aop.support.NameMatchMethodPointcutAdvisor" >??
  2. ???<property?name="advice" >??
  3. ????<ref?bean="advice" />??
  4. ???</property>??
  5. ???<property?name="mappedNames" >??
  6. ????<list>??
  7. ?????<value>transfer</value>??
  8. ????</list>??
  9. </bean>??

35,SQLException: Syntax error: Encountered "table" at line 1, column 8.

????;?ц?SQL?跺?虹?板?茬??,???芥??SQL璇??ヤ腑浣跨?ㄤ??抽??瀛?浣?涓哄?????ョ??姣?濡?

?? update order set balance=1000000;

?? ?朵腑order琚??ㄤ?琛ㄥ???ヤ娇??杩?????璇???,??涓?rder??涓??抽??瀛?,?ㄥ??rder 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

????:??EB-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,??lear(),??涓???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

??odule涓???涓?涓?涓??抽??瀛?: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.濡???浣跨??nt??Junit??琚??ユ?句???est,妫??ヤ?涓????????ㄤ?private

?洪??淇℃??锛?

??? <failure message="No tests found in test.AllTest" type="junit.framework.AssertionFailedError">junit.framework.AssertionFailedError: No tests found in test.AllTest

璇ラ??璇???涓?寰??瑰?????圭?癸?褰?浣?涓???杩?ant?ヨ?琛?娴?璇?锛???????杩?AllTest绫绘?ヨ?琛???璇?锛???浠ユ?e父杩?琛???灏?蹇???

47.濡??????版?ワ?琛ㄥ??????锛?涓?jvm?ヤ弗????璇?锛???????涓????ㄤ??版??搴???淇????抽??瀛??ュ??琛ㄥ??浜?锛?濡?User??

48.浣跨??nt?跺?椤诲?蹇?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绫诲??涓轰?涓?绫?ontact contact

??璺???apping???存??浜?Set,?靛?靛??瀹炽??

50.绐??堕?村???哄ぇ????NullPointException

????uild涓?涓???

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.浣跨??nt?剁??虹??璺?寰?濂借薄涓???璁稿?虹?扮┖?笺??

54.?变?浣跨??nt?剁??unit??娴?璇???璇?锛?classpath涓??虹??2ee.jar??璇?锛???棰?澶?澶???渚?濡?xml?煎???log??浠剁????涓? 浜?锛??????跺???NullPointException绛?????浠ユ??璁剧疆浜?涓や釜??涓?????j2ee.jar锛?涓虹?璇????涓?涓?娌℃??,涓?unit??

55.杩?琛?????娴?璇??讹??ㄦ?ヨ?㈣?????搴?椹?涓?assertNotNull()锛?杩??峰??浠ユ?村揩????瀹?浣?NullPointException

56.瑕?浣跨??esourceBundle??璇?锛?瑕???涓?灏?蹇???蹇?椤荤?ㄦ?ュ?璁板?涓?瀹????舵????杩???璇ュ??ф??浠跺?璇ユ?惧??lasses涓?????

57.褰?瑕??剧ず浠讳?椤甸?㈡?讹??借???绀烘????锛??d?搴?璇ユ??ヤ?涓?lib??褰?浜?锛?杩???涓?浜?寰?濂?????寮?甯革?渚?濡?浣???????浠ユ?惧?颁?涓?绫讳??????″?ㄥ?存??绀?ClassNotDefException锛??d?浼拌?℃??缂哄?浜?璇ョ被??蹇?椤荤????浜???????澶?浜?涓??煎?圭????锛?濡?, 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??绠????ヨ〃瑙e?虫?规???

http://displaytag.sourceforge.net/

涓?杞?isplaytag.jar??displaytag.tld

displaytag.jar?惧??ib??褰?锛???displaytag.tld?惧??EB-INF??褰?锛???eb.xml涓?涓?isplaytag.tld澹版??涓?涓???

<taglib>

??? <taglib-uri>http://displaytag.org</taglib-uri>

??? <taglib-location>/WEB-INF/displaytag.tld</taglib-location>

</taglib>

??sp??浣跨?ㄥ??锛???涓?

<%@ taglib uri="http://displaytag.org" prefix="display" %>

???????

娉ㄦ??璇ヨ蒋浠舵??涓?bug锛?浠?瑕??ㄧ??涓?涓???common-lang.jar????蹇?椤诲??.0浠ヤ???

濡???纰板?颁??㈠?甯革???搴?????涓?涓??????ュ??????????棰???

java.lang.NoSuchMethodError: org.apache.commons.lang.StringUtils.capitalize(Ljava/lang/String;)Ljava/lang/String;

?跺??灏卞???惧?浣跨?ㄤ?

<display:column property = "xxx"/>?朵腑xxx涓哄?硅薄涓???甯???getter??????>??

瀹?涔?琛ㄦ?肩???峰??锛???ss瀹?涔???濡?

TABLE.its THEAD TR {

BACKGROUND-COLOR: #69c

}

TABLE.its TR.even {

BACKGROUND-COLOR: #def

}

?ㄤ娇?ㄥ??椤垫?讹????戒??虹?拌?绉????碉??瑰?诲?朵?椤垫?讹?寮瑰?轰?杞界???o?璁╀?涓?杞藉???jsp椤甸???杩?????涓轰??ㄥ???椤甸?㈣?诲??浜??版????缂?????瑙e?冲??娉?涓哄??ction??璇诲???版????涓?????sp??????浠ュ????

http://www.displaytag.org/example-paging.jsp?d-26189-p=2

62.浣跨??isplaytag?讹??ㄤ???涓??惧?ュ?涓???绱?

蹇?椤诲??isplay: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()%>">????lt;/a>

</display:column>

瑕???isplaytag涓?浣跨?ㄩ?炬?ワ?蹇?椤诲?峰?paramId锛?????涓??剧ず涓洪?炬??

<display:column property = "product.name" href = "viewDetailV2.0.jsp" title = "涔???" paramId="item" paramProperty="product.id"/>

??浠ヨ??蜂娇??isplay

<display:column property = "product.id" title = "ID"/>

?朵腑product涓哄?硅薄

63.<bean:write name = "xxxx" property = "xxx"/> ??浠ョ?存?ュ????ession.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

寮?甯镐????芥????涓哄?浜?涓烘??涔?绫诲??onfiguration涓?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.??truts涓?锛?strut-config.xml涓?锛?forward?朵娇??edirect = "true"??浠ュ?.do??瀹???涓?jsp

71.浠ュ???ㄥ?ゆ???哥???т???????ogger??涓や釜?兼?剧ず?烘?ャ??

72.浠?session??getAttribute??锛?淇??瑰苟涓???瑕?????etAttribute涓?娆°??

73.??ibernate涓?浣跨??ubclass??涓?妫电户?挎???辩?ㄤ?涓?琛??浠?????涓?mapping??

姣?涓?绫讳腑蹇?椤绘??discrimator-value???ㄦ??涓?灞???绫讳腑蹇?椤诲0??锛?

@hibernate.discriminator column = "class"??

涓???浠ュ?瀛?绫绘坊????onfiguration???汇??(?充???addClass(瀛?绫?)

浣跨??doclet??寤虹??subclass??渚?瀛?(璇ョ被???剁被)

??浣跨??oined-subclass????涓?绫讳?琛?涔?涓?璁稿?瀛?绫绘坊??杩?configuration???汇??

濡??????扮??????mapping??浠朵腑joined-subclass??key column涓虹┖锛??d????芥[email protected]杩??ユ病????瀵广??

??oined-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.??unit涓?灏介??浣跨??ssertEquals浠f??ssertTrue;

75.Hibernate

濡???Child extends Parent

?d?from Parent as parent 涔?灏?浼?灏?Child???烘?ワ???from Child as child ??涓?浼?????arent

76.Hibernate

浣跨??ibernate??one-to-one?讹?搴?璇ヤ袱?瑰????et,????浼???ave 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璁剧疆锛? 濡?涓?杈圭??杩?涓?灏辨????瀵硅薄娌℃??璋???etProduct

79.

"xxx action = "/a" 涓???do???圭??褰???

<a href = "b.do" ??瑕?.do???圭??褰???

80.

Caused by: java.sql.SQLException: ORA-02291: 杩???瀹??寸害???′欢 (BOOKSHOP.FK4AAEE

47687CCA6B) - ???惧?扮?堕」?抽??瀛?

濡???浣?瑙?寰?璇ュ????e???虹?拌?涓???棰?锛??d?妫??ヤ?涓?锛??????绫荤??缁ф?垮?崇郴??ibernate??mapping涓?????浜??烘?ャ??joined-subclass??subclass

渚?濡?a extends b

濡?????涔?绫? ??瑕?Set??????涔?绫?锛??d?浣???b浼??ワ???b??娌℃????apping涓?灏??跺???崇郴?????烘?ョ??璇?锛?灏变??虹?拌?ュ?甯?

81.浣跨??ynaActionForm??瑕?娉ㄦ??????棰?

??truts-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>

??ction??灏?form寮哄?惰浆????DynaActionForm锛??跺??get("灞??у??")灏卞??浠ヤ?

82.struts??validate??绠???瀹???

1.棣?????澶?濂介??璇???绀轰俊????

xxx.properties ??

errors.required={0} is required.(榛?璁ゅ凡??)

2.Form蹇?椤讳?ValidatorForm缁ф??

3.涓???浠ラ??杞?alidatorForm??validate?芥??

4.??alidate.xml涓?涓轰??抽??璇???琛ㄥ??杩?琛?楠?璇?璁捐?°??渚?濡?

<form name="logonForm">

??? <field property="userName" depends="required">

<arg0 key="prompt.userName"/>

(璇ュ???板??ㄦ?剧ず??璇?淇℃????浠?xxx.properties璇诲??prompt.userName,濉???}?规???烽??锛???浠???濡?????arg1灏?灏?濉???1}浣?缃?锛?浠ユ?ょ被?ㄣ??

??? </field>

</form>

涓???瑕???ction????浠讳?澶???????绠?orward灏辫?浜???浣?涓?orward??????椤碉?涓???瑕?浠讳????崇?ㄤ?澶????洪??淇℃????澶?????

83.???″?ㄦ??

The requested resource (/xxxx/xxx.htm) is not available.??寰?濂?????涓?涓??????藉????

??eb.xml涓?瀹?涔???tld锛?娌℃???惧??

??????lib??褰?涓?????澶?澶??虹?颁???棰???

濡?

<taglib>

??? <taglib-uri>/spring</taglib-uri>

??? <taglib-location>/WEB-INF/spring.tld</taglib-location>

</taglib>

濡?WEB-INF??褰?涓?涓?瀛???pring.tld??璇?锛?灏变??ヤ?杈圭????璇?

84.

spring??xxx-servlet.xml??浣跨??impleFormController绯诲????绫婚??棰?锛?

<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??浜?绫诲??锛?蹇?椤诲??lasses??瀛??ㄨ?ョ被锛??????ワ?

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=[{[email?protected], org.springframework.validation.BindException.priceIncrease=org.springframework.validation.BindException: BindException: 0 errors}]]

浣跨??rrors??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??浠ュ????pring??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:

瑙e?冲??娉?锛?2.1rc姣?浠ュ????????澶???瑕?涓?涓???

ehcache.jar

85.static????棰?

static?芥?板????浠ヨ?块??static??????????

??static??????浠ヨ?浠讳??????芥?拌?块????

86.

java.lang.NoClassDefFoundError: javax/transaction/Synchronization];

??瑕?娣诲??JTA.jar