常见异常总结:

问题:IllegalAgumentExecption

  

开发常见异常_第1张图片

开发常见异常_第2张图片





问题:内存溢出异常

这个一般报【http-8080-3】之类的

1.eclipse安装目录中将eclipse的启动参数调大一些:

开发常见异常_第3张图片 

-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

开发常见异常_第4张图片

开发常见异常_第5张图片 

 

问题: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) –>完成