Error creating bean with name 'streamFilenameGenerator'

74 views
Skip to first unread message

Andreas We

unread,
Feb 21, 2013, 3:59:20 AM2/21/13
to red5in...@googlegroups.com
Hello,

Red5 1.0
Java 1.7

my code:

package org.red5.core;
import org.red5.server.api.scope.IScope;
import org.red5.server.api.stream.IStreamFilenameGenerator;

public abstract class FNG implements IStreamFilenameGenerator {

        public String recordPath = "/";
     
        public String playbackPath = "/";
        
        public String generateFilename(IScope scope, String name,
                GenerationType type) {
            
            return generateFilename(scope, name, null, type);
        }

        public String generateFilename(IScope scope, String name,
                String extension, GenerationType type) {
            String filename;
            if (type == GenerationType.RECORD)
                filename = recordPath + name;
            else
                filename = playbackPath + name;
            
            if (extension != null)
                
                filename += extension;
            System.out.println("FILE: " + filename);
            return filename;
        }
    }

<bean id="streamFilenameGenerator" class="org.red5.core.FNG" />

Exception in thread "Launcher:/AWstream" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'streamFilenameGenerator' defined in ServletContext resource [/WEB-INF/red5-web.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.red5.core.FNG]: Is it an abstract class?; nested exception is java.lang.InstantiationException
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:997)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:943)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
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.BeanInstantiationException: Could not instantiate bean class [org.red5.core.FNG]: Is it an abstract class?; nested exception is java.lang.InstantiationException
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:150)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:76)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:990)
... 11 more
Caused by: java.lang.InstantiationException
at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(InstantiationExceptionConstructorAccessorImpl.java:48)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:147)
... 13 more

thank you!

andreas

Luigi Bitonti

unread,
Feb 21, 2013, 4:14:06 AM2/21/13
to red5in...@googlegroups.com
The answer seems to be in the stack trace: your class is abstract and cannot be instantiated.

On a different note, I am not sure your class should belong to org.red5.core as that package is really for server classes.

Cheers,
Luigi



andreas

--
 
---
You received this message because you are subscribed to the Google Groups "red5" group.
To unsubscribe from this group and stop receiving emails from it, send an email to red5interest...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Trevor Burton

unread,
Feb 21, 2013, 4:18:45 AM2/21/13
to red5in...@googlegroups.com
your class is marked 'abstract' hence the InstantiationException.

It can't be created!

Andreas We

unread,
Feb 21, 2013, 4:22:47 AM2/21/13
to red5in...@googlegroups.com, worldo...@googlemail.com
Hi,

public  class FNG implements IStreamFilenameGenerator {

then eclipse says:


Thread [NioProcessor-2] (Suspended (The type FNG must implement the inherited abstract method IStreamFilenameGenerator.resolvesToAbsolutePath()))
FNG.resolvesToAbsolutePath() line: 5
ProviderService.getStreamFile(IScope, String) line: 198
ProviderService.lookupProviderInput(IScope, String, int) line: 57
PlayEngine.play(IPlayItem, boolean) line: 346
PlayEngine.play(IPlayItem) line: 307
PlaylistSubscriberStream.play() line: 242
StreamService.play(String, int, int, boolean) line: 333
StreamService.play(String) line: 359
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 57
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 43
Method.invoke(Object, Object...) line: 601
ServiceInvoker.invoke(IServiceCall, Object) line: 193
RTMPHandler.invokeCall(RTMPConnection, IServiceCall, Object) line: 176
RTMPHandler.onInvoke(RTMPConnection, Channel, Header, Notify, RTMP) line: 377
RTMPHandler(BaseRTMPHandler).messageReceived(Object, IoSession) line: 132
RTMPMinaIoHandler.messageReceived(IoSession, Object) line: 164
DefaultIoFilterChain$TailFilter.messageReceived(IoFilter$NextFilter, IoSession, Object) line: 690
DefaultIoFilterChain.callNextMessageReceived(IoFilterChain$Entry, IoSession, Object) line: 417
DefaultIoFilterChain.access$1200(DefaultIoFilterChain, IoFilterChain$Entry, IoSession, Object) line: 47
DefaultIoFilterChain$EntryImpl$1.messageReceived(IoSession, Object) line: 765
ProtocolCodecFilter$ProtocolDecoderOutputImpl.flush(IoFilter$NextFilter, IoSession) line: 407
ProtocolCodecFilter.messageReceived(IoFilter$NextFilter, IoSession, Object) line: 236
DefaultIoFilterChain.callNextMessageReceived(IoFilterChain$Entry, IoSession, Object) line: 417
DefaultIoFilterChain.access$1200(DefaultIoFilterChain, IoFilterChain$Entry, IoSession, Object) line: 47
DefaultIoFilterChain$EntryImpl$1.messageReceived(IoSession, Object) line: 765
RTMPEIoFilter.messageReceived(IoFilter$NextFilter, IoSession, Object) line: 124
DefaultIoFilterChain.callNextMessageReceived(IoFilterChain$Entry, IoSession, Object) line: 417
DefaultIoFilterChain.access$1200(DefaultIoFilterChain, IoFilterChain$Entry, IoSession, Object) line: 47
DefaultIoFilterChain$EntryImpl$1.messageReceived(IoSession, Object) line: 765
DefaultIoFilterChain$HeadFilter(IoFilterAdapter).messageReceived(IoFilter$NextFilter, IoSession, Object) line: 109
DefaultIoFilterChain.callNextMessageReceived(IoFilterChain$Entry, IoSession, Object) line: 417
DefaultIoFilterChain.fireMessageReceived(Object) line: 410
NioProcessor(AbstractPollingIoProcessor<S>).read(S) line: 710
NioProcessor(AbstractPollingIoProcessor<S>).process(S) line: 664
NioProcessor(AbstractPollingIoProcessor<S>).process() line: 653
AbstractPollingIoProcessor<S>.access$600(AbstractPollingIoProcessor) line: 67
AbstractPollingIoProcessor$Processor.run() line: 1124
NamePreservingRunnable.run() line: 64
ThreadPoolExecutor.runWorker(ThreadPoolExecutor$Worker) line: 1110
ThreadPoolExecutor$Worker.run() line: 603
Thread.run() line: 722

Andreas We

unread,
Feb 21, 2013, 4:49:37 AM2/21/13
to red5in...@googlegroups.com, worldo...@googlemail.com
Hello,

ok, its my first time, that i work with red5 :-)

