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

来源:互联网 发布:雅士尼处理器软件下载 编辑:程序博客网 时间:2024/04/28 01:19

一、开发环境: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下面去掉

20

java:comp/env/wm/messagingworkmanager

-->

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.


======================================================
在最后,我邀请大家参加新浪APP,就是新浪免费送大家的一个空间,支持PHP+MySql,免费二级域名,免费域名绑定 这个是我邀请的地址,您通过这个链接注册即为我的好友,并获赠云豆500个,价值5元哦!短网址是http://t.cn/SXOiLh我创建的小站每天访客已经达到2000+了,每天挂广告赚50+元哦,呵呵,饭钱不愁了,\(^o^)/
原创粉丝点击