2012-08-07 121 views
-1

我試圖將我的red5應用程序部署到webapps文件夾。但!我的輸出中有一些錯誤。Red5應用程序調試

Exception in thread "Launcher:/myApp" 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.core.Application] for bean with name 'web.handler' defined in ServletContext resource [/WEB-INF/red5-web.xml]; nested exception is java.lang.ClassNotFoundException: org.red5.core.Application; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.red5.core.Application] for bean with name 'web.handler' defined in ServletContext resource [/WEB-INF/red5-web.xml]; nested exception is java.lang.ClassNotFoundException: org.red5.core.Application 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:1147) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1040) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:511) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450) 
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290) 
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) 
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287) 
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:189) 
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:557) 
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:842) 
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:416) 
    at org.red5.server.tomcat.TomcatLoader$1.run(TomcatLoader.java:594) 
Caused by: org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.red5.core.Application] for bean with name 'web.handler' defined in ServletContext resource [/WEB-INF/red5-web.xml]; nested exception is java.lang.ClassNotFoundException: org.red5.core.Application 
    at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1208) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:568) 
[INFO] [Launcher:/myApp] org.springframework.beans.factory.support.DefaultListableBeanFactory - Destroying singletons in org.s[email protected]1af1915: defining beans [placeholderConfig,web.context,web.scope,web.handler]; parent: org.s[email protected]46136 
    at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1277) 
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:302) 
    at org.springframework.beans.factory.BeanFactoryUtils.beanNamesForTypeIncludingAncestors(BeanFactoryUtils.java:185) 
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:805) 
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:762) 
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:680) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:1132) 
    ... 11 more 
Caused by: java.lang.ClassNotFoundException: org.red5.core.Application 
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1484) 
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1329) 
    at org.springframework.util.ClassUtils.forName(ClassUtils.java:258) 
    at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:408) 
    at org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass(AbstractBeanFactory.java:1229) 
    at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1200) 
    ... 19 more 

畢竟,我有我的應用程序文件夾在webapps,但沒有在我的項目類文件夾中的.class文件。所以,我不能在我的客戶端應用程序中使用服務器端應用程序。 有什麼問題?

應用程序是默認生成的。這裏是我的RED5-web.xml中

<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> 
<beans> 

    <!-- 
    Defines a properties file for dereferencing variables 
    --> 
    <bean id="placeholderConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> 
     <property name="location" value="/WEB-INF/red5-web.properties" /> 
    </bean> 

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

    <!-- 
    Defines the web scopes 
    --> 
    <bean id="web.scope" class="org.red5.server.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> 

    <!-- 
    Defines the web handler which acts as an applications endpoint 
    --> 
    <bean id="web.handler" 
     class="org.red5.core.Application" 
     singleton="true" /> 

</beans> 

而我的應用程序類

package org.red5.core; 

/* 
* RED5 Open Source Flash Server - http://www.osflash.org/red5 
* 
* Copyright (c) 2006-2008 by respective authors (see below). All rights reserved. 
* 
* This library is free software; you can redistribute it and/or modify it under the 
* terms of the GNU Lesser General Public License as published by the Free Software 
* Foundation; either version 2.1 of the License, or (at your option) any later 
* version. 
* 
* This library is distributed in the hope that it will be useful, but WITHOUT ANY 
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. 
* 
* You should have received a copy of the GNU Lesser General Public License along 
* with this library; if not, write to the Free Software Foundation, Inc., 
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
*/ 

import org.red5.server.adapter.ApplicationAdapter; 
import org.red5.server.api.IConnection; 
import org.red5.server.api.IScope; 
import org.red5.server.api.service.ServiceUtils; 

/** 
* Sample application that uses the client manager. 
* 
* @author The Red5 Project ([email protected]) 
*/ 
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); 
    } 

} 

我做這一切在Eclipse中的Red5插件。所以...我不知道什麼可能是錯的。

+0

只是直接發佈錯誤並沒有多大幫助。嘗試在發生錯誤的位置添加代碼,並且如果您引用了某些文件(看起來像是),請顯示文件系統的框架。 – 2012-08-07 04:08:49

+0

我已經添加了更多關於該信息的信息 – 2012-08-07 04:15:28

回答

7

我有完全相同的問題。聽起來就像你試圖僅使用新的Red5_1.0來跟隨教程視頻,就像我一樣。經過多日,啤酒和瘀傷將我的頭撞向我的辦公桌,我發現如果您在red5-web.xml文件中將您的班級更改爲「org.red5.server.scope.WebScope」,它應該可以正常工作(bean ID = 「web.scope」)。另外,您可能需要從「import org.red5.server.api.IScope;」更改您的org.red5.core源導入。到「import org.red5.server.api.scope.IScope;」。顯然,在Red5的新版本中出現了一些類重構

+1

對於1.0的最終版本以及一些RC的領先者,你必須使用新的包。 Red5核心的範圍在「範圍」包中。最後,不要使用org.red5命名空間/包空間;使用您自己的軟件包爲您的應用程序,它應該使一些事情更容易 – 2013-01-08 21:33:32

0

雖然當我檢查我的類已經設置爲第九版中提到的「org.red5.server.scope.WebScope」時,我收到了類似的錯誤馬特的回答。後來我發現我缺少webaps/chat/WEB-INF /下的lib目錄。

如果其他人有類似的問題,這可能會有用。