• 欢迎访问开心洋葱网站,在线教程,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站,欢迎加入开心洋葱 QQ群
  • 为方便开心洋葱网用户,开心洋葱官网已经开启复制功能!
  • 欢迎访问开心洋葱网站,手机也能访问哦~欢迎加入开心洋葱多维思维学习平台 QQ群
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏开心洋葱吧~~~~~~~~~~~~~!
  • 由于近期流量激增,小站的ECS没能经的起亲们的访问,本站依然没有盈利,如果各位看如果觉着文字不错,还请看官给小站打个赏~~~~~~~~~~~~~!

jsp的SSH环境搭建出现Error creating bean with name ‘userService’ defined in ServletContext resource错误

JAVA相关 开心洋葱 2099次浏览 0个评论

jsp的SSH环境搭建出现Error creating bean with name 'userService' defined in ServletContext resource错误

HTTP Status 500 –

——————————————————————————–

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userService' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type [com.ssh.dao.impl.UserDAO] to required type [com.ssh.dao.IUserDAO] for property 'userDAO'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [com.ssh.dao.impl.UserDAO] to required type [com.ssh.dao.IUserDAO] for property 'userDAO': no matching editors or conversion strategy found
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:480)
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
 java.security.AccessController.doPrivileged(Native Method)
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
 org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
 org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
 org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
 org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
 org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
 org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
 org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
 org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
 org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
 org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
 org.springframework.web.context.ContextLoaderServlet.init(ContextLoaderServlet.java:81)
 javax.servlet.GenericServlet.init(GenericServlet.java:212)
 org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920)
 org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883)
 org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
 org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
 org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
 org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
 org.apache.catalina.startup.Catalina.start(Catalina.java:566)
 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 java.lang.reflect.Method.invoke(Method.java:597)
 org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
 org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)


root cause

org.springframework.beans.TypeMismatchException: Failed to convert property value of type [com.ssh.dao.impl.UserDAO] to required type [com.ssh.dao.IUserDAO] for property 'userDAO'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [com.ssh.dao.impl.UserDAO] to required type [com.ssh.dao.IUserDAO] for property 'userDAO': no matching editors or conversion strategy found
 org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:391)
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1289)
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1250)
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010)#p#分页标题#e#
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
 java.security.AccessController.doPrivileged(Native Method)
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
 org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
 org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
 org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
 org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
 org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
 org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
 org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
 org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
 org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
 org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
 org.springframework.web.context.ContextLoaderServlet.init(ContextLoaderServlet.java:81)
 javax.servlet.GenericServlet.init(GenericServlet.java:212)
 org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920)
 org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883)
 org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
 org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
 org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
 org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
 org.apache.catalina.startup.Catalina.start(Catalina.java:566)
 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 java.lang.reflect.Method.invoke(Method.java:597)
 org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
 org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)


root cause

java.lang.IllegalArgumentException: Cannot convert value of type [com.ssh.dao.impl.UserDAO] to required type [com.ssh.dao.IUserDAO] for property 'userDAO': no matching editors or conversion strategy found
 org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:231)
 org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:138)
 org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:386)
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1289)
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1250)
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010)
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
 java.security.AccessController.doPrivileged(Native Method)
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
 org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
 org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
 org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
 org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
 org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)#p#分页标题#e#
 org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
 org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
 org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
 org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
 org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
 org.springframework.web.context.ContextLoaderServlet.init(ContextLoaderServlet.java:81)
 javax.servlet.GenericServlet.init(GenericServlet.java:212)
 org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920)
 org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883)
 org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
 org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
 org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
 org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
 org.apache.catalina.startup.Catalina.start(Catalina.java:566)
 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 java.lang.reflect.Method.invoke(Method.java:597)
 org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
 org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)


note The full stack trace of the root cause is available in the Apache Tomcat/6.0.13 logs.


——————————————————————————–

Apache Tomcat/6.0.13

这个问题。他是由于Spring中的“asm-2.2.3.jar”和Hibernate中的“asm.jar”包冲突。解决办法是移除Spring2.0 AOP Libraries中的“asm-2.2.3.jar”即可。这里一定要删除asm-2.2.3.jar。留下asm.jar

但不知道怎么删除这个JAR包,如果是把这些文件复制到项目下,到哪里删除就可以了,但是如果不是复制过来的,就只能去运行服务器上删除了


开心洋葱 , 版权所有丨如未注明 , 均为原创丨未经授权请勿修改 , 转载请注明jsp的SSH环境搭建出现Error creating bean with name ‘userService’ defined in ServletContext resource错误
喜欢 (0)

您必须 登录 才能发表评论!

加载中……