- 浏览: 65264 次
- 性别:
- 来自: 广州
-
文章分类
最新评论
-
就不给你佛:
甚好
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 1572解决Jetty运行时锁定静态文件(css, js, im ... -
jetty的Form too large异常解决方案
2012-12-07 08:46 1557在用jetty做图片上传时发现jetty的reque ... -
【转】Quartz CronTrigger最完整配置说明
2012-12-03 13:27 1085CronTrigger配置格式: 格式: [秒] [分 ... -
struts2-OGNL表达式中的#、%和$
2012-12-03 13:26 757OGNL表达式非常强大~其中#、%、$这三个符号在OGN ... -
struts2.x标签if test 的一个字符型值字符串比较(转)
2012-12-03 13:25 889例如这个语句 要判断struts堆栈里systemSettin ... -
run-jetty-run热部署问题补充
2011-07-07 12:00 2860本身配置了run-jetty-run来debug自己的war, ... -
Tomcat部署两个相同工程遇到问题及解决方案汇总
2011-04-13 11:30 1656一、 我写了2个用了struts2的项目。 若我把这2个项目全 ... -
Tomcat7配置发布jndi数据源
2011-04-13 11:24 2396Tomcat7配置发布jndi数据源 Jul-13-2010 ...
相关推荐
数分1.11Tableau安装及使用教程
内容概要:本文主要围绕着计算机信息系统运行管理员考试展开讨论,详细介绍了有关信息系统在运维中的各种问题及其应对方案。具体而言,文中不仅列举出了不同类型的信息系统对其本身的要求,而且还深入探讨了运维管理中面临的挑战和技术手段。另外,文章特别提及了一些特定类型的系统(例如政府系统和财务管理等),并指明在面对它们时需要考虑的安全级别、稳定性等关键要素;同时也强调了良好的文档管理和合理的设施运维对象划分,以及软硬件的选择与维护。同时文章还讲解了多种工具的作用(比如Nagios),以及硬件如计算机机房和UPS的具体规格和要求;并且讲述了关于变更管理和发布管理等的概念与实际应用场景。此外,在最后一部分内容里也谈到了云架构及其各个构成部分。 适用人群:本文适合即将参加软考信息运行管理员认证的专业人士,也适用于希望深入了解信息系统运作、管理和维护的技术从业者和相关领域的管理人员。 使用场景及目标:本资料旨在辅助考生掌握信息系统的高效、稳健地构建与运营所需的知识和技术,帮助他们顺利通过软考的同时提升实战经验;同时也为企业信息化建设提供了宝贵的理论基础和实践指南。 其他说明:虽然本文聚焦于特定职业资格证书
大型语言模型(LLMs)的出现彻底改变了自然语言处理。然而,这些模型在从大量数据集中检索精确信息时面临挑战。检索增强生成(RAG)旨在通过结合外部信息检索系统来增强LLMs,从而提高响应的准确性和上下文性。尽管有所改进,RAG在高容量、低信息密度数据库中的全面检索仍然存在困难,并且缺乏关系意识,导致答案碎片化。 为了解决这一问题,本文介绍了伪知识图谱(PKG)框架,该框架通过集成元路径检索、图内文本和向量检索到LLMs中,旨在克服这些限制。通过保留自然语言文本并利用各种检索技术,PKG提供了更丰富的知识表示并提高了信息检索的准确性。使用Open Compass和MultiHop-RAG基准进行的广泛评估表明,该框架在管理和处理大量数据及复杂关系方面具有有效性。
python学习教程
请到网盘中自取压缩包,此包为kibana-7.10.2 镜像压缩包,是通过现有镜像导出来的,主要是为了解决有些机器无法连接外网,导致无法下载镜像 加载镜像: docker load -i kibana-7.10.2.tar 查看镜像: docker images 备注:elk此镜像配套资源,相同版本的elasticsearch和logstash,请在我的资源中搜索其他镜像
UniApp开发一个简单的记事本应用文字教程
基于Andorid的音乐播放器项目设计(QQ音乐)实现源码,主要针对计算机相关专业的正在做毕设的学生和需要项目实战练习的学习者,也可作为课程设计、期末大作业。
python学习资源
React Developer Tools在谷歌拓展的应用商城下载不了任何解决
【毕业设计-java】springboot-vue健身房管理系统源码(完整前后端+mysql+说明文档+LunW).zip
python学习资源
本文提供了一套完整的指南,帮助用户在Anaconda中配置PyTorch环境,便于深度学习开发。首先,用户需要确保安装Anaconda,并通过Anaconda Prompt创建一个新的虚拟环境,以隔离项目依赖。创建好环境后,用户可以根据所用操作系统以及CUDA版本,选择适合的安装命令。对于Windows和Linux用户,提供了安装PyTorch、TorchVision和TorchAudio的具体命令,包括CUDA Toolkit的版本选择。macOS用户则可以安装仅支持CPU的版本。安装完成后,通过简单的Python代码验证PyTorch是否成功安装以及GPU的可用性。文中还列出了常见问题及解决方法,帮助用户快速排查安装过程中可能遇到的障碍。通过遵循这些步骤,用户可以顺利搭建起一个专属的PyTorch开发环境,提升深度学习的工作效率和体验。
python学习教程
内容概要:本文汇总了学习数据结构的相关资源,旨在帮助读者系统化地理解和掌握这一计算机科学的基础概念。文中首先列举了一系列权威在线学习资源,包括知名教授的主页、在线编程平台LeetCode和技术博客,这些资源不仅理论丰富,还提供大量的实例和练习机会。接着推荐了几本经典的书籍,如《算法导论》、《大话数据结构》,适合不同程度的学习者深入理解算法和数据结构的细节。此外,还特别提及了几门高质量的网络课程,能够为初学者提供清晰的学习路径。最后强调通过动手实践,如动态数组的C语言实现以及算法题目的刷题练习,是提高编程技能的有效途径。 适合人群:对于想要系统学习并掌握数据结构的程序员及爱好者。 使用场景及目标:适用于个人自学或者课堂教学,目的是通过综合使用理论学习、实践操作来达到对数据结构和算法有全面深刻的认识。 其他说明:本文提供了丰富的链接,让读者可以直接访问各个优质教育资源进行深度探究,鼓励大家积极参与讨论,相互分享心得体验,形成良好的互动交流氛围。
QMI8658 Datasheet
【毕业设计】java-springboot-vue火车订票管理系统源码(完整前后端+mysql+说明文档+LunW).zip
Screenshot_2025-03-10-22-52-22-034_com.miui.notes.jpg
python学习教程
基于unet医学细胞分割python实战源码+数据集(图像分割大作业).zip 【项目简介】 该项目是一个基于 U-Net 的医学细胞分割实战项目,适合初学者学习。项目包含了数据集准备、模型构建、训练和验证等完整的流程。 主要功能 实现 U-Net 模型的构建和训练 提供医学细胞分割的数据集和数据预处理 实现分割模型的评估指标,如 Dice 系数等 Python PyTorch U-Net 模型 【项目说明】 1.多数小白下载后,在使用过程,可能会遇到些小问题,若自己解决不了,请及时私信描述你的问题,我会第一时间提供帮助,也可以远程指导 2.项目代码完整可靠,但难度适中,满足一些毕设、课设要求,且属于易上手的优质项目,项目内基本都有说明文档,按照操作即可,遇到困难也可私信交流 3.适用人群:各大计算机相关专业行业的在校学生、高校老师、公司程序员等下载使用