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 ...
 
随机推荐
- Vmware虚拟机克隆的网卡问题
			
系统环境:red hat 6.4 在虚拟机上使用克隆后,克隆机没有eth0, 出现eth1并且出错No suitable device found: no device found for conne ...
 - Python学习第八天(os)
			
os主要是实现文件夹的创建和管理功能 os.mkdir(path) 创建目录 os.chdir(path)改变当前工作目录 os.fchdir() 通过文件描述符改变工作目录 os.chroot() ...
 - 下载android 源码
			
http://source.android.com/source/downloading.html 1.下载repo 官网:curl http://commondatastorage.googleap ...
 - 自己写ORM框架 SqlHelper_DG C#(java的写在链接里)
			
ORM框架想必大家都比较熟知了,即对象关系映射(英语:Object Relation Mapping,简称ORM,或O/RM,或O/R mapping),是一种程序技术,用于实现面向对象编程语言里不同 ...
 - Android Studio项目结构
			
我们创建了一个Android Project,打开就如下图所示: 我们选择Project视图,就会有以下的项目文档结构: 上面笔者标注的数字是接下来要讲解的内容. 我们先来看1: 我们创建Appl ...
 - Java里的if else语句例子
			
import java.util.Scanner;public class if_else2{ public static void main(String[] args) { Scanner s=n ...
 - struts2中的constant配置详解
			
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE struts PUBLIC "-/ ...
 - [2011山东ACM省赛] Sequence (动态规划)
			
Sequence Time Limit: 1000ms Memory limit: 65536K 有疑问?点这里^_^ 题目描述 Given an integer number sequence ...
 - Mono for android真难用
			
最近要写个Android小项目,真的很少,几个按钮发送tcp或udp而已. 作为.net程序员当前是c#当先,Mono for android真是好,直接用c#一切都是那么熟悉,但发布时问题来了,需几 ...
 - 动态时间归整/规整/弯曲(Dynamic time warping,DTW)
			
动态时间规整DTW 在日常的生活中我们最经常使用的距离毫无疑问应该是欧式距离,但是对于一些特殊情况,欧氏距离存在着其很明显的缺陷,比如说时间序列,举个比较简单的例子,序列A:1,1,1,10,2, ...