玩闪电部队错误代码2-btnsuccess的颜色代码是什么意思

Struts2 异常错误总结
我的图书馆
Struts2 异常错误总结
Struts2 异常错误总结
一、后台不断出现 “警告: Could not find property [struts.valueStack] ”  解决:没有log4j-xxx.jar,下载一个,把它放到lib下面二、java.lang.NoClassDefFoundError: org/apache/struts2/dojo/views/jsp/ui/HeadTag  解决办法:原因缺少了dojo的JAR包,引入即可:struts2-dojo-plugin-2.1.2.jar  (The "head" tag renders required javaScript code to configure Dojo and is required in order to use any of the tags included in the Dojo plugin.--------------------If you are planning to nest tags from the Dojo plugin, make sure you       set parseContent="false", otherwise each request made by the inner tags will be performed twice. )三、Unable to load configuration. - bean - jar:file:/F:/Struts2/struts2/WebROOt/WEB-INF/lib/struts2-core-&& 2.1.2.jar!/struts-default.xml:46:178&&&&& Caused by: Unable to load bean: type:org.apache.struts2.dispatcher.multipart.MultiPartRequest class:org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequest -&&&&&& bean - jar:file:/F:/Struts2/struts2/WebROOt/WEB-      INF/lib/struts2-core-2.1.2.jar!/struts-default.xml:46:178&&&&& Caused by: java.lang.NoClassDefFoundError: org/apache/commons/fileupload/RequestContext   解决办法:缺少JAR包,引入commons-fileupload-1.2.1.jar,commons-io-1.3.2.jar即可四、No tag "datetimepicker" defined in tag library imported with prefix "s"&&&&&& 原因版本问题:缺少struts-dojo-plugin JAR包,以及Html的,&HEAD&&/HEAD&中没有使用&s:head/&标签&&&&&&&& If you're using Struts 2.1.x you're probably missing the& struts-dojo-plugin. Micha&eUML;l's reference below applies to struts 2.1.xonly. In the lasts versions (since 2.0.9 I guess), all Ajax are in dojo& plugin.  & & So you need to include &%@ taglib uri="/struts-dojo-tags" prefix="sx"%&  & & and &sx:head/&  & &( Temp1:  &sx:datetimepicker name="picker" /&  Temp2:  &sx:datetimepicker type="time" name="picker" /&&br/&  Temp3:  &sx:datetimepicker value="%{''}" name="picker" /&  Temp4:  &sx:datetimepicker value="date" name="picker" /&)  & & and call :&sx:datetimepicker .../&五、使用TILES框架&&& &&& If you use the Tiles 2 plugin, check your tiles.xml file(s) to ensure they contain a DOCTYPE.&&& &!DOCTYPE tiles-definitions PUBLIC "-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN"""&  &tiles-definitions&六、struts2中不支持EL表达式 Convert EL expressions to OGNL &&& struts2.1 tags do not allow evaluation of jsp EL within their attributes.   Instead, struts2 tags evaluate attribute values as OGNL. Allowing both   expression languages within the same attribute opens major security   vulnerabilities.七、文件上传过程中取不到文件名和文件类型,即都取到NULL&&& 原因:如果页面中file的name=“a”则我们ACTION中设置String aContentType,String aFileN(此两个其实无所谓,关键是SET方法)&&& setA(File file)(){}; setAContentType(String s){};setAFileName(String name){} 即格式如下:setXContentType() setXFileName().X代表你给FILE取的NAME名字 必须和它相同,固定格式八、严重: Unable to parse request  mons.fileupload.FileUploadBase$SizeLimitExceededException: the request was rejected because its size (8523356) exceeds the configured maximum (2097152)  at mons.fileupload.FileUploadBase$FileItemIteratorImpl.&init&(FileUploadBase.java:914) 17:46:51 com.opensymphony.xwork2.monsLogger warn  警告: Could not find property [struts.valueStack]   17:46:51 com.opensymphony.xwork2.monsLogger error  严重: the request was rejected because its size (8523356) exceeds the configured maximum (2097152)   17:46:51 com.opensymphony.xwork2.monsLogger warn  警告: Could not find property [org.apache.catalina.jsp_file]  原因:上传文件大小超过预定大小,可以在struts.properties配置文件中设置struts.multipart.maxSize=XXX(XXX为文件大小)九、配置了文件类型限制后,当传错误类型可以拦截不让用户上传该文件,可是跳转的页面却没有跳转到input配置的错误页面,而是返回到了success正确页面。  严重: Content-Type not allowed: filedata "upload__5bd4dcf__0.tmp" text/plain  《我的打印输出DEBUG语句内容:File:null FlieName:null&&&&& type:null》即拦截类型成功了  java.lang.NullPointerException  at java.io.FileInputStream.&init&(FileInputStream.java:103)  at com.study.web.util.FileUploadUtil.uploadFile(FileUploadUtil.java:36)  at com.study.web.action.UploadFileAction.execute(UploadFileAction.java:58)  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)。。。   10:59:07 com.opensymphony.xwork2.monsLogger warn  警告: Could not find property [org.apache.catalina.jsp_file]   10:59:07 com.opensymphony.xwork2.monsLogger warn  警告: Could not find property [struts]   10:59:07 com.opensymphony.xwork2.monsLogger info  信息: Removing file filedata \tmp\upload__5bd4dcf__0.tmp  原因及解决办法:在该文件上传Action中只配置了FileUploadInterceptor后缺少配置了defaultStack拦截器.  在ACTION中配置玩defaultStack拦截器后改错误消失。十、struts.properties中全局配置文件大小,再使用默认FileUploadInterceptor拦截器时候能实现拦截的功能但是后台出现异常。  严重: Unable to parse request mons.fileupload.FileUploadBase$SizeLimitExceededException: the request was rejected because its size (380) exceeds the configured maximum (10)  at mons.fileupload.FileUploadBase$FileItemIteratorImpl.&init&(FileUploadBase.java:914)  原因:未知。将全局配置中的限制大小去掉,再重新在ACTION中覆盖配置FileUploadInterceptor拦截器设置大小和文件类型限制,可消除异常。十一、多文件上传中,其中一个传被限制的文件如限制aplication/msword(即.doc)文件,允许传文本文件。然而当夹杂在一起传的时候,后台能截获类型错误不可传信息,但是实际却还是上传成功。  严重: Content-Type not allowed: filedata "upload_4da33e76ab9__7.tmp" application/msword  file is :\tmp\upload_4da33e76ab9__6.tmp fileName:project.txt fileType:text/plain  file is :\tmp\upload_4da33e76ab9__7.tmp fileName:application base.doc fileType:application/msword  file is :\tmp\upload_4da33e76ab9__8.tmp fileName:zhongqi-bug.txt fileType:text/plain  原因:忘记了继承ActionSupport类。继承后异常消失。十二、文件上传异常,不能创建File文件  Cannot create type class java.io.File from value C:\Documents and Settings\admin\桌面\OrderReporterServiceImp.java - [unknown location]  原因:忘记了在form表单里将enctype设置成文件上传格式:enctype="multipart/form-data"十三、当使用限制文件类型和大小的时候抛出空指针异常  java.lang.NullPointerException  demo.struts2.action.ValidatFileUploadAction.execute(ValidatFileUploadAction.java:71)  sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  原因:在ACTION中配置了fileUpload拦截器后忘记了配置默认拦截器:defautlStack。注意当ACTION中配置自己的拦截器后需要显示配置默认  拦截器defaultStack十四、在国际化时候抛空指针异常:  16:31:12,812 ERROR [jsp]:253 - Servlet.service() for servlet jsp threw exception java.lang.NullPointerException at java.text.MessageFormat.applyPattern(MessageFormat.java:414)  at java.text.MessageFormat.&init&(MessageFormat.java:350) at com.opensymphony.xwork2.DefaultTextProvider.getText(DefaultTextProvider.java:70)  原因:忘记了在struts.xml中配置国际化常量,或者在struts.properties中配置全局国际化常量 struts.custom.i18n.resources=globeMessage十五、struts action的配置文件加载失败:  Unable to load configuration. - result - file:/D:/java/apache-Tomcat-5.5.20/webapps/mysts/WEB-INF/classes/test.xml:10:26  Caused by: No result type specified for result named 'error', perhaps the parent package does not specify the result type? - result - file:/D:/java/apache-Tomcat-5.5.20/webapps/mysts/WEB-INF/classes/test.xml:10:26  at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.buildResults(XmlConfigurationProvider.java:609)&&&& 原因:忘记了继承包struts-default十六、 struts action 配置文件注意事项:&&&& 1. 别忘记了继承struts-default默认配置包&&&& 2.如果配置命名空间,一定要以"/"开始,例如:namespace="/test"&&&& 3.每个模块struts action配置文件中都可以配置全局result,global-result 经测试不会冲突,STRTUS会智能寻找该Action请求的模块struts ACTION配置包十七、jsp中的&s:optiontransferselect /&标签已正常显示使用  &s:optiontransferselect tOOltip="用户权限" label="设置权限"   name="mhPopedom.leftList_1"   leftTitle="用户未授权限"   list="leftList_1"   listKey="popeId"   listValue="popeName"   headerKey="headerKey"   multiple="true"   emptyOption="false"   allowUpDownOnLeft="false"   CSSStyle="width:200height:300"   CSSClass="input2"   addToLeftLabel="向左移动"   addToRightLabel="向右移动"   addAllToLeftLabel="全部左移"   selectAllLabel="全部选择"   addAllToRightLabel="全部右移"   doubleName="rightPopedom"   rightTitle="用户已授权限"   doubleList="rightList_1"   doubleListKey="popeId"   doubleListValue="popeName"   doubleHeaderKey="doubleHeaderKey"   doubleMultiple="true"   doubleEmptyOption="false"   allowUpDownOnRight="false"   doubleCSSClass="input2"   doubleCSSStyle="width:200height:300"&   &/s:optiontransferselect&   但不论怎样在action中都不能获得rightPopedom的值,报空指针异常。  解决办法:  后台action里面添加属性(setXXX和getXXX方法):   private String[] leftL   private String[] rightL   在前台页面上,当提交表单时,onclick事件调用下面的js:   &script type="text/javascript"&   function myself(){     var right=document.forms[0].rightL     for(i=1; i &right. i++)     right[i].selected =   }   &/script&   提交后,就能在后台得到rightList里面的值了。   如果没有这段Js代码,后台是得不到值的,这是struts2 &s:optiontransferselect/&本身的bug.  第二种解决办法:  在form中使用&s:submit/&也能够取到值十八、“strutsUtils 未定义”错误  struts2.1.6  s:optiontransferselect   没有加载 struts2 js  已加 &s:head /&  源文件生产:  &script src="/xxxx/struts/utils.js" type="text/javascript"&&/script&  原因:  web.xml中  struts没拦截js文件,需加如:  &filter-mapping&  &filter-name&struts2&/filter-name&  &url-pattern&*.js&/url-pattern&  &/filter-mapping&  或者  &filter-mapping&  &filter-name&struts2&/filter-name&  &url-pattern&/struts/*&/url-pattern&  &/filter-mapping&  提醒一下:把所有路径都过滤的不会出现这个情况,一些视频和书籍教程,默认是&url-pattern&/**&/url-pattern&,已经把所有的路径全部都过滤了,看到别人的没有问题,但到真正自己开发时,问题错漏百出,呜呜……  转自:
TA的最新馆藏
喜欢该文的人也喜欢struts2常见错误总结
1.Caught exception while loading file struts-default.xml - [unknown
解决办法:
由于lib包冲突造成的,将两个解析xml用的jar从项目里移到tomacat的lib下面就ok了,xml-apis.jar
xerces-2.6.2.jar
2.严重: Exception starting filter struts2
Error building results for action login in
namespace&&- action -
file:/E:/apache-tomcat-6.0.14/webapps/testStruts2/WEB-INF/classes/struts.xml57
原因:在web.xml已声明使用模板,并对所有的类进行了监听,但在处理过程中,发现不知道到哪里去找模板的配置文件,即在struts.xml中已使用了模板,但并没有告诉程序应该到哪去解析这些内容,即titles-default.java文件应该声明出来,
原因1:在struts.xml中错误的声明如下:
&package name="aa1" extends="struts-default"
&action name="login"
class="com.sun.demo.LoginAction"&
type="tiles"&showWelcomePage&/result&
&/package&
&package name="aa1" extends="titles-default"
&action name="login"
class="com.sun.demo.LoginAction"&
type="tiles"&showWelcomePage&/result&
&/package&
原因2:titles.xml文件的 错误配置
&tiles-definitions&
&&definition name="showWelcomePage"
template="template.jsp"&&
&&&&put-attribute
name="menu"
&menu_1.jsp&/put-attribute&&
&&&&put-attribute
name="content"
&login_form.jsp&/put-attribute&
&/definition&
正确的配置为:
&tiles-definitions&
&&definition name="showWelcomePage"
template="template.jsp"&&
&&&&put-attribute
name="menu"
value="/menu_1.jsp"&&/put-attribute&&
&&&&put-attribute
name="content"
value="/login_form.jsp"&&/put-attribute&
&/definition&
页面显示情况如下:
错误配置如下:
&definition name="showWelcomePage"
template="template.jsp"&&
&&&&put-attribute
name="menu"
value="menu_1.jsp"&&/put-attribute&&
&&&&put-attribute
name="content"
value="login_form.jsp"&&/put-attribute&
&/definition&
正确配置如下 :
&definition name="showWelcomePage"
template="template.jsp"&&
&&&&put-attribute
name="menu"
value="/menu_1.jsp"&&/put-attribute&&
&&&&put-attribute
name="content"
value="/login_form.jsp"&&/put-attribute&
&/definition&
在value属性中,以"/"开头表示地址,如果不以“/”开头,则系统会默认为内容
3.执行增加操作时,直接对对象进行操作,对象中各字段值都正确,但插入数据库后乱码
解决办法(1)统一页面和数据库编码为utf-8
(2)修改hibernate的配置文件,修改url属性为:
jdbc:mysql:/127.0.0.1:3306/shop?useunicode=true&characterEncuoding=utf-8
4.could not create Query
原因:sql语句书写不正确
5.mysql数据库问题
mysql Error 1115号错误,utf编码
解决办法:
安装时编码采用默认的编码,安装成功后,再到安装路径下修改安装语言,修改mysql/my.ini文件。
6.在对对象进行删除操作时,如果对象中的某个字段不允许为空,则必须赋值,否则会提示:字段名not null等信息
7.在进行页面跳转时(从action中到页面,使用了模板),提示I/O异常
解决办法:tiles.xml文件中document题头没有书写正确
8.在进行页面跳转时,已经跳转到了相应的页面,但显示结果页面不正确。
解决办法:检查模板中的各个属性是否正确配置,尤其注意有的属性会忘记配置。
9.对日期类型数据进行操作
(1)配置文件中相对应的字段属性改为date
(2)pojo类中引用java.sql.date
10.Nosuchdefinition titles...
原因:tiles.xml文件中的配置有问题,尤其注意name属性
11.在服务器一启动,就会报“Filter error”等提示信息,项目无法建立
原因1)struts.xml配置错误
1&package中extends错误
2&action中
12、No result defined for action ***Action and result
这个错误产生的原因是,在struts.xml中配置没有配置success
result。我的理解是action执行完后,必须产生一个result类。这个类可是servlet或是其他,但不能为空。
& & 解决方法:增加result
success定义。
&result&***.jsp&/result&
& &13、No result defined for
action ***Action and result input
& &这个错误,在提交数据时经常碰到。定义的struts2
intercept发挥了作用,当POJO类型与输入的类型不同时,intercept类会中止拦截,并返回输入页面。详细的错误可在使用&s:fielderror/&来获取。
& & 解决方法:增加resut
input定义。
& & &result
name="input"&***.jsp&/result&
& &14、There is no Action mapped
for namespace / and action name ***Action
可以直译为没有找到这个action,也就是说在struts.xml中没有定义这个action。这个错误一般是action的名字拼写错误造成的,请仔细检查struts.xml的定义与页面的acrion是否一致。
& &15、Class ognl.OgnlRuntime can
not access a member of class ***Action with modifiers
关键字是"private",action类中的字段为private,这样页面(如jsp)是无法访问到的,这也是struts2面向对象的一大特征。
& & 解决方法:
& & 在action中添加set
get方法,这样struts会自访问这个方法。set get方法必须遵循bean的标准写法。
&&16、Exception starting filter
&未定变义struts-default。也package中加入extends="struts-default"
17、笔下之前遇到一个问题:报:Error building results for
action admin_* in namespace
同时还报:Caused by: There is no result type
defined for type 'redirectAction'
网上说是package元素里要加入extends="struts-default"属性,
但是package元素里有extends="struts-default"属性,之前很费解
最后修改redirectAction为redirect-action解决问题,个人估计是struts2版本的问题
&result name="checkSuccess"
type="redirect-action"&
总结:仔细看错误原因很重要,对症下药!
18、redirect和redirect-action的区别
使用redirect需要后缀名
使用redirect-action"不需要后缀名
&result name="success"
type="redirect"&viewTask.action&/result&
&result name="success"
type="redirect-action"&viewTask&/result&
已投稿到:
以上网友发言只代表其个人观点,不代表新浪网的观点或立场。}

我要回帖

更多关于 错误代码8什么意思 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信