Red5 / red5-server

Red5 Server core
Apache License 2.0
3.34k stars 982 forks source link

After adding red5 jar to war package spring throws BeanCreationException #25

Open ghost opened 10 years ago

ghost commented 10 years ago

After writing a custom application and adding the red5 jars (which I shouldn't need to do as spring loads the red5-server jar and red5-service jars), spring throws this error. Any help or maybe insight to see if this is a bug, the mailing list couldn't identify the cause leading me to think it is a bug. My red5-web.xml is after the error.

[INFO] [Launcher:/Red5 WebCams] org.red5.server.Context - Setting parent bean factory as core

Exception in thread "Launcher:/Red5 WebCams" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'web.scope' defined in ServletContext resource [/WEB-INF/red5-web.xml]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'org.red5.server.Server' to required type 'org.red5.server.api.IServer' for property 'server'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [org.red5.server.Server] to required type [org.red5.server.api.IServer] for property 'server': no matching editors or conversion strategy found

        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:547)

        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)

        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302)

        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)

        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298)

        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)

        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:703)

        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:760)

        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)

        at org.red5.server.tomcat.TomcatLoader$2.run(TomcatLoader.java:668)

Caused by: org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'org.red5.server.Server' to required type 'org.red5.server.api.IServer' for property 'server'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [org.red5.server.Server] to required type [org.red5.server.api.IServer] for property 'server': no matching editors or conversion strategy found

        at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:474)

        at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:511)
<?xml version="1.0" encoding="UTF-8" ?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:lang="http://www.springframework.org/schema/lang"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd                            
    http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-3.1.xsd">

    <bean id="placeholderConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="location" value="/WEB-INF/red5-web.properties" />
    </bean>

    <bean id="web.context" class="org.red5.server.Context" autowire="byType" />

    <bean id="web.scope" class="org.red5.server.scope.WebScope" init-method="register">
        <property name="server" ref="red5.server" />
        <property name="parent" ref="global.scope" />
        <property name="context" ref="web.context" />
        <property name="handler" ref="web.handler" />
        <property name="contextPath" value="${webapp.contextPath}" />
        <property name="virtualHosts" value="${webapp.virtualHosts}" />
    </bean>

    <bean id="web.handler" name="application" class="red5Connection.ConnectionHandler" />

</beans>
mondain commented 10 years ago

The red5.jar may only exist once and in the case of a war deployment, it would need to go in the shared or common lib of the application server to prevent these classloader clashes.

ghost commented 10 years ago

That doesn't work, my custom application war package doesn't see the jars when they are moved to the common lib folder. I tried in 1.0.3.

Exception in thread "Launcher:/Red5 WebCams" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'web.scope' defined in ServletContext resource 

[/WEB-INF/red5-web.xml]: Cannot resolve reference to bean 'web.handler' while setting bean property 'handler'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'web.handler' 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 [red5Connection.ConnectionHandler]: Constructor threw exception; nested exception is java.lang.Error: Unresolved compilation problems: 
ghost commented 10 years ago

Can you elevate this to a bug status? So people in your organization can start working on this issue. If you need more information let me know.

asimsalar commented 9 years ago

I am having same trouble. I just downloaded the current version red5 1.0.5 and fresh installed it on my windows7 64 bit . Error creating bean with name web.scope defined in ServletContext resource [/WEB-INF/red5-web.xml]

