注册 登录
编程论坛 J2EE论坛

关于flex与java集成时出现的莫名奇妙的错误,求解!

huxiangwenhu 发布于 2011-06-21 16:55, 506 次点击
小弟在用flex整合java代码时,遇到如下问题:
相关软件:jdk5.0,myeclipse6.5,flex builder 4 plugin in,tomcat6.0,blazeds
整个过程:
1、安装jdk5.0和myeclipse6.5,tomca6.0,flex builder 4 plugin in以后,在myeclipse6.0目录下建立links目录,建立flex.link文件,内容为:path=C:\\Program Files\\Adobe\Adobe Flash Builder 4
2、在myeclipse6.5下创建web project,项目名:web,然后发布到tomcat上,并启动tomca6.0
3、在flex builder 4下创建flex项目,项目名:web,并给此项目配置web 服务器(tomcat6.0),其中出现过警告:根url与项目上下文最后名字应该相同,搞半天没解决掉,感觉不影响大局,所以跳过去了,完成项目的构建
4、测试flex前端,没问题
5、测试与java的集成:
先在myeclipse下创建类:com.zte.test.Hello,然后在tomcat下webapps\web\WEB-INF\flex目录中找到remoting-config文件,并添加如下标签:
<destination id="helloWorld">
      <properties>
      <!-- 这里要写完整路径:包名 + 类名 -->
      <source>com.zte.test.Hello</source>
      </properties>
      </destination>
      </service>
最后在flex4下web.mxml中添加如下代码:
<fx:Script>
        <![CDATA[
            import mx.rpc.events.FaultEvent;  
            import mx.controls.Alert;  
            import mx.rpc.events.ResultEvent;  
            private function resultHandler(event:ResultEvent):void{  
                Alert.show(event.result.toString(), "成功");  
            }
            private function faultHandler(event:FaultEvent):void{  
                Alert.show(event.fault.toString(), "失败");  
            }  

        ]]>
    </fx:Script>
    <fx:Declarations>
        <mx:RemoteObject id="remoteObject" destination="helloWorld" result="resultHandler(event)" fault="faultHandler(event)"/>
        
    </fx:Declarations>
    <mx:Button label="发送消息" click="remoteObject.sayHello('huang')" x="256.5" y="197"/>  
运行之,得到错误如下:
只有本站会员才能查看附件,请 登录

实在不解,为什么不找不到此类呢?还有,后来还感觉无缘无故出现这个错误,无论如何也解决不了:
只有本站会员才能查看附件,请 登录

求教各位大哥了。
1 回复
#2
huxiangwenhu2011-06-21 16:57
补充:上面的图少了一个:
只有本站会员才能查看附件,请 登录
,呵呵
1