`
小杨学JAVA
  • 浏览: 905329 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

Could not create and/or set value back on to object

 
阅读更多
转! ERROR [com.opensymphony.xwork2.conversion.impl.InstantiatingNullHandler] - Could not create and/or set value back on to object 引用 struts2 类型转换异常时错误信息屏蔽 2011-05-24 16:29 类型转换异常导致转换方法没有正常返回,fieldError 中添加了相应的错误记录,系统打印出改异常,级别为warm。我认为不算是struts2的bug. 转换异常抛出警告很正常。如想屏蔽可用logger4j 配置级别到error 即可 ognl.MethodFailedException: Method "setLoc" failed for object tjx.HelloWorld@651e95 [java.lang.NoSuchMethodException: tjx.HelloWorld.setLoc([Ljava.lang.String;)] at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:1285) at ognl.OgnlRuntime.setMethodValue(OgnlRuntime.java:1474) at ognl.ObjectPropertyAccessor.setPossibleProperty(ObjectPropertyAccessor.java:85) at ognl.ObjectPropertyAccessor.setProperty(ObjectPropertyAccessor.java:162) at com.opensymphony.xwork2.ognl.accessor.ObjectAccessor.setProperty(ObjectAccessor.java:27) at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:2245) at com.opensymphony.xwork2.ognl.accessor.CompoundRootAccessor.setProperty(CompoundRootAccessor.java:77) at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:2245) at ognl.ASTProperty.setValueBody(ASTProperty.java:127) at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:220) at ognl.SimpleNode.setValue(SimpleNode.java:301) at ognl.Ognl.setValue(Ognl.java:737) 另一种解决方式,自己捕获异常,并在异常处理代码中添加filderror: if (context != null && (Boolean.TRUE.equals(context.get(XWorkConverter.REPORT_CONVERSION_ERRORS)))) { String realProperty = "loc"; //这要转换属性名称 String fullName = (String) context.get(XWorkConverter.CONVERSION_PROPERTY_FULLNAME); if (fullName != null) { realProperty = fullName; } Map<string object> conversionErrors = (Map<string object>) context.get(ActionContext.CONVERSION_ERRORS); if (conversionErrors == null) { conversionErrors = new HashMap<string object>(); context.put(ActionContext.CONVERSION_ERRORS, conversionErrors); } conversionErrors.put(realProperty, value); } return null; 引用 struts2.x 严重: Could not create and/or set value back on to object 2010-03-17 09:02 在用struts2.1提交表单时发生以下错误: 2010-3-17 8:51:08 com.opensymphony.xwork2.util.logging.jdk.JdkLogger error 严重: Could not create and/or set value back on to object java.lang.InstantiationException: com.model.GuestInfo at java.lang.Class.newInstance0(Unknown Source) at java.lang.Class.newInstance(Unknown Source) .... 原因:经过分析,是因为在表单提交的时候,action并没有创建表单对应的实例。 因为用人在写表单对应的类时,写了一个带有参数的构造方法,而在action中只是定义了这个类,没有实现。 解决方法:方法1、在表单对应的类中,再建个什么也不做的构造方法,即不带有参数和方法的构造方法。 方法 2、在action中,new出表单对应的类。 本人用第一种方法。 </string></string></string>
分享到:
评论

相关推荐

    FlexGraphics_V_1.79_D4-XE10.2_Downloadly.ir

    - FIX: The TFlexPanel.FindControlAtPoint method maked virtual to realize RealTime-capability when on mouse cursor moving the flex-object search not occurs. - FIX: After deleting the selected points ...

    微软内部资料-SQL性能优化3

    Key range locks are similar to row locks on index keys (whether clustered or not). The locks are placed on individual keys rather than at the node level. The hash value consists of all the key ...

    VclZip pro v3.10.1

    Much faster processing due to linking to Zlib object files for compression and decompression routines. Blocked Zip Files (spanned zip archives split onto hard drive) - Now completely compatible ...

    微软内部资料-SQL性能优化2

    To reserve or commit memory and unintentionally not release it when it is no longer being used. A process can leak resources such as process memory, pool memory, user and GDI objects, handles, threads...

    apktool documentation

    W: Could not decode attr value, using undecoded value instead: ns=android, name=drawable W: Could not decode attr value, using undecoded value instead: ns=android, name=icon Can't find framework ...

    Senfore_DragDrop_v4.1

    * When TDropFileTarget.GetDataOnEnter is set to True, the component doesn't work with WinZip. Although the file names are received correctly by TDropFileTarget, WinZip doesn't extract the files and...

    Java邮件开发Fundamentals of the JavaMail API

    configuring a server to relay messages or to add and remove e-mail accounts. POP POP stands for Post Office Protocol. Currently in version 3, also known as POP3, RFC 1939 defines this protocol. ...

    数位板压力测试

    This specification is intended to be an open standard, and as such the text and information contained herein may be freely used, copied, or distributed without compensation or licensing restrictions. ...

    Sakemail

    Serge Wagener put me to work &gt;:|1.8.4- Dmitry Bondarenko (again) has found a bug in wich I do not respect the RFC, wich say that replys from the SMTP server could be multi-line, and the previous ...

    BobBuilder_app

    I decided against using SortedDictionary for the pages as it was slower than a normal Dictionary and for the purpose of a key value store the sorted-ness was not need and could be handled in other ...

    acpi控制笔记本风扇转速

    ACPI_OPERAND_OBJECT has been manually optimized to be aligned and will not work if it is byte-packed. Example Code and Data Size: These are the sizes for the OS- independent acpica.lib produced by ...

    LCTF软件备份VariSpec™ Liquid Crystal Tunable Filters

    Previous revisions did not range-check the palette index number, and hard crashes could be produced if out-of-range values were supplied to this routine. Previous release 1.33b Release date: ...

    计算机网络第六版答案

    28. Trudy can pretend to be Bob to Alice (and vice-versa) and partially or completely modify the message(s) being sent from Bob to Alice. For example, she can easily change the phrase “Alice, I owe ...

    servlet2.4doc

    A filter is an object that performs filtering tasks on either the request to a resource (a servlet or static content), or on the response from a resource, or both. Filters perform filtering in the ...

    Bochs - The cross platform IA-32 (x86) emulator

    devices (currently only used to set the speed reported by device and to specify an alternative redolog file of USB MSD disk image modes) - hard drive - new disk image mode 'vvfat' - ported the ...

    VB编程资源大全(英文源码 控制)

    and Win32.&lt;END&gt;&lt;br&gt;29 , hdcat.zip This will grab every file on your hard drive and add its path to a listbox.&lt;END&gt;&lt;br&gt;30 , vbo_bump.zip This DLL allows programmers to easily draw 3D grippers ...

    雷达技术知识

    device such as a total station or theodolite in combination with a stadia rod or drop line to measure water surface elevations (Harrelson, et ai., 1994, Western et ai., 1997). Inaccuracies in ...

    EurekaLog_7.5.0.0_Enterprise

    4)....Added "--el_injectjcl", "--el_createjcl", and "--el_createdbg" command-line options for ecc32/emake to inject JEDI/JCL debug info, create .jdbg file, and create .dbg file (Microsoft debug format...

    jQuery完全实例.rar

    Uses both the shortcut for $(document).ready() and the argument to write failsafe jQuery code using the $ alias, without relying on the global alias. jQuery 代码: jQuery(function($) { // Your code ...

    jquery-1.1.3 效率提高800%

    This is a huge addition for those of you who want to use Unicode attribute values, IDs, class names, or tag names. You can now use them directly in jQuery selectors: &lt;br&gt;$("div.台北") $("div#...

Global site tag (gtag.js) - Google Analytics