2015-02-10 19:51:22,696 [Launcher:/] INFO org.red5.server.scope.Scope - Invalid scope name, null is not allowed 2015-02-10 19:51:22,698 [Launcher:/] WARN org.red5.server.scope.Scope - Invalid scope rejected: Scope [name=null, path=/default, type=APPLICATION, autoStart=true, creationTime=1423579882660, depth=1, enabled=true, running=false] 2015-02-10 19:51:22,698 [Launcher:/] WARN org.red5.server.scope.Scope - Scope not added to parent 2015-02-10 19:51:22,699 [Launcher:/] INFO org.red5.server.scope.WebScope - Webscope already registered 2015-02-10 19:51:22,709 [Launcher:/chat] WARN o.s.w.c.s.XmlWebApplicationContext - Exception encountered during context initialization - cancelling refresh attempt org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'web.scope' defined in ServletContext resource [/WEB-INF/red5-web.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.red5.server.scope.Scope$ConcurrentScopeSet.keySet()Ljava/util/concurrent/ConcurrentHashMap$KeySetView; at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1554) ~[spring-beans-4.0.8.RELEASE.jar:4.0.8.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539) ~[spring-beans-4.0.8.RELEASE.jar:4.0.8.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475) ~[spring-beans-4.0.8.RELEASE.jar:4.0.8.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302) ~[spring-beans-4.0.8.RELEASE.jar:4.0.8.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) ~[spring-beans-4.0.8.RELEASE.jar:4.0.8.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298) ~[spring-beans-4.0.8.RELEASE.jar:4.0.8.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) ~[spring-beans-4.0.8.RELEASE.jar:4.0.8.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:706) ~[spring-beans-4.0.8.RELEASE.jar:4.0.8.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:762) ~[spring-context-4.0.8.RELEASE.jar:4.0.8.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482) ~[spring-context-4.0.8.RELEASE.jar:4.0.8.RELEASE] at org.red5.server.tomcat.TomcatLoader$1.run(TomcatLoader.java:479) [tomcatplugin-1.7.jar:na] Caused by: java.lang.NoSuchMethodError: org.red5.server.scope.Scope$ConcurrentScopeSet.keySet()Ljava/util/concurrent/ConcurrentHashMap$KeySetView; at org.red5.server.scope.Scope$ConcurrentScopeSet.hasName(Scope.java:1411) ~[red5-server-common-1.0.5-RELEASE.jar:na] at org.red5.server.scope.Scope.hasChildScope(Scope.java:819) ~[red5-server-common-1.0.5-RELEASE.jar:na] at org.red5.server.scope.Scope.init(Scope.java:872) ~[red5-server-common-1.0.5-RELEASE.jar:na] at org.red5.server.scope.WebScope.register(WebScope.java:225) ~[red5.jar:na] at org.red5.server.scope.WebScope.afterPropertiesSet(WebScope.java:111) ~[red5.jar:na] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1613) ~[spring-beans-4.0.8.RELEASE.jar:4.0.8.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1550) ~[spring-beans-4.0.8.RELEASE.jar:4.0.8.RELEASE] ... 10 common frames omitted

solomax commented 9 years ago

should be fixed please clean maven cache and re-build, re-download

mondain commented 9 years ago

As Max says, this is resolved in the repositories (sonatype/maven). Otherwise, you have to upgrade your os to java 8.

mondain commented 9 years ago

Didn't mean to close this yet, @asimsalar please don't hijack issue threads.

asimsalar commented 9 years ago

i am not mondain. sorry for inconvenience. I am new to red5. I have downloaded the precompiled windows installer and installed it on my windows 7 x64 with java version 1.7.0_45 when i start red5 server i have above error. please guide my.

i have posted question on stackoverflow please help me. http://stackoverflow.com/questions/28438898/red5-error-creating-bean-with-name-web-scope

mondain commented 9 years ago

What I mean by hijacking is that you're posting here as if it were a general discussion thread; this is for the specified issue in the title. Discussions are to be handled via the user list or by posting questions on stackoverflow.

virtualfunction commented 9 years ago

Is this bug related to http://stackoverflow.com/questions/28438898/red5-error-creating-bean-with-name-web-scope-in-fresh-installation-on-windows/28757607

Just as I'm getting this error using the ZIP file if I unzip the 1.0.5-release zip and run ./red5.sh - 1.0.4. never had this issue, so I'm inclined to think it's a bug.

mondain commented 9 years ago

The keySet() issue is one of jdk difference (compile vs runtime); see the SO answer and again, please don't hijack the threads.