flex与java集成开发(基于eclipse)

xiaoxiao2026-04-11  5

一、开发环境:eclipse3.3+myeclipse6+FB3_WWEJ_Plugin(eclipse的flex插件)+lcds(LiveCycle Data Service)+tomcat6 二、项目流程: 1、新建FlexLCDS工程 a、弹出Create a Flex Project 窗口。 Project name:输入 test 。 Project location:默认配置。 Server Technology:Sever Application Type 选择 j2ee , 选中 Use remote object access service ,并选择 LiveCycle Data Services 。注意选中 Create combined Java/Flex project using WTP,把我们的JAVA项目和FLEX整合一起开发。 b、Configure J2EE Server 窗口: 需要注意的是 Output folder 需要设置为 WebRoot,以便我们可以利用MYECLIPSE的自动发布功能,省去了不少事情。 J2EE setting 下的 target runtime 我们可以新建个 tomcat应用。 其他的默认配置。 c、窗口 Create a Flex Project 可以默认配置 说明:Main source folder 是flex的源码存放根目录, Output folder URL 是在开发过程中运行和调试的请求路径,这个与发布无关,不会影响任何你在程序中使用的路径,但是能使开发方便 注意:FlexBuilder3这里存在bug,新建工程时,部分自定义的属性并没有保存下来,而必须在新建后的项目属性中更改。 2、用MyEclipse添加Web容器 项目中 点击右键 选中 MYECLIPSE 下的 Add Web Project capabilities ,弹出的 窗口中 ,记住不要勾选Create web.xml 。这样你就可以在MYECLIPSE中发布。 3、项目属性配置 点击test 项目的Properties ,需要完成下面几个配置。 Flex Server配置: Root Url属性: http://localhost:8080/test 改为:http://localhost:8080 Context Root 属性:/WebRoot 改为/test 。 设置完成后 别忘了 Valicate Location 检测下。 说明: Root url 当然就是你的web服务器的根路径了,Tomcat默认是8080端口,如果改了就自己修改 Context root 就是LCDS工程的名称(注意:如果你分开为两个工程,则这里指的是你J2ee项目的名称,而不是你Flex项目的名称,因为你在请求Java的数据服 务),在Flex请求LCDS时,会采用这个作为参数http://{server.name}:{server.port} /{context.root}/messagebroker/amf 如果Context root错了,那么永远不可能正确的请求LCDS的服务了。 三、发布调试。 1、要在MYECLIPSE下部署 Test 项目。 2、在项目中 找到 test.mxml ,点右键,"Run as"--"Flex Application" 。如果看到了 http://localhost:8080/test/test.html 页面则部署成功。 我们也可以调试程序。选择 "Debug as"--"Flex Application" http://localhost:8080/test/test.html?debug=true 注意: 1、如果出现:Exception in thread "RTMP-Server" flex.messaging.endpoints.rtmp.RTMPException: The RTMP server has encountered a fatal exception starting up: Address already in use: bind 。 需要在 /test/WebRoot/WEB-INF/flex/services-config.xml 下面去掉 <channel-definition id="my-rtmp" class="mx.messaging.channels.RTMPChannel"> <endpoint url="rtmp://{server.name}:2038" class="flex.messaging.endpoints.RTMPEndpoint"/> <properties> <idle-timeout-minutes>20</idle-timeout-minutes> <!-- for deployment on WebSphere, must be mapped to a WorkManager available in the web application's jndi context. <websphere-workmanager-jndi-name>java:comp/env/wm/MessagingWorkManager</websphere- workmanager-jndi-name> --> </properties> </channel-definition> 2、如果有出现下面错误:如果出现:org.apache.catalina.util.DefaultAnnotationProcessor cannot be cast to org.apache.AnnotationProces 可以在 JAVA Build Path Libralies 下的 tomcat6 lib去掉。 3、注意你要下载最新版本的 flashplayer debug 版本。否则会出现: Failed to connect; session timed out.Ensure that: 1. You compiled your Flash application with debugging on. 2. You are running the debugger version of Flash Player. 相关资源:Flex+blazeds+java企业门户网站完整源码
转载请注明原文地址: https://www.6miu.com/read-5047165.html

最新回复(0)