flexmojos + blazeDS : destination has no channels defined 异常


  问题重现:
  在使用 maven flexmojos plugin 开发 felx项目过程中,执行 flexmojos:compile-swf  + flexmojos:wrapper 后运行页面,尝试与后台交互,遇到如下异常信息:
  [RPC Fault faultString="[MessagingError message='Destination 'yourRemoteService' either does not exist or the destination has no channels defined (and the application does not define any default channels.)']" faultCode="InvokeFailed" faultDetail="Couldn't establish a connection to yourRemoteService'"]
  问题原因:
  需要在 flex 项目 pom.xml 中,正确配置如下参数:
  1) 
  访问远程 server 的 URL
  2) 
  上下文路径
  3) 
  BlazeDS 的 services-config.xml 文件位置
  贴出完整 pom.xml:  4.0.0  ria-flexClient ria 1.0-SNAPSHOT  ria client-portal 1.0-SNAPSHOT swf client-portal Flex  flex SDK-->  com.adobe.flex.framework flex-framework ${flex.framework.version} pom    com.adobe.flexunit flexunit ${flexunit.version} swc test    com.adobe.flex cairngorm ${flex.framework.cairngorm.version} swc    src/main/flex src/test/flex    org.sonatype.flexmojos flexmojos-maven-plugin ${flexmojos-maven-plugin.version} true   com.adobe.flex compiler ${flexmojos-maven-plugin.compiler.version} pom     true  ${flex.targetPlayer.version}   flex -->  ${build.sourceDirectory}   Portal.mxml  Portal  false   en_US   true  false  true  true  false  http://localhost:8888/  /  ${flex.services.path}  ${client.deploy.path}\${project.build.finalN ame}.swf  ${client.deploy.path}  target/classes/configs/flex-config.xm l-->       这三个参数与 FlashBuilder4 下,通过 J2EE Server(BlazeDS)配置的参数是一致的,贴图如下:
  
  简单说就是:同样的参数,配置的地方不同。flexmojos 在 pom.xml,而 flashBuilder4 是在 Flex Server 选项卡。
  另外:
  1)发布 swf 时,推荐使用 flexmojos  optimize:true + debug:false,一般可使编译后的swf文件减肥到原来大小的 40%~50%,意味着加载和打开的速度更快。
  2)推荐在命令行下执行 mvn 指令,如果在 IDE 环境下运行 mvn 指令出现 compile 失败,可能是默认JRE 是 java sdk,手动更正下就行。

猜你喜欢

转载自hgfghwq14.iteye.com/blog/1572361