SSH整合dwr出现问题,

问题描述

SSH整合DWR时,出现如下错误,好像是使用dwr调用后台的类时不能通过spring实例化该类,报错如下:java.lang.NoClassDefFoundError:org/springframework/web/servlet/support/RequestContextUtilsatorg.directwebremoting.spring.SpringCreator.getBeanFactory(SpringCreator.java:173)atorg.directwebremoting.spring.SpringCreator.getInstance(SpringCreator.java:131)atorg.directwebremoting.impl.DefaultRemoter.execute(DefaultRemoter.java:333)atorg.directwebremoting.impl.DefaultRemoter.execute(DefaultRemoter.java:273)atorg.directwebremoting.servlet.PlainCallHandler.handle(PlainCallHandler.java:52)atorg.directwebremoting.servlet.UrlProcessor.handle(UrlProcessor.java:101)atorg.directwebremoting.servlet.DwrServlet.doPost(DwrServlet.java:120)atjavax.servlet.http.HttpServlet.service(HttpServlet.java:710)atjavax.servlet.http.HttpServlet.service(HttpServlet.java:803)atorg.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)atorg.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)atorg.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:73)atorg.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)atorg.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)atorg.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)atorg.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)atorg.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)atorg.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)atorg.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:96)atorg.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)atorg.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)atorg.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)atorg.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)atorg.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)atorg.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)atorg.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)atorg.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)atorg.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)atorg.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)atorg.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)atorg.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)atorg.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)atorg.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)atjava.lang.Thread.run(UnknownSource)我的web.xml配置:<listener><listener-class>org.springframework.web.context.ContextLoaderListener</listener-class><!--default:/WEB-INF/applicationContext.xml--></listener><context-param><param-name>contextConfigLocation</param-name><!--<param-value>/WEB-INF/applicationContext-*.xml,classpath*:applicationContext-*.xml</param-value>--><param-value>classpath:beans.xml</param-value></context-param><filter><filter-name>encodingFilter</filter-name><filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class><init-param><param-name>encoding</param-name><param-value>UTF-8</param-value></init-param></filter><filter-mapping><filter-name>encodingFilter</filter-name><url-pattern>/*</url-pattern></filter-mapping><filter><filter-name>openSessionInView</filter-name><filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class><init-param><param-name>sessionFactoryBeanName</param-name><param-value>sf</param-value></init-param></filter><filter-mapping><filter-name>openSessionInView</filter-name><url-pattern>/*</url-pattern></filter-mapping><filter><filter-name>struts2</filter-name><filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class></filter><filter-mapping><filter-name>struts2</filter-name><url-pattern>/*</url-pattern></filter-mapping><!--配置DWR--><servlet><servlet-name>dwr-invoker</servlet-name><servlet-class>uk.ltd.getahead.dwr.DWRServlet</servlet-class><init-param><param-name>debug</param-name><param-value>true</param-value></init-param><init-param><param-name>allowGetForSafariButMakeForgeryEasier</param-name><param-value>true</param-value></init-param><load-on-startup>2</load-on-startup></servlet><servlet-mapping><servlet-name>dwr-invoker</servlet-name><url-pattern>/dwr/*</url-pattern></servlet-mapping><!--配置DWR结束-->dwr.xml配置:<?xmlversion="1.0"encoding="UTF-8"?><!DOCTYPEdwrPUBLIC"-//GetAheadLimited//DTDDirectWebRemoting2.0//EN""http://getahead.org/dwr/dwr20.dtd"><dwr><allow><createjavascript="TuanSiteManagerImplJs"creator="spring"><paramname="class"value="com.sp.service.impl.TuanSiteManagerImpl"></param><includemethod="deleteById"/></create></allow></dwr>spring中的注入使用声明的方式,这些注入在不适用dwr时都正常。类的代码:@Component("tuanSiteManagerImpl")publicclassTuanSiteManagerImplimplementsTuanSiteManager{privateTuanSiteDaoTuanSiteDao;publicTuanSiteDaogetTuanSiteDao(){returnTuanSiteDao;}@ResourcepublicvoidsetTuanSiteDao(TuanSiteDaoTuanSiteDao){this.TuanSiteDao=TuanSiteDao;}publicvoiddelete(TuanSiteobj){//TODOAuto-generatedmethodstubTuanSiteDao.delete(obj);}publicvoiddeleteAbsolute(TuanSiteobj){//TODOAuto-generatedmethodstubTuanSiteDao.deleteAbsolute(obj);}publicbooleandeleteById(intid){//TODOAuto-generatedmethodstubbooleanflag=false;//try{TuanSiteobj=TuanSiteDao.getById(id);TuanSiteDao.delete(obj);flag=true;//}catch(Exceptione){//TODO:handleexceptionflag=false;//System.out.println(e.getMessage());//}returnflag;}}使用的是dwr2.0版本,使用3.0版本的时候能找到该类,但是其注入的dao类为空,不能获得其实例请高手指点,万分感谢!

解决方案

解决方案二:
<paramname="beanName"value="spring里面beanName"/>例如<createcreator="spring"javascript="JGetUserInfo"><paramname="beanName"value="userInfoBiz"/><includemethod="ixExits"/><!--修改--><includemethod="ixExitsN"/><!--注册--></create>
解决方案三:
缺少spring-webmvc-1.0.jar
解决方案四:
引用1楼weihui5368452的回复:

<paramname="beanName"value="spring里面beanName"/>例如<createcreator="spring"javascript="JGetUserInfo"><paramname="beanName"value="userInfoBiz"/><includemethod="ixExits"/><!--修改--><in……

这样改了之后提示:Classnotfound:tuanSiteManagerImpl,还是不行啊

时间: 2024-10-23 10:00:20

SSH整合dwr出现问题,的相关文章

dwr框架-后台框架SSH和DWR哪个更容易掌握

问题描述 后台框架SSH和DWR哪个更容易掌握 这学期课程要做一个项目,刚接触到后台框架这方面的知识,去网上搜了一下,看到大家说用的最多的是SSH和DWR,我也看了一些文档,都是一知半解的,想问一下大神,他们两个对于初学者哪个更容易掌握一点?这两个框架有什么联系和区别?哪个编码更容易一些?多谢 解决方案 SSH是三大框架的缩写(struts /spring /hibernate),主要是MVC模式的三种框架,是java-web常用的框架.简单.易用,学习起来也容易.本人接触的项目都是基于这三大框

SSH整合问题实现DAO接口出现的问题

问题描述 SSH整合问题实现DAO接口出现的问题 package com.integration.dao; import java.util.List; import com.integration.entity.User; import org.hibernate.Query; import org.springframework.orm.hibernate3.support.HibernateDaoSupport; public class UserDAOImpl extends Hiber

配置-求助,SSH整合后拦截器不起作用

问题描述 求助,SSH整合后拦截器不起作用 struts.xml配置如下 <interceptors> <interceptor name="loginInterceptor" class="com.music.interceptor.LoginInterceptor"></interceptor> <interceptor-stack name="globalInterceptor"> <i

exception-容器启动就报错,ssh整合

问题描述 容器启动就报错,ssh整合 严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListenerjava.lang.IllegalArgumentException at org.springframework.asm.ClassReader.(Unknown Source) at org.sp

SSH, 整合分页功能,连带DAO经典封装

任何一个封装讲究的是,使用,多状态. Action:     任何一个Action继承分页有关参数类PageManage,自然考虑的到分页效果,我们必须定义下几个分页的参数.并根据这个参数进行查值. 然后在继承ServiceManage,ServiceManage类是用来 存放共用的东西:response,重要的是Service的get set 具体讲一下PageManage,    totalPages;//总页数    totalRecord;//总记录数    showRecordNum=

exception-升级ssh整合出现错误java.lang.NoSuchMethodError:

问题描述 升级ssh整合出现错误java.lang.NoSuchMethodError: 下面是控制台打印的信息,麻烦看到的高手帮忙解决: Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [cn/com/hope/framework/spring/appl

ssh整合是时,使用日期插件把数据插入数据库是发生错误

问题描述 ssh整合是时,使用日期插件把数据插入数据库是发生错误 警告: SQL Error: 604, SQLState: 60000 2015-7-9 20:31:44 org.hibernate.util.JDBCExceptionReporter logExceptions 严重: ORA-00604: 递归 SQL 级别 1 出现错误 ORA-00942: 表或视图不存在 2015-7-9 20:31:44 org.hibernate.tool.hbm2ddl.SchemaUpdate

java-Java的框架SSH整合的项目,项目启动时总是会报一个莫名其妙的错误?

问题描述 Java的框架SSH整合的项目,项目启动时总是会报一个莫名其妙的错误? Unable to load configuration. - [unknown location] Caused by: Unable to load configuration. - [unknown location] Caused by: Unable to load jar:file:/D:/mars-workspace/.metadata/.plugins/org.eclipse.wst.server.

ssh整合-SSH整合时出现空指针问题

问题描述 SSH整合时出现空指针问题 最近在做实训,所以想尝试用SSH框架来做个项目,我跟着视频,一步一步的敲代码,一运行, 报空指针,好吧,看看是什么说,根据提示信息:是employeeService为null,可是我在 applicationContext-bean.xml的配置文件中已经注入了啊: 这下就难道我了,在网上搜索了快两天了,还是没有头绪,所以特来请教大神们,教教我呗: 项目我上传在: http://1185651333201311151844.iteye.com/admin/b