- 浏览: 61822 次
- 性别:
- 来自: 广州
文章分类
最新评论
-
就不给你佛:
甚好
M2工程 mvn deploy 401 403错误处理 -
lian819:
相当简洁, 支持一个
Tomcat7配置发布jndi数据源 -
judim:
window.showModalDialog 去掉水平滚动条在 ...
window.showModalDialog 去掉水平滚动条 -
leoz0802:
哥们。。。想问下怎么设置热部署不重启服务器。谢了。。。最好有p ...
run-jetty-run热部署问题补充 -
napoleonshow:
谢谢分享!!
struts2错误集合
1.java.lang.ClassCastException: java.lang.Integer 从session取值后转化到int
String ss=session.get("id").toString();
int id=Integer.parseInt(ss);
2.将string转化为float
float f=Float.valueOf("11");
3.将Integer转化为String
4.String转化为double
Double.parseDouble("11.1");
5.struts2 标签换行
在默认情况下,表单元素是分布在不同行的。如下代码:
<s:form action="login2">
<s:textfield label="用户名" name="username"/>
<s:password label="密码" name="password"/>
<s:submit label="提交"/>
</s:form>
我们看着以上的代码跟HTML的差不了多少,但是因为struts2表单默认将表单内的每一个元素都分在单独的一行,label属性就如同我们在HTML中在<input type="text"/>前面的文字标签一样。如果我们不想让它自动换行,那就应该写成如下格式:
<s:form action="login2" theme="simple">
<s:textfield label="用户名" name="username"/>
<s:password label="密码" name="password"/>
<s:submit label="提交"/>
</s:form>
但在设置theme="simple"后,表单元素的label属性将失效,这时我们就得在表单元素前面加入想用label显示的文字。如:
<s:form action="login2" theme="simple">
用户名:<s:textfield label="用户名" name="username"/>
密码:<s:password label="密码" name="password"/>
<s:submit label="提交"/>
</s:form>
此时显示的为将不在是label中的值,而是显示文本框前面的文字,按钮则显示它原来的默认值:sbumit。
ell-formed character data or markup.
6.No result defined for action com.upload.UploadAction and result input
form中可能缺少:method="post"
7. \upload\鏉庡紑澶峔缁欎腑鍥藉鐢熺殑绗簩灏佷俊.doc (系统找不到指定的路径。)
public String getSavePath() {
return ServletActionContext.getRequest().getRealPath(savePath);//不能写成return this.savePath;
}
8.The method getRealPath(String) from the type ServletRequest is deprecated
ServletActionContext.getRequest().getRealPath(savePath);
把页面中的编码改成GBK
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
改为:<%@ page language="java" contentType="text/html;charset=GBK"%>
9.如何使用JDK中的bin的native2ascii来进行中文转换
10.Exception in thread "main" java.util.MissingResourceException: Can't find bundle for base name mess, locale zh_CN
无法读取中文数据
11.struts2中不能用<s:hidden>标签,否则action只会返回"input"
12.Exception starting filter struts2
java.lang.ClassNotFoundException: org.apache.struts2.dispatcher.FilterDispatcher
没有加入Struts2需要的几个包
__________________________________________________________________________________________
13.Error building results for action validateName in namespace - action
Caused by: There is no result type defined for type 'json' mapped with name 'success' - result
_________________________________________________________________________________________
14.uk.ltd.getahead.dwr.util.CommonsLoggingOutput error
严重: Found reference to variable named 'c0-e1', but no variable of that name could be found.
2009-2-5 17:32:56 uk.ltd.getahead.dwr.util.CommonsLoggingOutput info
信息: Exec[0]: validator.doPost()
2009-2-5 17:32:56 org.apache.struts2.validators.DWRValidator doPost
严重: Error while trying to validate
There is no Action mapped for action name . - [unknown location]
___________________________________________________________________________________________
15.Bean type class com.opensymphony.xwork2.ObjectFactory with the name xwork has already been loaded by bean
________________________________________________________________________________________________
16.警告: No configuration found for the specified action: 'login.action' in namespace: ''. Form action defaulting to 'action'
___________________________________________________________________________________________
17.2009-2-9 12:00:55 com.opensymphony.xwork2.validator.ActionValidatorManagerFactory <clinit>
信息: Detected AnnotationActionValidatorManager, initializing it...
attribute's literal value
______________________________________________________________________________________________
18.严重: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.orm.hibernate3.LocalSessionFactoryBean]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/dom4j/DocumentException
Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.orm.hibernate3.LocalSessionFactoryBean]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/dom4j/DocumentException
Caused by: java.lang.NoClassDefFoundError: org/dom4j/DocumentException
____________________________________________________________
19.信息: building session factory
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDao' defined in class path resource [applicationContext.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is 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 java.lang.NoClassDefFoundError: org/objectweb/asm/Type
Caused by: 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 java.lang.NoClassDefFoundError: org/objectweb/asm/Type
Caused by: java.lang.NoClassDefFoundError: org/objectweb/asm/Type
缺少包:asm.jar
__________________________________________________________________________________________
20.信息: building session factory
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDao' defined in class path resource [applicationContext.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is 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 java.lang.NoClassDefFoundError: net/sf/cglib/proxy/CallbackFilter
Caused by: 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 java.lang.NoClassDefFoundError: net/sf/cglib/proxy/CallbackFilter
Caused by: java.lang.NoClassDefFoundError: net/sf/cglib/proxy/CallbackFilter
缺少包:commons-collections-2.1.1.jar
_____________________________________________________________________________________
21.信息: Loading XML bean definitions from class path resource [applicationContext.xml]
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDao' defined in class path resource [applicationContext.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.orm.hibernate3.LocalSessionFactoryBean]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/dom4j/DocumentException
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.orm.hibernate3.LocalSessionFactoryBean]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/dom4j/DocumentException
Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.orm.hibernate3.LocalSessionFactoryBean]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/dom4j/DocumentException
Caused by: java.lang.NoClassDefFoundError: org/dom4j/DocumentException
缺少包:dom4j-1.6.1.jar
___________________________________________________________________________
22.严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: javax/transaction/TransactionManager
Caused by: java.lang.NoClassDefFoundError: javax/transaction/TransactionManager
缺少包:jta.jar
___________________________________________________________________________
23.java.lang.IllegalArgumentException: sessionFactory or hibernateTemplate is required
根据提示在配置文件中为这个类添加一个property属性
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
就不会报错.但是其它的Service类并不需要这么做,让我感觉很奇怪.最终发现原来是我让CataogService extends HibernateDaoSupport .改正后运行正常,goood
牢记....
________________________________________________________________________________
24.Exception in thread "main" java.lang.NoClassDefFoundError: net/sf/ehcache/CacheException
缺少包:ehcache-1.2.3.jar
________________________________________________________________________________
25.Exception in thread "main" java.lang.NoClassDefFoundError: net/sf/cglib/core/KeyFactory
缺少包:cglib-2.1.3.jar
_______________________________________________________________________________________
26.Exception in thread "main" java.lang.NoClassDefFoundError: antlr/ANTLRException
___________________________________________________________
27.Exception starting filter struts
Action class [loginbean] not found
加入包:struts2-spring-plugin-2.0.6.jar
struts.xml文件中加入:
<constant name="objectFactory" value="spring"></constant>
______________________________________________________________________
28.log4j:WARN No appenders could be found for logger (org.apache.catalina.startup.TldConfig).
log4j:WARN Please initialize the log4j system properly.
加入文件
log4j.properties
#
# Log4J Settings for log4j 1.2.x (via jakarta-commons-logging)
#
# The five logging levels used by Log are (in order):
#
# 1. DEBUG (the least serious)
# 2. INFO
# 3. WARN
# 4. ERROR
# 5. FATAL (the most serious)
# Set root logger level to WARN and append to stdout
log4j.rootLogger=INFO, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
# Pattern to output the caller's file name and line number.
log4j.appender.stdout.layout.ConversionPattern=%d %5p (%c:%L) - %m%n
# Print only messages of level ERROR or above in the package noModule.
log4j.logger.noModule=FATAL
# OpenSymphony Stuff
log4j.logger.com.opensymphony=INFO
log4j.logger.org.apache.struts2=INFO
# Spring Stuff
log4j.logger.org.springframework=INFO
___________________________________________________________________________
29.警告: Settings: Could not parse struts.locale setting, substituting default VM locale)
原来要解决也不难,
创建struts.properties这个文件,放在src目录下就可以了
struts.locale=en_GB
____________________________________________________
30.No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath
把hibernate里ehcache-1.2.3.jar的ehcache.xml拷贝到src目录下,hibernate3用到了ehcache
___________________________________________________________________________________
31. Missing classdef for creator 'script'. Failed to load uk.ltd.getahead.dwr.create.ScriptedCreator. Cause: org/apache/bsf/BSFException
缺少包:bsf.jar
_____________________________________________________
32.No result defined for action com.action.LoginAction and result input - action - file:/E:/struts2Workspace/login/WebRoot/WEB-INF/classes/struts.xml:11:55
当使用struts2的配置文件验证时,若表单验证不通过,系统将默认返回"input",这时要在struts.xml中配置这个result
<result name="input">/login.jsp</result>
_________________________________________________________________________
33.org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/apache/commons/collections/SequencedHashMap
Caused by:
java.lang.NoClassDefFoundError: org/apache/commons/collections/SequencedHashMap
缺少包:commons-collections-2.1.1.jar
_______________________________________________________________________________________
34.org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: net/sf/ehcache/CacheException
Caused by:
java.lang.NoClassDefFoundError: net/sf/ehcache/CacheException
缺少包:ehcache-1.2.3.jar
___________________________________________________________________________________
35.No result defined for action com.action.ValidateNameAction and result input - action
_____________________________________________-
36.java.sql.SQLException: Positioned Update not supported.
分析---------------------------------------------------------------------------------------
在我的ValidateNameAction中一共有3个properties,其中有个bean是userManager而且是在spring framework中已经实例化了的,问题就出在它身上了。于是在struts.xml中加入该bean的exclude,再测试,成功了!
发送action的request后,服务返回JSON数据。
解决-----------------------------------------------------------------------------------------
<package name="demo" namespace="/" extends="json-default">
<action name="roomStatus" class="room" method="roomStatus">
<result type="json">
<param name="excludeProperties">
userManager
</param>
</result>
</action>
</package>
_________________________________________________________________________________________________
37.java.lang.OutOfMemoryError: PermGen space及其解决方法
PermGen space的全称是Permanent Generation space,是指内存的永久保存区域OutOfMemoryError: PermGen space从表面上看就是内存益出,解决方法也一定是加大内存。说说为什么会内存益出:这一部分用于存放Class和Meta的信息,Class在被 Load的时候被放入PermGen space区域,它和和存放Instance的Heap区域不同,GC(Garbage Collection)不会在主程序运行期对PermGen space进行清理,所以如果你的APP会LOAD很多CLASS的话,就很可能出现PermGen space错误。这种错误常见在web服务器对JSP进行pre compile的时候。
内存溢出。
如果你的应用中有很多CLASS的话,就很可能出现PermGen space错误,
这种错误常见在web服务器对JSP进行pre compile的时候。如果你的WEB APP下使用了大量的第三方jar, 其大小超过了jvm默认的大小(4M)
那么就会产生此错误信息了。
解决方法: 手动设置MaxPermSize大小
修改TOMCAT_HOME/bin/catalina.sh
在“echo "Using CATALINA_BASE: $CATALINA_BASE"”上面加入以下行:
JAVA_OPTS="-server -XX:PermSize=64M -XX:MaxPermSize=128m
____________________________________________________________________________________________________---
38.struts2 中execute方法不执行问题
为一个action比如是LoginAction增加一个验证文件LoginAction-validation.xml,如果验证文件中要验证的字段多于登陆到LoginAction的页面上的字段,那么系统就会返回INPUT,而不会执行execute方法
________________________________________________________________________________________________________
39.java.lang.OutOfMemoryError: PermGen space
补充一下Windows下的做法:
设置环境变量JAVA_OPTS=-Xms512m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=256m
即可,java.lang.OutOfMemoryError: PermGen space的问题以前经常遇到,现在可以对付了
________________________________________________________________________________________________________
40.org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/dom4j/io/SAXReader
Caused by: java.lang.NoClassDefFoundError: org/dom4j/io/SAXReader
解决的方法:加入包dom4j-1.6.1.jar
String ss=session.get("id").toString();
int id=Integer.parseInt(ss);
2.将string转化为float
float f=Float.valueOf("11");
3.将Integer转化为String
4.String转化为double
Double.parseDouble("11.1");
5.struts2 标签换行
在默认情况下,表单元素是分布在不同行的。如下代码:
<s:form action="login2">
<s:textfield label="用户名" name="username"/>
<s:password label="密码" name="password"/>
<s:submit label="提交"/>
</s:form>
我们看着以上的代码跟HTML的差不了多少,但是因为struts2表单默认将表单内的每一个元素都分在单独的一行,label属性就如同我们在HTML中在<input type="text"/>前面的文字标签一样。如果我们不想让它自动换行,那就应该写成如下格式:
<s:form action="login2" theme="simple">
<s:textfield label="用户名" name="username"/>
<s:password label="密码" name="password"/>
<s:submit label="提交"/>
</s:form>
但在设置theme="simple"后,表单元素的label属性将失效,这时我们就得在表单元素前面加入想用label显示的文字。如:
<s:form action="login2" theme="simple">
用户名:<s:textfield label="用户名" name="username"/>
密码:<s:password label="密码" name="password"/>
<s:submit label="提交"/>
</s:form>
此时显示的为将不在是label中的值,而是显示文本框前面的文字,按钮则显示它原来的默认值:sbumit。
ell-formed character data or markup.
6.No result defined for action com.upload.UploadAction and result input
form中可能缺少:method="post"
7. \upload\鏉庡紑澶峔缁欎腑鍥藉鐢熺殑绗簩灏佷俊.doc (系统找不到指定的路径。)
public String getSavePath() {
return ServletActionContext.getRequest().getRealPath(savePath);//不能写成return this.savePath;
}
8.The method getRealPath(String) from the type ServletRequest is deprecated
ServletActionContext.getRequest().getRealPath(savePath);
把页面中的编码改成GBK
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
改为:<%@ page language="java" contentType="text/html;charset=GBK"%>
9.如何使用JDK中的bin的native2ascii来进行中文转换
10.Exception in thread "main" java.util.MissingResourceException: Can't find bundle for base name mess, locale zh_CN
无法读取中文数据
11.struts2中不能用<s:hidden>标签,否则action只会返回"input"
12.Exception starting filter struts2
java.lang.ClassNotFoundException: org.apache.struts2.dispatcher.FilterDispatcher
没有加入Struts2需要的几个包
__________________________________________________________________________________________
13.Error building results for action validateName in namespace - action
Caused by: There is no result type defined for type 'json' mapped with name 'success' - result
_________________________________________________________________________________________
14.uk.ltd.getahead.dwr.util.CommonsLoggingOutput error
严重: Found reference to variable named 'c0-e1', but no variable of that name could be found.
2009-2-5 17:32:56 uk.ltd.getahead.dwr.util.CommonsLoggingOutput info
信息: Exec[0]: validator.doPost()
2009-2-5 17:32:56 org.apache.struts2.validators.DWRValidator doPost
严重: Error while trying to validate
There is no Action mapped for action name . - [unknown location]
___________________________________________________________________________________________
15.Bean type class com.opensymphony.xwork2.ObjectFactory with the name xwork has already been loaded by bean
________________________________________________________________________________________________
16.警告: No configuration found for the specified action: 'login.action' in namespace: ''. Form action defaulting to 'action'
___________________________________________________________________________________________
17.2009-2-9 12:00:55 com.opensymphony.xwork2.validator.ActionValidatorManagerFactory <clinit>
信息: Detected AnnotationActionValidatorManager, initializing it...
attribute's literal value
______________________________________________________________________________________________
18.严重: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.orm.hibernate3.LocalSessionFactoryBean]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/dom4j/DocumentException
Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.orm.hibernate3.LocalSessionFactoryBean]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/dom4j/DocumentException
Caused by: java.lang.NoClassDefFoundError: org/dom4j/DocumentException
____________________________________________________________
19.信息: building session factory
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDao' defined in class path resource [applicationContext.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is 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 java.lang.NoClassDefFoundError: org/objectweb/asm/Type
Caused by: 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 java.lang.NoClassDefFoundError: org/objectweb/asm/Type
Caused by: java.lang.NoClassDefFoundError: org/objectweb/asm/Type
缺少包:asm.jar
__________________________________________________________________________________________
20.信息: building session factory
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDao' defined in class path resource [applicationContext.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is 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 java.lang.NoClassDefFoundError: net/sf/cglib/proxy/CallbackFilter
Caused by: 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 java.lang.NoClassDefFoundError: net/sf/cglib/proxy/CallbackFilter
Caused by: java.lang.NoClassDefFoundError: net/sf/cglib/proxy/CallbackFilter
缺少包:commons-collections-2.1.1.jar
_____________________________________________________________________________________
21.信息: Loading XML bean definitions from class path resource [applicationContext.xml]
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDao' defined in class path resource [applicationContext.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.orm.hibernate3.LocalSessionFactoryBean]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/dom4j/DocumentException
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.orm.hibernate3.LocalSessionFactoryBean]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/dom4j/DocumentException
Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.orm.hibernate3.LocalSessionFactoryBean]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/dom4j/DocumentException
Caused by: java.lang.NoClassDefFoundError: org/dom4j/DocumentException
缺少包:dom4j-1.6.1.jar
___________________________________________________________________________
22.严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: javax/transaction/TransactionManager
Caused by: java.lang.NoClassDefFoundError: javax/transaction/TransactionManager
缺少包:jta.jar
___________________________________________________________________________
23.java.lang.IllegalArgumentException: sessionFactory or hibernateTemplate is required
根据提示在配置文件中为这个类添加一个property属性
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
就不会报错.但是其它的Service类并不需要这么做,让我感觉很奇怪.最终发现原来是我让CataogService extends HibernateDaoSupport .改正后运行正常,goood
牢记....
________________________________________________________________________________
24.Exception in thread "main" java.lang.NoClassDefFoundError: net/sf/ehcache/CacheException
缺少包:ehcache-1.2.3.jar
________________________________________________________________________________
25.Exception in thread "main" java.lang.NoClassDefFoundError: net/sf/cglib/core/KeyFactory
缺少包:cglib-2.1.3.jar
_______________________________________________________________________________________
26.Exception in thread "main" java.lang.NoClassDefFoundError: antlr/ANTLRException
___________________________________________________________
27.Exception starting filter struts
Action class [loginbean] not found
加入包:struts2-spring-plugin-2.0.6.jar
struts.xml文件中加入:
<constant name="objectFactory" value="spring"></constant>
______________________________________________________________________
28.log4j:WARN No appenders could be found for logger (org.apache.catalina.startup.TldConfig).
log4j:WARN Please initialize the log4j system properly.
加入文件
log4j.properties
#
# Log4J Settings for log4j 1.2.x (via jakarta-commons-logging)
#
# The five logging levels used by Log are (in order):
#
# 1. DEBUG (the least serious)
# 2. INFO
# 3. WARN
# 4. ERROR
# 5. FATAL (the most serious)
# Set root logger level to WARN and append to stdout
log4j.rootLogger=INFO, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
# Pattern to output the caller's file name and line number.
log4j.appender.stdout.layout.ConversionPattern=%d %5p (%c:%L) - %m%n
# Print only messages of level ERROR or above in the package noModule.
log4j.logger.noModule=FATAL
# OpenSymphony Stuff
log4j.logger.com.opensymphony=INFO
log4j.logger.org.apache.struts2=INFO
# Spring Stuff
log4j.logger.org.springframework=INFO
___________________________________________________________________________
29.警告: Settings: Could not parse struts.locale setting, substituting default VM locale)
原来要解决也不难,
创建struts.properties这个文件,放在src目录下就可以了
struts.locale=en_GB
____________________________________________________
30.No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath
把hibernate里ehcache-1.2.3.jar的ehcache.xml拷贝到src目录下,hibernate3用到了ehcache
___________________________________________________________________________________
31. Missing classdef for creator 'script'. Failed to load uk.ltd.getahead.dwr.create.ScriptedCreator. Cause: org/apache/bsf/BSFException
缺少包:bsf.jar
_____________________________________________________
32.No result defined for action com.action.LoginAction and result input - action - file:/E:/struts2Workspace/login/WebRoot/WEB-INF/classes/struts.xml:11:55
当使用struts2的配置文件验证时,若表单验证不通过,系统将默认返回"input",这时要在struts.xml中配置这个result
<result name="input">/login.jsp</result>
_________________________________________________________________________
33.org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/apache/commons/collections/SequencedHashMap
Caused by:
java.lang.NoClassDefFoundError: org/apache/commons/collections/SequencedHashMap
缺少包:commons-collections-2.1.1.jar
_______________________________________________________________________________________
34.org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: net/sf/ehcache/CacheException
Caused by:
java.lang.NoClassDefFoundError: net/sf/ehcache/CacheException
缺少包:ehcache-1.2.3.jar
___________________________________________________________________________________
35.No result defined for action com.action.ValidateNameAction and result input - action
_____________________________________________-
36.java.sql.SQLException: Positioned Update not supported.
分析---------------------------------------------------------------------------------------
在我的ValidateNameAction中一共有3个properties,其中有个bean是userManager而且是在spring framework中已经实例化了的,问题就出在它身上了。于是在struts.xml中加入该bean的exclude,再测试,成功了!
发送action的request后,服务返回JSON数据。
解决-----------------------------------------------------------------------------------------
<package name="demo" namespace="/" extends="json-default">
<action name="roomStatus" class="room" method="roomStatus">
<result type="json">
<param name="excludeProperties">
userManager
</param>
</result>
</action>
</package>
_________________________________________________________________________________________________
37.java.lang.OutOfMemoryError: PermGen space及其解决方法
PermGen space的全称是Permanent Generation space,是指内存的永久保存区域OutOfMemoryError: PermGen space从表面上看就是内存益出,解决方法也一定是加大内存。说说为什么会内存益出:这一部分用于存放Class和Meta的信息,Class在被 Load的时候被放入PermGen space区域,它和和存放Instance的Heap区域不同,GC(Garbage Collection)不会在主程序运行期对PermGen space进行清理,所以如果你的APP会LOAD很多CLASS的话,就很可能出现PermGen space错误。这种错误常见在web服务器对JSP进行pre compile的时候。
内存溢出。
如果你的应用中有很多CLASS的话,就很可能出现PermGen space错误,
这种错误常见在web服务器对JSP进行pre compile的时候。如果你的WEB APP下使用了大量的第三方jar, 其大小超过了jvm默认的大小(4M)
那么就会产生此错误信息了。
解决方法: 手动设置MaxPermSize大小
修改TOMCAT_HOME/bin/catalina.sh
在“echo "Using CATALINA_BASE: $CATALINA_BASE"”上面加入以下行:
JAVA_OPTS="-server -XX:PermSize=64M -XX:MaxPermSize=128m
____________________________________________________________________________________________________---
38.struts2 中execute方法不执行问题
为一个action比如是LoginAction增加一个验证文件LoginAction-validation.xml,如果验证文件中要验证的字段多于登陆到LoginAction的页面上的字段,那么系统就会返回INPUT,而不会执行execute方法
________________________________________________________________________________________________________
39.java.lang.OutOfMemoryError: PermGen space
补充一下Windows下的做法:
设置环境变量JAVA_OPTS=-Xms512m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=256m
即可,java.lang.OutOfMemoryError: PermGen space的问题以前经常遇到,现在可以对付了
________________________________________________________________________________________________________
40.org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/dom4j/io/SAXReader
Caused by: java.lang.NoClassDefFoundError: org/dom4j/io/SAXReader
解决的方法:加入包dom4j-1.6.1.jar
- struts2错误集合.rar (5 KB)
- 下载次数: 5
发表评论
-
解决Jetty运行时锁定静态文件(css, js, image)的问题
2012-12-07 08:46 1443解决Jetty运行时锁定静态文件(css, js, im ... -
jetty的Form too large异常解决方案
2012-12-07 08:46 1472在用jetty做图片上传时发现jetty的reque ... -
【转】Quartz CronTrigger最完整配置说明
2012-12-03 13:27 963CronTrigger配置格式: 格式: [秒] [分 ... -
struts2-OGNL表达式中的#、%和$
2012-12-03 13:26 677OGNL表达式非常强大~其中#、%、$这三个符号在OGN ... -
struts2.x标签if test 的一个字符型值字符串比较(转)
2012-12-03 13:25 776例如这个语句 要判断struts堆栈里systemSettin ... -
run-jetty-run热部署问题补充
2011-07-07 12:00 2784本身配置了run-jetty-run来debug自己的war, ... -
Tomcat部署两个相同工程遇到问题及解决方案汇总
2011-04-13 11:30 1604一、 我写了2个用了struts2的项目。 若我把这2个项目全 ... -
Tomcat7配置发布jndi数据源
2011-04-13 11:24 2330Tomcat7配置发布jndi数据源 Jul-13-2010 ...
相关推荐
struts2错误集合.txt,里有有本人学习STRUTS2时遇到的问题,以及问题的解决方法
在对struts2,hibernate以及spring进行整合时,我们经常会使用MyEclipse自己为我们导入jar包,而实际上有很多jar包我们用不上,而且各框架之间的jar包还可能会有冲突,最终导致我们的项目过大,部署时间长,还可能会...
完整的Struts2框架,联系oracle数据库实现登录验证 验证码功能:点击图片切换验证码,验证码错误提示 登录成功后变量session中的list集合 内含备注
Struts 2 标签库(文档手册) Tags-API-CLSW-JSP <%@ taglib prefix="s" uri="/struts-tags" %> 就能使用struts2.0的标签库 下面就介绍每个标签的具体应用实例说明:按字母排列 A: 1. 2. <s:a href=""></s:a>-...
集合了各种常见的错误和异常,希望对大家有帮助
ssh集合spring3、struts2、hibernate3框架jar包集合支持annotation,属于最大jar包集合、诚信赚分、如有未知错误与本人联系、······
2.5.3 自定义国际化struts 2校验错误消息 92 2.5.4 struts 2的自带校验器 92 2.6 struts 2的拦截器 94 2.6.1 struts 2内建拦截器介绍 95 2.6.2 定义和使用拦截器栈 97 2.6.3 使用自定义拦截器 98 2.7 小结 100...
关于struts的转化器,数组属性的类型转换器,集合属性的类型转换器,直接封装成Object,直接封装成Map,类型转换的错误处理,全局类型转换器
由于实习需要,需要通过ajax来获取后台的List集合里面的值。由于前面没有接触过,所以今天就来研究下了。 一、首先需要下载JSON依赖的jar包。它主要是依赖如下: json-lib-2.2.2-jdk15 ezmorph-1.0.4 commons-...
11 Struts标签和错误处理(共38页) 12 Struts2基础开发(共30页) 13 Hibernate基础编程(共26页) 14 Hibernate高级编程(共27页) 15 Spring基础编程(共24页) 16 Struts、Spring、Hibernate的整合(共22页) 17...
2. 深入 STRUTS架构..................................................................................37 2.1. 随便谈谈......................................................................................
全书分4篇,共24章,其中,第1篇为技能学习篇,主要包括Java Web开发环境、JSP语法、JSP内置对象、Java Bean技术、Servlet技术、EL与JSTL标签库、数据库应用开发、初识Struts2基础、揭密Struts2高级技术、Hib锄劬e...
2. 深入STRUTS 架构..................................................................................37 2.1. 随便谈谈.......................................................................................
10.找出下列代码可能存在的错误,并说明原因: 二、JSP&Servlet技术 1.描述JSP和Servlet的区别、共同点、各自应用的范围 2.在Web开发中需要处理HTML标记时,应做什么样的处理,要筛选那些字符(< > & “”) 3.在...
\contentsline {chapter}{Contents}{2}{section*.1} {1}Java基础}{17}{chapter.1} {1.1}基本语法}{17}{section.1.1} {1.2}数字表达方式}{17}{section.1.2} {1.3}补码}{19}{section.1.3} {1.3.1}总结}{23}{...
还可以使用数字范围定义数字集合,如2..5等同于[2, 3, 4, 5],但是更有效率.注意,使用数字范围来定义集合时无需使用方括号,数字范围也支持反递增的数字范围,如5..2 5,Map对象 Map对象使用花括号包括,Map中的key-value...
16.2 协同使用Spring和WebWork 2/Struts 2 16.3 集成Spring和Tapestry 16.3.1 集成Spring和Tapestry 3 16.3.2 集成Spring和Tapestry 4 16.4 协同使用Spring和JSF 16.4.1 解析JSF管理的属性 16.4.2 解析Spring...