首先,下載red5安裝軟件,我用的是setup-Red5-0.8.0-RC2.exe和tomcat6.0,將其安裝下硬盤的指定目錄下,例如:D:\Red5、D:\tomcat6.0;
然后,在eclipse下新建一個web project工程項目;命名為“red5ToTomcat”。
將D:\Red5\lib目錄下的所有jar包,還有D:\Red5根目錄下的red5.jar,全部copy到red5ToTomcat工程項目WebRoot\lib包下。這些就是red5集成到tocat啟動所需要的全部jar包。
接下來,我們看需要配置的文件。在安裝D:\Red5的根目錄下面有個src.zip文件,這里面放的是red5的源代碼,將其在當前目錄下解壓,然后進入D:\Red5\src\src\conf\war目錄,該目錄下就是我們所需要的全部配置文件。

1、先把該目錄下的web.xml文件copy到red5ToTomcat\WebRoot\WEB-INF目錄,替換原來項目的web.xml文件。
2、然后把該目錄下的其他文件全部copy到red5ToTomcat\src目錄下。這樣red5集成tomcat所需要全部配置文件就弄好了,當然,這其中可能會有些文件不需要,大家如果有興趣可以自行測試一下。
其中beanRefContext.xml、defaultContext.xml、red5-common.xml、red5-core.xml文件是必須要有的。
3、這時候部署red5ToTomcat項目到tomcat下,運行可能會有錯誤,我們還要對這些配置文件進行稍做修改。首先是要刪除red5-common.xml文件下的部分代碼:
1

<!-- JMX server -->
2

<bean id="jmxFactory" class="org.red5.server.jmx.JMXFactory">
3

<property name="domain" value="org.red5.server"/>
4

</bean>
5

<bean id="jmxAgent" class="org.red5.server.jmx.JMXAgent" init-method="init">
6

<!-- The RMI adapter allows remote connections to the MBeanServer -->
7

<property name="enableRmiAdapter" value="false" />
8

<property name="rmiAdapterPort" value="9999"/>
9

<!-- SSL
10

To use jmx with ssl you must also supply the location of the keystore and its password
11

when starting the server with the following JVM options:
12

-Djavax.net.ssl.keyStore=keystore
13

-Djavax.net.ssl.keyStorePassword=password
14

-->
15

<property name="enableSsl" value="false"/>
16

<!-- Starts a registry if it doesnt exist -->
17

<property name="startRegistry" value="true" />
18

<!-- Authentication -->
19

<property name="remoteAccessProperties" value=""/>
20

<property name="remotePasswordProperties" value=""/>
21

<!-- The HTML adapter allows connections to the MBeanServer via a web browser -->
22

<property name="enableHtmlAdapter" value="false" />
23

<property name="htmlAdapterPort" value="8082"/>
24

<!-- Mina offers its own Mbeans so you may integrate them here -->
25

<property name="enableMinaMonitor" value="true" />
26

</bean>
把上面的這段代碼刪除。
然后是把red5-core.xml文件下的"@"符號全部用"${}"符號替換,另外還要引入red5.properties,代碼如下:
1

<!-- red5.properties -->
2

<bean id="placeholderConfig"
3

class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
4

<property name="location" value="red5.properties" />
5

</bean>
這樣配完之后,red5集成到tomcat下啟動就算成功了。使用起來,跟普通的web項目沒有什么區別!
posted on 2009-07-07 14:49
kenzhang 閱讀(4948)
評論(5) 編輯 收藏