2012-11-08 113 views
5

我試圖在Red5上運行一個基本應用程序,它只是試圖連接到red5服務器(在本地主機上)。這個應用程序的來源如下:Red5應用程序無法連接

import org.red5.server.adapter.ApplicationAdapter; 
import org.red5.server.api.IConnection; 
import org.red5.server.api.scope.IScope; 
// import org.red5.server.api.service.ServiceUtils; 

/** 
* Sample application that uses the client manager. 
* 
* @author The Red5 Project ([email protected]) 
*/ 
public class Application extends ApplicationAdapter { 

/** {@inheritDoc} */ 
@Override 
public boolean connect(IConnection conn, IScope scope, Object[] params) { 
    return true; 
} 

/** {@inheritDoc} */ 
@Override 
public void disconnect(IConnection conn, IScope scope) { 
    super.disconnect(conn, scope); 
    } 

} 

我的客戶端代碼也很基本。爲了簡便起見,該片段如下:

public function onCreationComplete(event:FlexEvent) : void { 
      // setup connection code 
      connection = new NetConnection(); 
      connection.connect("rtmp://localhost/Player"); 
      connection.addEventListener(NetStatusEvent.NET_STATUS, onConnectionNetStatus); 
      connection.client = this; 
     } 

public function onConnectionNetStatus(event:NetStatusEvent) : void { 
      // did we successfully connect 
      if(event.info.code == "NetConnection.Connect.Success") { 
       Alert.show("Successful Connection", "Information"); 
      } else { 
       Alert.show("Unsuccessful Connection "+event.info.code, "Information"); 
      } 

注意,我做的警告框顯示的錯誤代碼,這樣我就可以看看會發生什麼。

在客戶端,當我嘗試連接時,我得到兩個失敗消息:

連接不成功值爲NetConnection.Connect.Closed 連接不成功NetConnection.Connect.Rejected

而上服務器端我看到以下內容:

[INFO] [NioProcessor-10] org.red5.server。 net.rtmp.codec.RTMPProtocolDecoder - 動作連接

[INFO] [NioProcessor-10] org.red5.server.net.rtmp.RTMPConnection - 設定對象編碼AMF3

[INFO] [NioProcessor- 10] org.red5.server.net.rtmp.RTMPHandler - 範圍 播放器未在localhost發現

[WARN] [Red5_Scheduler_Worker-3] org.red5.server.net.rtmp.RTMPConnection - 從關閉RTMPMinaConnection 127.0.0.1:50051到localhost(in:3334 out 3256),由於長時間握手而導致id爲9

似乎很清楚由於某種錯誤配置導致某些錯誤。不幸的是,我不知道在哪裏尋找問題。

請問有人可以提供一些有關錯誤的信息,以及我如何解決這個問題?謝謝...

加法:啓動時的異常運行的Red5 V1 RC2時出現:

Exception in thread "Launcher:/Player" org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with 
name 'web.context' defined in ServletContext resource [/WEB-INF/red5-web.xml]: 
Unsatisfied dependency expressed through bean property 'clientRegistry': : Cannot find class [org.red5.server.WebScope] for bean with name 'web.scope' defined in ServletContext resource [/WEB-INF/red5-web.xml]; 
nested exception is java.lang.ClassNotFoundException: org.red5.server.WebScope; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.red5.server.WebScope] for bean with name 'web.scope' defined in ServletContext resource [/WEB-INF/red5-web.xml]; nested exception is java.lang.ClassNotFoundException: org.red5.server.WebScope 
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:1199) 
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1091) 
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517) 
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) 
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294) 
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225) 
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291) 
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) 
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585) 
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913) 
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464) 
at org.red5.server.tomcat.TomcatLoader$1.run(TomcatLoader.java:593) 
Caused by: org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.red5.server.WebScope] for bean with name 'web.scope' defined in ServletContext resource [/WEB-INF/red5-web.xml]; nested exception is java.lang.ClassNotFoundException: org.red5.server.WebScope 
at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1262) 
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:576) 
at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1331) 
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:317) 
at org.springframework.beans.factory.BeanFactoryUtils.beanNamesForTypeIncludingAncestors(BeanFactoryUtils.java:185) 
at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:833) 
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:790) 
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:707) 
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:1184) 
... 11 more 
Caused by: java.lang.ClassNotFoundException: org.red5.server.WebScope 
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680) 
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526) 
at org.springframework.util.ClassUtils.forName(ClassUtils.java:258) 
at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:417) 
at org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass(AbstractBeanFactory.java:1283) 
at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1254) 
... 19 more 

回答

0

什麼版本的Red5的是什麼?
啓動自定義webapp時是否有任何異常?服務器啓動時可能已經存在錯誤,從而導致您的問題。

塞巴斯蒂安

+0

該版本是1.0 RC2。事實證明,在啓動時會產生異常。我不能在這個註釋部分放置完整的異常堆棧,但我會將堆棧跟蹤添加到我原來的問題中。 –

+0

java.lang.ClassNotFoundException:org.red5.server.WebScope錯誤在您的web應用程序中。你似乎定義了一個與org.red5.server.WebScope的關係。這個類在red5-RC2中不存在。也許你從舊的webapp複製你的示例代碼。您可以簡單地查看最新的Demo應用程序,以獲取最新的工作樣本,並開始使用。 –

+1

其實不,我發現這個問題。它不是用我的webapp,它是用red5插件。該插件未更新以反映在RC2中所做的更改。我所有的當前代碼,包括webapp,都是由Red5插件生成的。這是非常基本的代碼;一旦Red5插件生成它,我還沒有任何改變。我只是試圖編譯和運行服務器端代碼並​​使用客戶端代碼進行連接。不幸的是,插件生成的代碼存在錯誤。有一些在RC2中移動的類文件沒有在插件中正確反映出來。更多關於下面的內容。 –

1

另一個事實可能是u有2個Red5.jars所以我只好刪除一個。在我的情況下,它的工作很好。 此職位的大Ty

0

您試圖連接到「Player」的應用程序範圍在服務器上不存在;日誌記錄爲「在本地主機上找不到Scope Player」。這通常意味着你的應用程序沒有加載。它沒有加載的原因看起來像WebScope的類包錯誤。將beans類屬性更改爲org.red5.server.scope.WebScope,然後重試。

1

在red5-web.xml文件中將org.red5.server.WebScope更改爲org.red5.server.scope.WebScope

相關問題