问题描述
项目是用的flex3+Spring3+hibernate3.6+blazeds,全用注解写的,在同一页面发送两次后台请求,总是报[RPC Fault faultString="java.lang.StackOverflowError : null" faultCode="Server.Processing" faultDetail="null"]错误,代码如下:<?xml version="1.0" encoding="utf-8"?><SuperPanel xmlns="net.brandonmeyer.containers.*" width="776" height="516" xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" allowClose="true" title="部门管理区" allowDrag="true" allowMaximize="true" allowMinimize="true" resizeEffect="Resize" moveEffect="Move" horizontalScrollPolicy="off" verticalScrollPolicy="off" [color=red]creationComplete="getAllDepartment()"[/color]> <mx:AMFChannel id="myamf" url="http://localhost:8080/MyFlexOA/messagebroker/amf"/><mx:ChannelSet id="channelSet" channels="{[myamf]}"/><mx:RemoteObject id="departmentService" destination="departmentService" channelSet="{channelSet}"/><mx:RemoteObject id="departmentServiceDel" destination="departmentService" channelSet="{channelSet}" /><mx:Script><![CDATA[import mx.rpc.AsyncToken;import mx.events.ListEvent;import mx.events.ItemClickEvent;import cn.edu.hyit.oa.event.DepartmentEvent;import mx.events.CloseEvent;import components.AddDepartment;import mx.rpc.events.ResultEvent;import mx.collections.ArrayCollection;import cn.edu.hyit.oa.vo.DepartmentVo;import mx.controls.Alert;import mx.managers.PopUpManager;import flash.events.ContextMenuEvent;[Bindable]public var departmentList:ArrayCollection;private var addDepartmentView:AddDepartment;private function getAllDepartment():void {var menuItem:ContextMenuItem = new ContextMenuItem("删除");var menuItem2:ContextMenuItem = new ContextMenuItem("保存更新");menuItem.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT,deleteHandler);//menuItem2.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT,updateHandler);var menu:ContextMenu = new ContextMenu();menu.hideBuiltInItems();menu.customItems.push(menuItem);menu.customItems.push(menuItem2);this.contextMenu = menu;[color=red]departmentService.addEventListener(ResultEvent.RESULT, resultHandler);departmentService.loadAllDepartments();[/color]}private function deleteHandler(e:ContextMenuEvent):void{[color=red]departmentServiceDel.addEventListener(ResultEvent.RESULT, delResultHandler);var d:DepartmentVo = de.selectedItem as DepartmentVo;departmentServiceDel.delDep(d);[/color]}private function resultHandler(e:ResultEvent):void {departmentList = e.result as ArrayCollection;}private function delResultHandler(e:ResultEvent):void {departmentList.removeItemAt(de.selectedIndex);} 问题补充:suziwen 写道
解决方案
既然你都已经获得了result了 你可以绑定一个数据源 把result赋给那个数据源 数据源发生了变化 页面上的内容 会自动变化的 有很多方式可以显示result的值 关键是只要你获得了页面控件的引用后 你就可以为所欲为
解决方案二:
我flex的经验也不多 以后多多交流
解决方案三:
callLaterDispatcher方法的代码呢? 看一下
解决方案四:
调试,跟踪是什么原因导致死偱环是否是某个变量值被意外改变导致代码没法跳出偱环等
解决方案五:
这样啊 如果是一个RO对象 请求两次 flex是无法辨别返回结果的 需要使用 异步调用令牌 AsyncToken 对象 来唯一的 绑定请求 AsyncToken对象的使用方法可以看那一下api我这里有一个 AsyncToken对象的小例子 你可以参考一下是调用一个天气的WebServicepackage services.weatherwebservice{import flash.events.Event;import mx.controls.Alert;import mx.rpc.AsyncToken;import scripts.MyResp;public class WeatherWebService extends _Super_WeatherWebService{public function WeatherWebService(){var myRep:MyResp = new MyResp();var token:AsyncToken = this.getWeatherbyCityName("石家庄");token.addResponder(myRep);//myRep必须是一个IResponse类型的对象 来接受返回的结果} }}package scripts{import mx.controls.Alert;import mx.rpc.IResponder;public class MyResp implements IResponder{public function MyResp(){}public function result(data:Object):void{data.Result是返回的结果}public function fault(info:Object):void{Alert.show("Error");}}}
解决方案六:
估计出现死偱环导致内存溢出了
解决方案七:
是内存溢出了嘛 把应用服务器的内存调大一点试试