1. 程式人生 > >開發常見異常

開發常見異常

異常 開發

常見異常總結:

問題:IllegalAgumentExecption

技術分享

技術分享





問題:內存溢出異常

這個一般報【http-8080-3】之類的

1.eclipse安裝目錄中將eclipse的啟動參數調大一些:

技術分享

-startup

plugins/org.eclipse.equinox.launcher_1.3.100.v20150511-1540.jar

--launcher.library

plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.300.v20150602-1417

-product

org.eclipse.epp.package.jee.product

--launcher.defaultAction

openFile

--launcher.XXMaxPermSize

512M

-showsplash

org.eclipse.platform

--launcher.XXMaxPermSize

512m

--launcher.defaultAction

openFile

--launcher.appendVmargs

-vmargs

-Dosgi.requiredJavaVersion=1.7

-Xms512m

-Xmx1024m

技術分享

技術分享

問題:BeanDefinitionParsingException

org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath:applicationContext-service.xml]

原因:applicationContext-service.xml沒有加進去總的spring配置文件,或者名字寫錯,或者配置文件內部程序錯誤。

問題:There is no Action mapped for namespace

There is no Action mapped for namespace [/sysadmin] and action name [deptAction_list] associated with context path [/qb_web]. - [unknown location]

原因:struts.xml文件不在src下,或者編譯後不在classes下;

或者struts.xml配置文件內部錯誤;

或者有其他的struts-xxx.xml沒有include到struts.xml中;

或者action與spring整合的時候出錯,一些UserServie沒有在struts配置文件中,或者寫錯,導致找不見struts.xml;

或者請求路徑出錯。

問題:action本身就在值棧中,但action不在值棧的棧頂;

問題:classpath

Classpath只能用在spring中,

問題:重定向和轉發

問題:hibernate子配置文件Dept.hbm.xml問題

<property name="name" column="NAME"></property>

01.name屬性出錯

報錯:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sessionFactory‘ defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is

Caused by: org.hibernate.property.access.spi.PropertyAccessBuildingException: Could not locate field nor getter method for property named [com.my.qb.domain.Userinfo#ne]


02.column屬性出錯

不會報錯,但是加載運行的時候不行,這個要特別註意。

03.package出錯

<hibernate-mapping package="com.my.qb.domain">

報錯:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sessionFactory‘ defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: class cn.itcast.jk.domain.Dept not found while looking for property: id

Caused by: org.hibernate.MappingException: class cn.itcast.jk.domain.Dept not found while looking for property: id

Caused by: org.hibernate.boot.registry.classloading.spi.ClassLoadingException: Unable to load class [cn.itcast.jk.domain.Dept]


Caused by: java.lang.ClassNotFoundException: Could not load requested class : cn.other.jk.domain.Dept

問題:數據庫屬性設為非空,但是沒有賦值

Struts Problem Report

Struts has detected an unhandled exception:

Messages: ORA-01400: ??? NULL ?? ("ITQB"."USER_P"."CREATE_TIME")

could not execute statement

could not execute statement; SQL [n/a]; constraint [null]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement

File: oracle/jdbc/driver/DatabaseError.java

Line number: 112

java.sql.SQLException: ORA-01400: ??? NULL ?? ("ITQB"."USER_P"."CREATE_TIME")

問題:

新建jsp頁面老提示:

Multiple annotations found at this line:

- The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path

解決步驟:

1、右鍵項目-build path

2、選擇configure build path...

3、選擇 Javabuild path

4、Add Library –> server Runtime -> Click Next

5、選擇 Server runtime (我的是 Tomcat 7.0) –>完成




本文出自 “秦斌的博客” 博客,謝絕轉載!

開發常見異常