1 问题出现
当我试着去https://github.com/Red5/red5-server下载Red5的源码,我是把自己编译源码的,
最终的Red5-server需要依赖其他几个组件:
(1) red5-service
(2) red5-server-common
(3) red5-io
一次编译完上面三个项目之后,开始输入命令编译red5-server,因为这个才是我们最终想要的流媒体服务器.
mvn -Dmaven.test.skip=true install
当让有上面这一步还不够:上面只是完成了编译工作.我们还需要把red5运行的文件大成压缩包。
mvn -Dmaven.test.skip=true clean package -P assemble
这样完成之后,你将会再red5-server的target目录看到如下内容:
2 我首先会把red5-server-1.0.6-SNAPSHOT-server.zip复制到我常用的工作目录中去.然后解压该压缩包。解压之后看起来应该是这样:
3 然后一起准备妥当,双击red5.bat ,会弹出一个新的黑色窗口.然后程序开始启动.但是当我启动过程中,意外的事情发生了.red5没有像我想象的那么顺利.却抛出如下异常信息:
2015-09-08 13:41:12,813 [Launcher:/oflaDemo] 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:1574) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:755) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757) ~[spring-context-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480) ~[spring-context-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.red5.server.tomcat.TomcatLoader$1.run(TomcatLoader.java:485) [tomcatplugin-1.9.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.6-SNAPSHOT.jar:na]
at org.red5.server.scope.Scope.hasChildScope(Scope.java:819) ~[red5-server-common-1.0.6-SNAPSHOT.jar:na]
at org.red5.server.scope.Scope.init(Scope.java:872) ~[red5-server-common-1.0.6-SNAPSHOT.jar:na]
at org.red5.server.scope.WebScope.register(WebScope.java:225) ~[red5-server.jar:na]
at org.red5.server.scope.WebScope.afterPropertiesSet(WebScope.java:111) ~[red5-server.jar:na]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1633) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1570) ~[spring-beans-4.1.7.RELEASE.jar:4.1.7.RELEASE]
... 10 common frames omitted
4 问题解决方法
导致问题代码:
Caused by: java.lang.NoSuchMethodError: org.red5.server.scope.Scope
ConcurrentScopeSet.keySet()Ljava/util/concurrent/ConcurrentHashMap
KeySetView;
经过查阅资料最后发现是java版本的事,我的环境一直用的jdk7 原来keySet不适合java8以下版本,解决方法:将java版本跳到java8版本,或者直接重新安装一个java8的jdk .