lzwn2003的gravatar头像
lzwn2003 2014-09-12 14:16:56

springmvc + mybatis-spring-1.2.2 启动报错

严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'baseMapperDaoImpl' defined in file [F:\Program Files\Apache Software Foundation\Tomcat 8.0\webapps\MyBatisForSpring\WEB-INF\classes\com\hoo\dao\impl\BaseMapperDaoImpl.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.hoo.dao.impl.BaseMapperDaoImpl]: No default constructor found; nested exception is java.lang.NoSuchMethodException: com.hoo.dao.impl.BaseMapperDaoImpl.<init>()
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:997)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:943)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:385)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:284)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4751)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5175)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.hoo.dao.impl.BaseMapperDaoImpl]: No default constructor found; nested exception is java.lang.NoSuchMethodException: com.hoo.dao.impl.BaseMapperDaoImpl.<init>()
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:72)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:990)
... 22 more
Caused by: java.lang.NoSuchMethodException: com.hoo.dao.impl.BaseMapperDaoImpl.<init>()
at java.lang.Class.getConstructor0(Class.java:3069)
at java.lang.Class.getDeclaredConstructor(Class.java:2165)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:67)
... 23 more

更多0

所有回答列表(5)
最代码官方的gravatar头像
最代码官方  LV167 2014年9月12日

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'baseMapperDaoImpl' defined in file [F:\Program Files\Apache Software Foundation\Tomcat 8.0\webapps\MyBatisForSpring\WEB-INF\classes\com\hoo\dao\impl\BaseMapperDaoImpl.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.hoo.dao.impl.BaseMapperDaoImpl]: No default constructor found; nested exception is java.lang.NoSuchMethodException: com.hoo.dao.impl.BaseMapperDaoImpl.<init>()

java.lang.NoSuchMethodException: com.hoo.dao.impl.BaseMapperDaoImpl.<init>()

spring bean初始化失败。

lzwn2003的gravatar头像
lzwn2003  LV8 2014年9月12日

查不出原因,可以发给代码给你,你帮看看,是哪里的问题么,新手!谢谢

Armys的gravatar头像
Armys  LV3 2014年9月12日

我可以看看,稍等啊!!!!!!!!

java学习者的gravatar头像
java学习者  LV7 2014年9月12日

看看xml文件里有没有配置关于这个com.hoo.dao.impl.BaseMapperDaoImpl的东西,没有这个方法

masque的gravatar头像
masque  LV16 2014年9月12日

laugh遇到类似这种异常,先去里面找自己定义的名字的文件是否出现问题

配置错误

 

顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友