it works now, i just add

 public boolean resolvesToAbsolutePath() {
            return false;
        }

thank you!

Am Donnerstag, 21. Februar 2013 10:18:45 UTC+1 schrieb Trevor Burton:

Andreas We

unread,
Feb 21, 2013, 7:31:45 AM2/21/13
to red5in...@googlegroups.com, worldo...@googlemail.com
One question more:

my code:
public  class FNG implements IStreamFilenameGenerator {
    public String generateFilename(IScope scope, String name, GenerationType type) {
            return generateFilename(scope, name, null, type);
        }
        @Override
        public String generateFilename(IScope scope, String name, String extension, GenerationType type) {
        String fn;
        if (type == GenerationType.RECORD) { 
        System.out.println("Camera Connect  " + name); 
        fn = name; 
        } else {
        System.out.println("Viewer Connect  " + name); 
        fn = "test.flv"; } 
            return fn;
        }
        @Override
        public boolean resolvesToAbsolutePath() {
            return false;
        }
    }

if connect the publisher strean name: test.flv 
log:
Camera Connect  test.flv
[INFO] [NioProcessor-2] org.red5.core.Application - W3C x-category:stream x-event:publish c-ip:0:0:0:0:0:0:0:1 x-sname:148fe662-a44a-470e-b5ae-bf091c32125c x-name:test.flv


Then i try to connect with a viewer:
Viewer Connect  REPLACE_ME.flv
[INFO] [pool-4-thread-2] org.red5.core.Application - W3C x-category:stream x-event:play c-ip:0:0:0:0:0:0:0:1 x-sname:1124e6ea-7d0b-48b8-8ee7-3df59ca899fe
[INFO] [NioProcessor-2] org.red5.server.stream.ProviderService - Exception attempting to lookup file: ServletContext resource [/test.flv] cannot be resolved to URL because it does not exist
[INFO] [pool-4-thread-4] org.red5.core.Application - W3C x-category:stream x-event:play c-ip:0:0:0:0:0:0:0:1 x-sname:1124e6ea-7d0b-48b8-8ee7-3df59ca899fe x-name:REPLACE_ME

how i fix that?

Thanks

Mondain

unread,
Feb 21, 2013, 9:14:51 AM2/21/13
to red5in...@googlegroups.com
I only work with that set of classes every so often so I do forget the exact routines; I would suggest saving this url while you're learning the server: http://red5.googlecode.com/svn/doc/trunk/reference/html/index.html
To jump specifically to the filename gen / stream stuff, go here:

Paul

Andreas We

unread,
Feb 21, 2013, 9:31:14 AM2/21/13
to red5in...@googlegroups.com
It works fine with static files on disk,  but i want to use it with  live streams!

i have 8 TV channels from satelite receiver, i send it to the server ch1, ch2, ch3.... and sometimes i need that all users see only one channel.
in this case i want that all connections and streamnames goes to one livestream! 
If the user request StreamFooBar123 he has to get stream channel1...or so..  like the apache mod_rewrite :-)


it looks like,  generateFilename() works only with real files, not with broadcast stream


Andreas

Mondain

unread,
Feb 21, 2013, 11:06:17 AM2/21/13
to red5in...@googlegroups.com
For live streams you're going to want ServerStream or StreamService; I believe one of those has a look-up. Also be aware that you can supply parameters on the client side application to force "live" or "recorded". Have a look at this: http://livedocs.adobe.com/flashmediaserver/3.0/hpdocs/help.html?content=00000185.html
Reply all
Reply to author
Forward
0 new messages