org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named '__dwrConfiguration' is definedweb.xml配置了<listener>
  <listener-class>
   org.springframework.web.context.ContextLoaderListener
  </listener-class>
 </listener>有网友说 是因为 spring 的配置文件却没有配置Configuration 引起的   
  这样该怎样做啊 spring的配置文件里 要怎么配   求大家解决 感谢 感谢

解决方案 »

  1.   

    <!-- DWR配置 -->
    <servlet>
      <servlet-name>dwr</servlet-name>
      <servlet-class>org.directwebremoting.spring.DwrSpringServlet</servlet-class>
      <init-param>
          <param-name>debug</param-name>
          <param-value>true</param-value>
      </init-param>
      <init-param>
         <param-name>activeReverseAjaxEnabled</param-name>
         <param-value>true</param-value>
       </init-param>
    </servlet>
    <servlet-mapping>
          <servlet-name>dwr</servlet-name>
          <url-pattern>/dwr/*</url-pattern>
    </servlet-mapping>
      

  2.   

    给你个完整的例子dwr.xml<dwr>
    <allow>
    <create javascript="formatDocRandomUid_Tag" creator="spring">
    <param name="beanName" value="formatDocRandomUid_Tag" />
    <include method="getUid_Tag" />
    <include method="getTag"/>
    </create>
    </allow>
    </dwr>web.xml<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>
    /WEB-INF/classes/applicationContext-*.xml
    </param-value>
    </context-param>
    <servlet>
    <servlet-name>dwr-invoker</servlet-name>
    <servlet-class>
    org.directwebremoting.servlet.DwrServlet
    </servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>dwr-invoker</servlet-name>
    <url-pattern>/dwr/*</url-pattern>
    </servlet-mapping>
    spring <bean id="formatDocRandomUid_Tag"
    class="com.jty.utils.FormatDocRandom32UID_Tag">
    <property name="sessionFactory">
    <ref bean="mySessionFactory" />
    </property>
    </bean>页面 <script type="text/javascript" src="dwr/util.js"></script>
    <script type="text/javascript" src="dwr/interface/randomUUID.js"></script>
    <script type="text/javascript" src="dwr/interface/formatDocRandomUid_Tag.js"></script>
      

  3.   

    需要dwr.xml 文件,才能帮你解决。
    下面我是我的写法并有注释,请参考:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE dwr PUBLIC
        "-//GetAhead Limited//DTD Direct Web Remoting 2.0//EN"
        "http://getahead.org/dwr/dwr20.dtd">
    <dwr>
       <allow>
       <create javascript="ss" creator="spring">    <!-- 用了spring 这里自然选择了spring 构 造器,表示由spring创造相关对象 -->
    <param name="beanName" value="songdao"></param> <!-- 要注意,前面的name属性给定的值 就是"beanName",后面的value才是 具体的spring中注册的bean名-->
     <include method="checkSong" />               <!-- 具体的要在页面调用的方法  -->
       </create>
    <!--转换的配置,如一个自定义的类,常用到的如Po中的 类-->
    <convert match="org.tongying.www.po.Song" converter="bean" javascript="ss"> <!-- javascript属性如果不给下方的属性在页面显示会有问题 -->
    <param name="include" value="songName,singer"></param>                  
                        <!-- 给定要展现在页面上的 自定义对象的某个 属性 -->
    </convert>
       </allow>
    </dwr>回复中编辑格式,怎一个“累”字了得。
      

  4.   

    又重新看了一下楼主的问题,才注意,你在web.xml中的配置是用的这种写法(红色标记处),那么你可以直接在 spring的配置文件中采用如下配置即可。这样的配置就不需要单独的dwr.xml文件了,而是直接交给spring管理,也就是所有配置都写在spring的配置文件中。假设你的spring配置文件是beans.xml
    首先要 再头部添加更多的内容具体如下:
    applicationContext.xml中的配置<?xml version="1.0" encoding="UTF-8"?>
    <beans
       xmlns="http://www.springframework.org/schema/beans"
    xmlns:aop="http://www.springframework.org/schema/aop"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:dwr ="http://www.directwebremoting.org/schema/spring-dwr" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
    http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
    http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
    http://www.directwebremoting.org/schema/spring-dwr http://www.directwebremoting.org/schema/spring-dwr-2.0.xsd">
    其次:<!-- dwr2的引入-->
    <dwr:configuration>
       <dwr:create javascrip ="ss" type="spring" >
         <dwr:param name="beanName" value = "songdao"/><!-- 注意属性name的值 就是"beanName"原样,beanName就是值 -->
         <dwr:include method = "checkSong"/><!--具体方法要在页面上调用的方法,include进来 -->
      </dwr:create>
     <!-- po转换的配置, -->
      <dwr:convert type="bean"
    class="org.tongying.www.po.Song" javascript="ss">
      <dwr:include method="songName" /> 
       <!-- 这里 不要被method属性迷惑,它就是你让你写 你po对象上的属性的 -->
       <dwr:include method="singer" />
      </dwr:convert>
    </dwr:configuration>

    好了,两个回复,两种配置方法,都写好了,请参考。真希望回复里面能有 “快速格式化”
      

  5.   

    正好不久前我给同学培训DWR和DWR与Spring整合,我把课件给你看看应该就明白了。1. 配置dwr.xml通过Spring创建器获得java对象<allow>
    <create creator="spring" javascript="dwrTest">
    <param name="beanName" value="Spring中bean的id值" />
    </create>
    </allow>
    说明:
    <param>的name=“beanName”对于Spring创建器来说是固定的,
    value的值是Spring中bean的id值2. 配置web.xml监听器(我的applicationContext.xml文件放在classpath中)<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>
    /WEB-INF/applicationContext.xml,classpath*:applicationContext.xml
    </param-value>
    </context-param><listener>
    <listener-class>
    org.springframework.web.context.ContextLoaderListener
    </listener-class>
    </listener>3. applicationContext.xml中的配置非常简单,只需将要调用的Java对象的类配置进去就可以了** 希望对你有帮助。
      

  6.   

    看看是不是配置web.xml里面 filter,servlet, 什么之类 顺序!!问题,这个错误应该是加载文件的时候出的
      

  7.   

    org.directwebremoting.spring.DwrSpringServlet
    换成
    org.directwebremoting.servlet.DwrServlet