日期:2014-05-20  浏览次数:20793 次

谁解决,本人愿意奉上1000分:ssh2整合的项目中,我只要一旦往数据库进行操作,就会报出这个异常问题
谁解决,本人愿意奉上1000分,绝不食言!
ssh2整合项目:
我只要一旦往数据库进行操作,就会报出这个异常问题
我是专门试过了的,后来我只是执行了一条grant语句(我先前直接到mysql中执行了一下,是正常的),但是在我程序中执行这条sql语句时,就报错了

我估计是三个框架之间整合 问题导致的。

异常提示中说的很模糊,问题根源很难定位,只知道是执行了数据库操作就会报出这个异常。

DefaultListableBeanFactory - No bean named 'org.apache.struts2.dispatcher.ServletDispatcherResult' found in org.springframework.beans.factory.support.DefaultListableBeanFactory@1594ba3: defining beans [user,project,projectDAO,usersDAO,addProjectService,loginService,registerService,login,register,add
Project,sessionFactory]; root of factory hierarchy

DefaultListableBeanFactory - Ignoring constructor [public org.apache.struts2.dispatcher.ServletDispatcherResult(java.lang.String)] of bean 'org.apache.struts2.dispatcher.ServletDispatcherResult': org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.apache.struts2.dispatcher.ServletDispatcherResult': Unsatisfied dependency expressed through constructor argument with index 0 of type [java.lang.String]: : No unique bean of type [java.lang.String] is defined: Unsatisfied dependency of type [class java.lang.String]: expected at least 1 matching bean; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [java.lang.String] is defined: Unsatisfied dependency of type [class java.lang.String]: expected at least 1 matching bean
CachedIntrospectionResults - Getting BeanInfo for class [org.apache.struts2.dispatcher.ServletDispat
cherResult]
CachedIntrospectionResults - Caching PropertyDescriptors for class [org.apache.struts2.dispatcher.Se
rvletDispatcherResult]

------解决方案--------------------
把struts2去掉,直接用junit测试spring层,看是否出错
mark,明天再看
------解决方案--------------------
你的项目中有没有spring.jar? 估计是缺少某个包引起的
------解决方案--------------------
或者在Spring 中ACTION 设置为 singleton="false" 或者 scope="prototype",
------解决方案--------------------
LZ struts2的包加全没 ?xwork ognl 等也都是必须的
------解决方案--------------------
debug一下 action ,dao看下具体哪一句出了错误
看异常好像没有找到 那个bean的定义
看看struts.xml中各个属性有没有写错
------解决方案--------------------

------解决方案--------------------
贴一下struts2和spring的配置文件,struts2的代码吧
------解决方案--------------------
mark,关注千元大奖花落谁家?
------解决方案--------------------
No bean named 'org.apache.struts2.dispatcher.ServletDispatcherResult'

感觉是配置文件有问题呢
------解决方案--------------------
探讨
mark,关注千元大奖花落谁家?

------解决方案--------------------
<listener>
<listener-class>
org.springframework.web.context.request.RequestContextListener
</listener-class>
</listener>

<listener>
<listener-class>
org.springframework.web.util.IntrospectorCleanupListener
</listener-class>
</listener>
------解决方案--------------------
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>