开发者社区> 问答> 正文

flex 异常 StackOverflowError?报错

flex+springMVC+hibernate,从felx页面发起一个请求添加数据后,数据添加成功了,但是报错如下

[Flex]null

java.lang.StackOverflowError
at org.springframework.core.convert.TypeDescriptor.isAssignableTo(TypeDescriptor.java:372)
at org.springframework.core.convert.TypeDescriptor.isAssignableTo(TypeDescriptor.java:374)
at org.springframework.core.convert.TypeDescriptor.isAssignableTo(TypeDescriptor.java:374)

at org.springframework.core.convert.TypeDescriptor.isAssignableTo(TypeDescriptor.java:374)

其它页面的添加可以正常添加

展开
收起
爱吃鱼的程序员 2020-06-14 18:06:32 455 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    看源码:

    类TypeDescriptor的isAssignableTo方法,发现有递归的调用。明显的递归太深导致的栈溢出。

    建议:检查代码防止死递归(类型转换时)。

    回复 @yuan_t:看看下面的源码类型转换时会有递归吗

     看看源码org.springframework.core.convert.TypeDescriptor.isAssignableTo:

    publicbooleanisAssignableTo(TypeDescriptortypeDescriptor){

          booleantypesAssignable=typeDescriptor.getObjectType().isAssignableFrom(getObjectType());
          if(!typesAssignable){
             returnfalse;
          }
          if(isArray()&&typeDescriptor.isArray()){
             returngetElementTypeDescriptor().isAssignableTo(typeDescriptor.getElementTypeDescriptor());
          }
          elseif(isCollection()&&typeDescriptor.isCollection()){
             returnisNestedAssignable(getElementTypeDescriptor(),typeDescriptor.getElementTypeDescriptor());
          }
          elseif(isMap()&&typeDescriptor.isMap()){
             returnisNestedAssignable(getMapKeyTypeDescriptor(),typeDescriptor.getMapKeyTypeDescriptor())&&
                isNestedAssignable(getMapValueTypeDescriptor(),typeDescriptor.getMapValueTypeDescriptor());
          }
          else{
             returntrue;
          }
       }回复 @yuan_t:确定你flex中as类中的类型和java中的类型一致。看还有没有其他方面的不匹配。参考:http://www.cnblogs.com/RocD-DuPeng/articles/1751040.html后台对象保存后把保存的对象返回给flex时,会对这个对象进行解析,生成flex里对应的*.as类,它在解析时出错了?
    2020-06-14 18:06:51
    赞同 展开评论 打赏
问答地址:
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载