Red5 基本网络应用未连接 NetConnection.connect.failed
Red5 basic webapp not connectiong NetConnection.connect.failed
我是 Red5 的新手。我决定构建我的第一个应用程序并前往 https://github.com/Red5 下载必要的软件。到目前为止,我已经安装了 jre 8、jdk 1.8、Maven、flex SDK 4.6 和 Red5 1.0.5。我还安装了 eclipse 插件。我在 Application.java 中收到一条错误消息,说应用程序类型的层次结构不一致,其他消息抱怨无法解析 org.red5.server.api.Iconnect 和
组织red5.server.api.scope.IScope。我可以通过从构建路径中删除 red5.server.jar 然后将其添加回来来清除这些错误。但是我必须使用 org.red5.server.api.IScope 而不是 ...api.scope.IScope 才能工作。在这一点上我想我没有权利red5.jar。我不是使用flash builder来编译客户端而是使用flex自带的mxmlc.exe。我得到 swf 文件,然后我 运行 它但它不会连接 (NetConnection.connect.failed)。我正在 运行 使用 Eclipse Mars 在本地使用它。
服务器
package org.red5.core;
import org.red5.logging.Red5LoggerFactory;
import org.red5.server.adapter.MultiThreadedApplicationAdapter;
import org.red5.server.api.IConnection;
import org.red5.server.api.IScope;
//import org.slf4j.Logger;
/**
* Sample application that uses the client manager.
*
* @author The Red5 Project (red5@osflash.org)
*/
public class Application extends MultiThreadedApplicationAdapter {
//private static Logger log = Red5LoggerFactory.getLogger(Application.class);
/** {@inheritDoc} */
@Override
public boolean connect(IConnection conn, IScope scope, Object[] params) {
//log.info("appConnect");
return true;
}
/** {@inheritDoc} */
@Override
public void disconnect(IConnection conn, IScope scope) {
//log.info("disconnect");
super.disconnect(conn, scope);
}
}
客户
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute"
creationComplete="onCreationComplete(event)">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.events.FlexEvent;
private var connection:NetConnection;
public function onCreationComplete(event:FlexEvent) : void {
// setup connection code
connection = new NetConnection();
connection.connect("rtmp://localhost/Project");
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);
}
}
]]>
</mx:Script>
</mx:Application>
当 运行宁 client.swf
[ERROR] [RTMPConnectionExecutor#OXEXJYYHVOTE2-1] org.red5.server.net.rtmp.BaseRTMPHandler - Exception
java.lang.NoClassDefFoundError: org/red5/server/api/IScope
at java.lang.Class.getDeclaredMethods0(Native Method) ~[na:1.8.0_45]
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) ~[na:1.8.0_45]
at java.lang.Class.privateGetMethodRecursive(Class.java:3048) ~[na:1.8.0_45]
at java.lang.Class.getMethod0(Class.java:3018) ~[na:1.8.0_45]
at java.lang.Class.getMethod(Class.java:1784) ~[na:1.8.0_45]
at org.red5.logging.Red5LoggerFactory.getLogger(Red5LoggerFactory.java:56) ~[red5-server-common-1.0.5-RELEASE.jar:1.0.5-RELEASE]
at org.red5.server.adapter.MultiThreadedApplicationAdapter.connect(MultiThreadedApplicationAdapter.java:297) ~[red5-server.jar:1.0.5-RELEASE]
at org.red5.server.scope.Scope.connect(Scope.java:255) ~[red5-server-common-1.0.5-RELEASE.jar:na]
at org.red5.server.BaseConnection.connect(BaseConnection.java:354) ~[red5-server-common-1.0.5-RELEASE.jar:na]
at org.red5.server.net.rtmp.RTMPConnection.connect(RTMPConnection.java:398) ~[red5-server-common-1.0.5-RELEASE.jar:1.0.5-RELEASE]
at org.red5.server.net.rtmp.RTMPMinaConnection.connect(RTMPMinaConnection.java:87) ~[red5-server-common-1.0.5-RELEASE.jar:1.0.5-RELEASE]
at org.red5.server.net.rtmp.RTMPHandler.onCommand(RTMPHandler.java:347) ~[red5-server-common-1.0.5-RELEASE.jar:1.0.5-RELEASE]
at org.red5.server.net.rtmp.BaseRTMPHandler.messageReceived(BaseRTMPHandler.java:105) ~[red5-server-common-1.0.5-RELEASE.jar:1.0.5-RELEASE]
at org.red5.server.net.rtmp.ReceivedMessageTask.call(ReceivedMessageTask.java:57) [red5-server-common-1.0.5-RELEASE.jar:1.0.5-RELEASE]
at org.red5.server.net.rtmp.ReceivedMessageTask.call(ReceivedMessageTask.java:11) [red5-server-common-1.0.5-RELEASE.jar:1.0.5-RELEASE]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_45]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_45]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_45]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_45]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_45]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_45]
Caused by: java.lang.ClassNotFoundException: org.red5.server.api.IScope
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1720) ~[tomcat-embed-core.jar:7.0.57]
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571) ~[tomcat-embed-core.jar:7.0.57]
... 21 common frames omitted
[ERROR] [RTMPConnectionExecutor#DZX5W02SUWV7J-1] org.red5.server.net.rtmp.BaseRTMPHandler - Exception
java.lang.NoClassDefFoundError: org/red5/server/api/IScope
at java.lang.Class.getDeclaredMethods0(Native Method) ~[na:1.8.0_45]
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) ~[na:1.8.0_45]
at java.lang.Class.privateGetMethodRecursive(Class.java:3048) ~[na:1.8.0_45]
at java.lang.Class.getMethod0(Class.java:3018) ~[na:1.8.0_45]
at java.lang.Class.getMethod(Class.java:1784) ~[na:1.8.0_45]
at org.red5.logging.Red5LoggerFactory.getLogger(Red5LoggerFactory.java:56) ~[red5-server-common-1.0.5-RELEASE.jar:1.0.5-RELEASE]
at org.red5.server.adapter.MultiThreadedApplicationAdapter.connect(MultiThreadedApplicationAdapter.java:297) ~[red5-server.jar:1.0.5-RELEASE]
at org.red5.server.scope.Scope.connect(Scope.java:255) ~[red5-server-common-1.0.5-RELEASE.jar:na]
at org.red5.server.BaseConnection.connect(BaseConnection.java:354) ~[red5-server-common-1.0.5-RELEASE.jar:na]
at org.red5.server.net.rtmp.RTMPConnection.connect(RTMPConnection.java:398) ~[red5-server-common-1.0.5-RELEASE.jar:1.0.5-RELEASE]
at org.red5.server.net.rtmp.RTMPMinaConnection.connect(RTMPMinaConnection.java:87) ~[red5-server-common-1.0.5-RELEASE.jar:1.0.5-RELEASE]
at org.red5.server.net.rtmp.RTMPHandler.onCommand(RTMPHandler.java:347) ~[red5-server-common-1.0.5-RELEASE.jar:1.0.5-RELEASE]
at org.red5.server.net.rtmp.BaseRTMPHandler.messageReceived(BaseRTMPHandler.java:105) ~[red5-server-common-1.0.5-RELEASE.jar:1.0.5-RELEASE]
at org.red5.server.net.rtmp.ReceivedMessageTask.call(ReceivedMessageTask.java:57) [red5-server-common-1.0.5-RELEASE.jar:1.0.5-RELEASE]
at org.red5.server.net.rtmp.ReceivedMessageTask.call(ReceivedMessageTask.java:11) [red5-server-common-1.0.5-RELEASE.jar:1.0.5-RELEASE]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_45]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_45]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_45]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_45]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_45]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_45]
Caused by: java.lang.ClassNotFoundException: org.red5.server.api.IScope
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1720) ~[tomcat-embed-core.jar:7.0.57]
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571) ~[tomcat-embed-core.jar:7.0.57]
... 21 common frames omitted
[WARN] [ConnectionChecker-1] org.red5.server.net.rtmp.RTMPConnManager - Connection OXEXJYYHVOTE2 has exceeded the max inactivity threshold
[WARN] [ConnectionChecker-1] org.red5.server.net.rtmp.RTMPConnManager - Connection not found for OXEXJYYHVOTE2
red5 以后的版本需要scope 包。您似乎正在使用旧版本 red5.jar 编译您的应用程序,然后将新版本 1.0.5 部署到服务器 运行。使用 1.0.5 red5.jar 构建和编译,您的问题将得到解决。
我是 Red5 的新手。我决定构建我的第一个应用程序并前往 https://github.com/Red5 下载必要的软件。到目前为止,我已经安装了 jre 8、jdk 1.8、Maven、flex SDK 4.6 和 Red5 1.0.5。我还安装了 eclipse 插件。我在 Application.java 中收到一条错误消息,说应用程序类型的层次结构不一致,其他消息抱怨无法解析 org.red5.server.api.Iconnect 和 组织red5.server.api.scope.IScope。我可以通过从构建路径中删除 red5.server.jar 然后将其添加回来来清除这些错误。但是我必须使用 org.red5.server.api.IScope 而不是 ...api.scope.IScope 才能工作。在这一点上我想我没有权利red5.jar。我不是使用flash builder来编译客户端而是使用flex自带的mxmlc.exe。我得到 swf 文件,然后我 运行 它但它不会连接 (NetConnection.connect.failed)。我正在 运行 使用 Eclipse Mars 在本地使用它。
服务器
package org.red5.core;
import org.red5.logging.Red5LoggerFactory;
import org.red5.server.adapter.MultiThreadedApplicationAdapter;
import org.red5.server.api.IConnection;
import org.red5.server.api.IScope;
//import org.slf4j.Logger;
/**
* Sample application that uses the client manager.
*
* @author The Red5 Project (red5@osflash.org)
*/
public class Application extends MultiThreadedApplicationAdapter {
//private static Logger log = Red5LoggerFactory.getLogger(Application.class);
/** {@inheritDoc} */
@Override
public boolean connect(IConnection conn, IScope scope, Object[] params) {
//log.info("appConnect");
return true;
}
/** {@inheritDoc} */
@Override
public void disconnect(IConnection conn, IScope scope) {
//log.info("disconnect");
super.disconnect(conn, scope);
}
}
客户
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute"
creationComplete="onCreationComplete(event)">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.events.FlexEvent;
private var connection:NetConnection;
public function onCreationComplete(event:FlexEvent) : void {
// setup connection code
connection = new NetConnection();
connection.connect("rtmp://localhost/Project");
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);
}
}
]]>
</mx:Script>
</mx:Application>
当 运行宁 client.swf
[ERROR] [RTMPConnectionExecutor#OXEXJYYHVOTE2-1] org.red5.server.net.rtmp.BaseRTMPHandler - Exception
java.lang.NoClassDefFoundError: org/red5/server/api/IScope
at java.lang.Class.getDeclaredMethods0(Native Method) ~[na:1.8.0_45]
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) ~[na:1.8.0_45]
at java.lang.Class.privateGetMethodRecursive(Class.java:3048) ~[na:1.8.0_45]
at java.lang.Class.getMethod0(Class.java:3018) ~[na:1.8.0_45]
at java.lang.Class.getMethod(Class.java:1784) ~[na:1.8.0_45]
at org.red5.logging.Red5LoggerFactory.getLogger(Red5LoggerFactory.java:56) ~[red5-server-common-1.0.5-RELEASE.jar:1.0.5-RELEASE]
at org.red5.server.adapter.MultiThreadedApplicationAdapter.connect(MultiThreadedApplicationAdapter.java:297) ~[red5-server.jar:1.0.5-RELEASE]
at org.red5.server.scope.Scope.connect(Scope.java:255) ~[red5-server-common-1.0.5-RELEASE.jar:na]
at org.red5.server.BaseConnection.connect(BaseConnection.java:354) ~[red5-server-common-1.0.5-RELEASE.jar:na]
at org.red5.server.net.rtmp.RTMPConnection.connect(RTMPConnection.java:398) ~[red5-server-common-1.0.5-RELEASE.jar:1.0.5-RELEASE]
at org.red5.server.net.rtmp.RTMPMinaConnection.connect(RTMPMinaConnection.java:87) ~[red5-server-common-1.0.5-RELEASE.jar:1.0.5-RELEASE]
at org.red5.server.net.rtmp.RTMPHandler.onCommand(RTMPHandler.java:347) ~[red5-server-common-1.0.5-RELEASE.jar:1.0.5-RELEASE]
at org.red5.server.net.rtmp.BaseRTMPHandler.messageReceived(BaseRTMPHandler.java:105) ~[red5-server-common-1.0.5-RELEASE.jar:1.0.5-RELEASE]
at org.red5.server.net.rtmp.ReceivedMessageTask.call(ReceivedMessageTask.java:57) [red5-server-common-1.0.5-RELEASE.jar:1.0.5-RELEASE]
at org.red5.server.net.rtmp.ReceivedMessageTask.call(ReceivedMessageTask.java:11) [red5-server-common-1.0.5-RELEASE.jar:1.0.5-RELEASE]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_45]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_45]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_45]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_45]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_45]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_45]
Caused by: java.lang.ClassNotFoundException: org.red5.server.api.IScope
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1720) ~[tomcat-embed-core.jar:7.0.57]
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571) ~[tomcat-embed-core.jar:7.0.57]
... 21 common frames omitted
[ERROR] [RTMPConnectionExecutor#DZX5W02SUWV7J-1] org.red5.server.net.rtmp.BaseRTMPHandler - Exception
java.lang.NoClassDefFoundError: org/red5/server/api/IScope
at java.lang.Class.getDeclaredMethods0(Native Method) ~[na:1.8.0_45]
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) ~[na:1.8.0_45]
at java.lang.Class.privateGetMethodRecursive(Class.java:3048) ~[na:1.8.0_45]
at java.lang.Class.getMethod0(Class.java:3018) ~[na:1.8.0_45]
at java.lang.Class.getMethod(Class.java:1784) ~[na:1.8.0_45]
at org.red5.logging.Red5LoggerFactory.getLogger(Red5LoggerFactory.java:56) ~[red5-server-common-1.0.5-RELEASE.jar:1.0.5-RELEASE]
at org.red5.server.adapter.MultiThreadedApplicationAdapter.connect(MultiThreadedApplicationAdapter.java:297) ~[red5-server.jar:1.0.5-RELEASE]
at org.red5.server.scope.Scope.connect(Scope.java:255) ~[red5-server-common-1.0.5-RELEASE.jar:na]
at org.red5.server.BaseConnection.connect(BaseConnection.java:354) ~[red5-server-common-1.0.5-RELEASE.jar:na]
at org.red5.server.net.rtmp.RTMPConnection.connect(RTMPConnection.java:398) ~[red5-server-common-1.0.5-RELEASE.jar:1.0.5-RELEASE]
at org.red5.server.net.rtmp.RTMPMinaConnection.connect(RTMPMinaConnection.java:87) ~[red5-server-common-1.0.5-RELEASE.jar:1.0.5-RELEASE]
at org.red5.server.net.rtmp.RTMPHandler.onCommand(RTMPHandler.java:347) ~[red5-server-common-1.0.5-RELEASE.jar:1.0.5-RELEASE]
at org.red5.server.net.rtmp.BaseRTMPHandler.messageReceived(BaseRTMPHandler.java:105) ~[red5-server-common-1.0.5-RELEASE.jar:1.0.5-RELEASE]
at org.red5.server.net.rtmp.ReceivedMessageTask.call(ReceivedMessageTask.java:57) [red5-server-common-1.0.5-RELEASE.jar:1.0.5-RELEASE]
at org.red5.server.net.rtmp.ReceivedMessageTask.call(ReceivedMessageTask.java:11) [red5-server-common-1.0.5-RELEASE.jar:1.0.5-RELEASE]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_45]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_45]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_45]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_45]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_45]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_45]
Caused by: java.lang.ClassNotFoundException: org.red5.server.api.IScope
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1720) ~[tomcat-embed-core.jar:7.0.57]
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571) ~[tomcat-embed-core.jar:7.0.57]
... 21 common frames omitted
[WARN] [ConnectionChecker-1] org.red5.server.net.rtmp.RTMPConnManager - Connection OXEXJYYHVOTE2 has exceeded the max inactivity threshold
[WARN] [ConnectionChecker-1] org.red5.server.net.rtmp.RTMPConnManager - Connection not found for OXEXJYYHVOTE2
red5 以后的版本需要scope 包。您似乎正在使用旧版本 red5.jar 编译您的应用程序,然后将新版本 1.0.5 部署到服务器 运行。使用 1.0.5 red5.jar 构建和编译,您的问题将得到解决。