Flex与Java通信HelloWorld出现异常!

异常信息
[RPC Fault faultString="Cannot invoke method 'helloflex'." faultCode="Server.ResourceUnavailable" faultDetail="Method 'helloflex' not found."]

我的MXML代码
<?xml version="1.0" encoding="utf-8"?>

mx:Script
<![CDATA[
import mx.controls.Alert;
import mx.rpc.events.FaultEvent;

import mx.rpc.events.ResultEvent;
import flash.net.registerClassAlias;
import mx.messaging.messages.RemotingMessage;

        [Bindable]
        private var helloResult:String;    
        private function sayHelloTo():void {
            Alert.show("进入sayHelloTo..........");
            var userName:String=txtName.text;
            ro.helloflex(userName);    
        }
        private function resultHandler(event:ResultEvent):void {
            Alert.show("进入resultHandler........");
            helloResult=event.result as String;
            Alert.show(helloResult);
            ggg.text=helloResult
        }
    ]]>
</mx:Script>
<mx:RemoteObject id ="ro" destination="helloflex" result="resultHandler(event)"
    endpoint="http://localhost:8080/flexjoinjava/messagebroker/amf"></mx:RemoteObject>
<mx:Label x="433" y="183" text="名称: "/>
<mx:TextInput x="475" y="181" id="txtName"/>
<mx:Button x="475" y="227" label="提交" id="btnButton" click="sayHelloTo()"/>
<mx:TextArea id="ggg"  x="109" y="122"/>

/mx:Application

remoting-config.xml配置文件
<?xml version="1.0" encoding="UTF-8"?>
class="flex.messaging.services.RemotingService">

<adapters>
    <adapter-definition id="java-object" class="flex.messaging.services.remoting.adapters.JavaAdapter" default="true"/>
</adapters>

<default-channels>
    <channel ref="my-amf"/>
</default-channels>

<destination id="helloflex">
    <properties>
        <source>javacode.HelloFlex</source>
    </properties>
</destination>

javacode.HelloFlex类下面看看有没有helloflex这个方法,flex就是没用找到这个方法才报这错

你应该学会看报错提示,这个比你修改这个错误本身要重要多了。你要学会DEBUG,不能指望别人什么都告诉你。
[RPC
Fault faultString="Cannot invoke method 'helloflex'." faultCode="Server.ResourceUnavailable" faultDetail="Method 'helloflex' not found."]

先看这句faultDetail="Method 'helloflex' not found."
错误的详细情况是“方法 helloflex 找不到”
为什么找不到呢?
faultCode="Server.ResourceUnavailable"
哦,因为资源文件不存在。

这下你明白了吧?什么文件没有配置对呢?还是自己检查下吧,如果你这种态度问你的项目经理,肯定会给他留下不好的印象,切忌,程序员之间是很忌讳问这种问题的,你可以问别人一个大方向,但你不能指望别人,帮你改一堆程序。

楼上的说得很好,程序员是应该这样的