Java项目开发中一些BUG的总结(二)

2014-11-24 08:04:58 · 作者: · 浏览: 1
    regionAction Unable to instantiate Action, regionAction, defined for 'regionAction_pageQuery' in namespace '/'regionAction

File:

org/apache/catalina/loader/WebappClassLoader.java

Line number:

1,645


Stacktraces

Unable to instantiate Action,regionAction, defined for 'regionAction_pageQuery' in namespace '/'regionAction

原因:spring管理action时,需要在applicationContext.xml中配置action的实现类,出现这个问题是因为在spring的核心配置文件中,这个action的实现类的id与struts.xml中的class值不一致了。

解决:查看struts.xml的这个action的class属性和applicationContext.xml的这个action的id属性是否一致,如果不一致,修改其一,使其一致即可。

7,主键生成策略设置不当产生的异常

Struts Problem Report

Struts has detected an unhandled exception:

Messages:

    Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1 Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1; nested exception is org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1

File:

org/hibernate/jdbc/Expectations.java

Line number:

85


Stacktraces

org.springframework.orm.hibernate3.HibernateOptimisticLockingFailureException:Batch update returned unexpected row count from update [0]; actual row count:0; expected: 1; nested exception is org.hibernate.StaleStateException: Batchupdate returned unexpected row count from update [0]; actual row count: 0;expected: 1

解决:查看hbm文件中的主键生成策略。

8,tomcat启动时报session错误

严重: IOExceptionwhile loading persisted sessions: java.io.EOFException

严重: Exception loading sessions from persistent storage

解决:

说法一:根本原因是给tomcat设置的缓存太小,解决的办法就是在eclipse的tomcat里配置一下所使用的内存大小

说法二:分析:EOFException表示输入过程中意外地到达文件尾或流尾的信号,导致从session中获取数据失败。异常是tomcat本身的问题,由于tomcat上次非正常关闭时有一些活动session被持久化(表现为一些临时文件),在重启时,tomcat尝试去恢复这些session的持久化数据但又读取失败造成的。此异常不影响系统的使用。

解决办法:将tomcat6.0\work\Catalina\localhost\peam\SESSIONS.ser删除。如果正常关闭服务端,该文件是自动删除的。

我参照上面方法解决的问题,用的是MyEclipse6.0,tomcat6.0。通常情况下,会认为是tomcat的缓存,会直接把整个localhost文件夹删除。但是上面的方法也是可取的,在localhost文件夹下,找到部署的工程名,在该工程名下有SESSIONS.ser文件,直接删除。重启tomcat,问题解决。

9,WebService发布报错

Exception in thread "main" com.sun.xml.internal.ws.model.RuntimeModelerException: runtime modeler error: Wrapper class cn.itcast.ws.jaxws.SayHello is notfound. Have you run APT to generate them

原因:很可能是JDK的版本不够造成的,建议JDK1.6u17之后的版本,最好改成1.7。

解决:升级JDK到1.7即可。