5

I am attempting to run a basic application on Red5 that just makes an attempt to connect to the red5 server (on localhost). The source for this application is below:

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);
   }

}

My client code is also pretty basic. For brevity, the snippet is below:

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");
            }

Note that I make the alert box show the error code so I can see what happens.

On the client side, when I attempt to connect, I get two failure messages:

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

And on the server side I am seeing the following:

[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

It seems clear that something is wrong due to some kind of mis- configuration. Unfortunately, I have no idea where to look for the problem.

Could someone please give some idea of what is going wrong and how I can fix this? Thank you...

ADDITION: Startup Exception that occurs when running 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
Factor Three
  • 2,094
  • 5
  • 35
  • 51

4 Answers4

1

Another Fact could be that u have 2 Red5.jars so u have to delete one. In my case it worked rly good. Big Ty for this post

Artur Rem
  • 209
  • 1
  • 4
  • 18
1

Change org.red5.server.WebScope to org.red5.server.scope.WebScope in your red5-web.xml file.

m4rtin
  • 2,445
  • 22
  • 34
0

what version of Red5 is that?
Are there any exceptions when you startup your custom webapp? There might be already an error in the startup of the server that consequently leads to your issue.

Sebastian

seba.wagner
  • 3,800
  • 4
  • 28
  • 52
  • The version is 1.0 RC2. And as it turns out there is an exception generated at startup. I cannot put the full exception stack in this comment section, but I will add the stack trace to my original question. – Factor Three Nov 13 '12 at 18:56
  • java.lang.ClassNotFoundException: org.red5.server.WebScope The error is in your webapp. You somehow seem to define a relation to org.red5.server.WebScope. This class does not exist in red5-RC2. Maybe you copied your sample code from an old webapp. You might simply check out the latest Demo applications to get an up to date and working sample you can start with. – seba.wagner Nov 14 '12 at 05:05
  • 1
    Actually, no, I found the problem. It is not with my webapp, it is with the red5 plugin. The plugin is not updated to reflect changes made in RC2. All of my current code, including the webapp, was generated by the Red5 plugin. It is all pretty basic code; I have not altered it in any way once the Red5 plugin generated it. I merely attempted to compile and run the server- side code and connect using the client code. Unfortunately there are errors in the code that the plugin generates. There are class files that were moved in RC2 that are not properly reflected in the plugin. More on this below. – Factor Three Nov 14 '12 at 22:38
  • When you use the plugin to create a Red5 project, it generates an Application.java file. Application.java has an import: import org.red5.server.api.IScope which is incorrect because the IScope class was moved to import org.red5.server.api.scope.IScope. I had discovered this when I used the plugin, but was going to wait before reporting it. Continued below. – Factor Three Nov 14 '12 at 22:47
  • 3
    But figuring that some other class has been moved, I searched through the red5,jar file for the WebScope class. It turned out I was right. The WebScope class declared in red5-web.xml had been moved from org.red5.server.WebScope to org.red5.server.scope.WebScope. Once I corrected this, I was able to run the Red5 server without problems. I can now connect to the server and (to a limited extent as I will describe in a later question) I can now stream movies using the VideoPlayer. – Factor Three Nov 14 '12 at 22:48
  • A strong suggestion to the Red5 team: correct the bad code generated by the plugin. The plugin clearly has bugs that are in serious need of fixing... – Factor Three Nov 14 '12 at 22:49
  • 1
    You should post that as an answer so it can be more visible to people who are having similar problems –  Jul 08 '13 at 17:08
0

The application scope that you are attempting to connect to "Player" does not exist on the server; the log notes this as "Scope Player not found on localhost". What this means in general is that your application didn't load. The reason that it didn't load looks like class package error for WebScope. Change the beans class attribute to org.red5.server.scope.WebScope and try again.

Paul Gregoire
  • 9,715
  • 11
  • 67
  • 131