5

我正在尝试在 Red5 上运行一个基本应用程序,它只是尝试连接到 red5 服务器(在 localhost 上)。此应用程序的来源如下:

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 (red5@osflash.org)
*/
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 - 在本地主机上找不到范围播放器

[警告] [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
4

4 回答 4

1

在您的 red5-web.xml 文件中更改org.red5.server.WebScope为。org.red5.server.scope.WebScope

于 2014-10-03T20:31:02.663 回答
1

另一个事实可能是你有 2 个 Red5.jar,所以你必须删除一个。就我而言,它工作得很好。这篇文章的大泰

于 2013-10-01T11:28:20.043 回答
0

那是什么版本的red5?
启动自定义 Web 应用程序时是否有任何例外?服务器启动时可能已经存在错误,从而导致您的问题。

塞巴斯蒂安

于 2012-11-13T13:49:59.600 回答
0

您尝试连接到“播放器”的应用程序范围在服务器上不存在;日志将此记录为“在本地主机上找不到范围播放器”。这通常意味着您的应用程序没有加载。它没有加载的原因看起来像 WebScope 的类包错误。将 beans 类属性更改为 org.red5.server.scope.WebScope 并重试。

于 2014-02-28T01:42:31.337 回答