flex与java集成开发(基于eclipse)
?一、開發環境: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.
轉載于:https://www.cnblogs.com/licheng/archive/2009/01/23/1380576.html
總結
以上是生活随笔為你收集整理的flex与java集成开发(基于eclipse)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: [AWS vs Azure] 云计算里A
- 下一篇: 使用C# lock同时访问共享数据