gpt4 book ai didi

Red5 应用程序连接失败

转载 作者:行者123 更新时间:2023-12-03 17:33:00 24 4
gpt4 key购买 nike

我正在尝试在 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 (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");
}

请注意,我让警告框显示错误代码,以便我可以看到会发生什么。

在客户端,当我尝试连接时,我收到两条失败消息:

Unsuccessful Connection NetConnection.Connect.Closed Unsuccessful Connection NetConnection.Connect.Rejected



在服务器端,我看到以下内容:

[INFO] [NioProcessor-10] org.red5.server.net.rtmp.codec.RTMPProtocolDecoder - Action connect

[INFO] [NioProcessor-10] org.red5.server.net.rtmp.RTMPConnection - Setting object encoding to AMF3

[INFO] [NioProcessor-10] org.red5.server.net.rtmp.RTMPHandler - Scope Player not found on localhost

[WARN] [Red5_Scheduler_Worker-3] org.red5.server.net.rtmp.RTMPConnection - Closing RTMPMinaConnection from 127.0.0.1 : 50051 to localhost (in: 3334 out 3256 ), with id 9 due to long handshake



很明显,由于某种错误配置,出现了问题。不幸的是,我不知道去哪里寻找问题。

有人可以告诉我出了什么问题以及我如何解决这个问题吗?谢谢...

ADDITION: 运行 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

最佳答案

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

关于Red5 应用程序连接失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13296058/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com