Spring 整合 Flex (BlazeDS)无法从as对象 到 Java对象转换的异常:org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'java.util.Date' to required type 'java.sql.Timestamp' for property 'wfsj'; nested exception is java.lang.Ill
异常信息如下:
org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'java.util.Date' to required type 'java.sql.Timestamp' for property 'wfsj'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.util.Date] to required type [java.sql.Timestamp] for property 'wfsj': no matching editors or conversion strategy found
at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:463)
at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:494)
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:1097)
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:882)
at org.springframework.flex.core.io.SpringPropertyProxy.setValue(SpringPropertyProxy.java:182)
at flex.messaging.io.amf.Amf3Input.readScriptObject(Amf3Input.java:438)
at flex.messaging.io.amf.Amf3Input.readObjectValue(Amf3Input.java:152)
at flex.messaging.io.amf.Amf3Input.readObject(Amf3Input.java:130)
at flex.messaging.io.amf.Amf3Input.readArray(Amf3Input.java:358)
…………
at flex.messaging.io.amf.AmfMessageDeserializer.readObject(AmfMessageDeserializer.java:227)
at flex.messaging.io.amf.AmfMessageDeserializer.readBody(AmfMessageDeserializer.java:206)
at flex.messaging.io.amf.AmfMessageDeserializer.readMessage(AmfMessageDeserializer.java:126)
at flex.messaging.endpoints.amf.SerializationFilter.invoke(SerializationFilter.java:145)
at flex.messaging.endpoints.BaseHTTPEndpoint.service(BaseHTTPEndpoint.java:291)
at flex.messaging.endpoints.AMFEndpoint$$EnhancerByCGLIB$$6f090fa2.service(<generated>)
at org.springframework.flex.servlet.MessageBrokerHandlerAdapter.handle(MessageBrokerHandlerAdapter.java:109)
…………
Caused by: java.lang.IllegalStateException: Cannot convert value of type [java.util.Date] to required type [java.sql.Timestamp] for property 'wfsj': no matching editors or conversion strategy found
at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:264)
at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:448)
... 59 more
看异常信息大概知道属性wfsj这个字段,不能完成java.util.Date 到 java.sql.Timestamp 日期时间戳的转换。后面还有提示, 没有找到匹配的conversion或editor。
conversion 在Spring中转换对象属性会用到,而editor和converter 以及formatter也是在转换对象(String –> Date, String –> Timestamp),从字符串到对象,从对象到字符串的时候会经常用到。
解决方法:
<bean id="customConfigProcessor" class="com.jp.tic.framework.flex.converter.CustomAmfConversionServiceConfigProcessor"/><flex:message-broker services-config-path="/WEB-INF/flex/services-config.xml"><flex:exception-translator ref="flexExceptionTranslator" /><flex:config-processor ref="configProcessor"/><flex:config-processor ref="customConfigProcessor"/><!--<flex:message-interceptor ref="flexMessageInterceptor" /><flex:message-interceptor ref="loginMessageInterceptor" />--></flex:message-broker>为message-broker对象注入CustomAmfConversionServiceConfigProcessor对象,CustomAmfConversionServiceConfigProcessor是继承AbstractAmfConversionServiceConfigProcessor对象。
AbstractAmfConversionServiceConfigProcessor对象中提供了对各个类型转换serialization/deserialization的方法。
package com.jp.tic.framework.flex.converter;import java.util.HashSet;import java.util.Set;import org.springframework.flex.core.io.AbstractAmfConversionServiceConfigProcessor;/*** <b>function:</b> 自定义AMF转换服务* @author hoojo* @createDate 2013-7-17 下午01:35:12* @file CustomAmfConversionServiceConfigProcessor.java* @package com.jp.tic.framework.flex.converter* @project JTZHJK-Server* @blog http://blog.csdn.net/IBM_hoojo* @email hoojo_@126.com* @version 1.0*/public class CustomAmfConversionServiceConfigProcessor extends AbstractAmfConversionServiceConfigProcessor {private static Set<Class<?>> classes = new HashSet<Class<?>>();@Overrideprotected Set<Class<?>> findTypesToRegister() {return classes;}}
如果你还需要添加更多自己的转化服务,那么你需要给CustomAmfConversionServiceConfigProcessor 注入conversionService对象。
<!-- 添加配置类型转换器、转换服务 --><bean id="conversionService" class="org.springframework.format.support.FormattingConversionServiceFactoryBean"><property name="converters"><list><bean class="com.jp.tic.framework.mvc.convert.StringToTimestampConverter"/><bean class="com.jp.tic.framework.mvc.convert.DateToTimestampConverter"/></list></property><property name="formatters"><list><bean class="com.jp.tic.framework.mvc.formatter.SimpleDateTimeFormatAnnotationFormatterFactory"/><bean class="com.jp.tic.framework.mvc.formatter.TimestampFormatterFactory"/></list></property></bean>
<bean id="customConfigProcessor" class="com.jp.tic.framework.flex.converter.CustomAmfConversionServiceConfigProcessor"><property name="conversionService" ref="conversionService"/></bean>
Spring 整合 Flex (BlazeDS)无法从as对象 到 Java对象转换的异常:org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'java.util.Date' to required type 'java.sql.Timestamp' for property 'wfsj'; nested exception is java.lang.Ill的更多相关文章
- org.springframework.beans.TypeMismatchException: Failed to convert property value of type 'null' to required type 'double' for property 'band'; nested exception is org.springframework.core.convert.Con
本文为博主原创,未经允许不得转载: 先将异常粘贴出来: 20:37:26,909 ERROR [com.suning.fucdn.controller.ProductDataStaticsContro ...
- Spring系列: 使用aop报错:nested exception is java.lang.NoClassDefFoundError: org/aspectj/weaver/reflect/ReflectionWorld$Refle
写了个最简单的aop例子 配置文件如下 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns ...
- Java AOP nested exception is java.lang.NoClassDefFoundError: org/aopalliance/aop/Advice || Error creating bean with name 'org.springframework.aop.aspectj.AspectJPointcutAdvisor#0' 两个异常解决办法
贴出applicationContext.xml <?xml version="1.0" encoding="UTF-8"?> <beans ...
- spring和mybatis整合报错:org.springframework.beans.MethodInvocationException: Property 'dataSource' threw exception; nested exception is java.lang.NoClassDefFoundError
Exception in thread "main" org.springframework.beans.factory.UnsatisfiedDependencyExceptio ...
- nested exception is java.sql.SQLException: Cannot convert value '0000-00-00 00:00:00' from column 14 to TIMESTAMP.
无法将"0000-00-00 00:00:00"转换为TIMESTAMP 2017-05-08 00:56:59 [ERROR] - cn.kee.core.dao.impl.Ge ...
- MyBatis与Spring MVC结合时,使用DAO注入出现:Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required
错误源自使用了这个例子:http://www.yihaomen.com/article/java/336.htm,如果运行时会出现如下错误: Invocation of init method fai ...
- org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; constraint [null]; nested exception is org.hibernate.
今天报了这个异常,这是页面报的 org.springframework.dao.DataIntegrityViolationException: could not execute statement ...
- ?--Porg.springframework.beans.MethodInvocationException: Property 'username' threw exception; nested exception is java.lang.NullPointerException
使用BoneCP作为连接池,在启动Tomcat报出以下异常: 一月 02, 2016 2:12:17 下午 org.apache.tomcat.util.digester.SetPropertiesR ...
- spring整合flex
在常规的开发中只是用flex二不和后台交互是不可能的,为此flex也提供了和后台交互的2种解决方案一种是Data Services另一种是BlazeDs,本篇博客是用的是后一种,我的开发步骤如下: 1 ...
随机推荐
- 学习python之练习(三)
python排序算法 1.冒泡排序: import math def BubbleSort(list): lengthOfList = len(list) for i in range(0,lengt ...
- struts的DevMode模式
在实际应用开发或者是产品部署的时候,对应着两种模式:开发模式(devMode):此时 DevMode=ture: 产品模式(proMode):此时 DevMode=false: 在一些服务器或者框架 ...
- CSS3中:nth-child和:nth-of-type的区别深入理解
关于:nth-child和:nth-of-type的区别之前一直没太注意.最近打算深入了解一些CSS3,才发现里面其实暗藏玄机. :nth-child可以选择父元素下的字元素,:nth-of-type ...
- ansible 2.2的源码编译安装
ansible代码下载地址:http://releases.ansible.com/ansible/ # git clone git://github.com/ansible/ansible.git ...
- The vboxdrv kernel module is not loaded
背景: 在没有关虚拟机的情况下, 直接关了电脑, 我的电脑系统是Centos 6 错误的提示: 在终端执行virtualbox -v 时提示 The vboxdrv kernel module is ...
- Python 1 —— Start Up
作为一种脚本语言,Python号称是万能的胶带语言,可以非常好的作为多种语言之间的粘合剂,因此从多种语言融合的角度看,学习Python是非常有必要的!下面对学习Python当中的一些重点进行记录! 一 ...
- javascript改变样式(cssFloat,styleFloat)
昨天遇到一用js改变元素浮动的,当时直接写了 obj.style.float="left";结果没起作用:查了资料后才发现不能这样写,现在整理下几种样式写法 1,直接写css属性的 ...
- 检查密码复杂度的C#正则表达式
在用户注册与修改.重置密码时,强制密码达到一定的复杂度,是减少盗号的有效措施之一. 而在代码中检查密码复杂度就需要用到正则表达式,比如要求密码必须包含数字.小写或大写字母.特殊字符.字符数在8-30之 ...
- ORACLE修改用户表所属表空间的步骤
ORACLE修改用户表所属表空间的步骤 使用脚本进行修改.据目前所了解,正长情况下需要修改表的空间和表的索引的空间,如果涉及到BOLB字段的表,修改的方式又不一样了!正常情况下的修改脚本:1.修改表的 ...
- 深入理解java虚拟机【Java Class类文件结构】
Java语言从诞生之时就宣称一次编写,到处运行的跨平台特性,其实现原理是源码文件并没有直接编译成机器指令,而是编译成Java虚拟机可以识别和运行的字节码文件(Class类文件,*.class),字节码 ...