Spring整合mybatis错误:-Cannot find class [org.apache.commons.dbcp.BasicDataSource]

版权声明:Copyright by TalNot https://blog.csdn.net/hyf_home/article/details/81591822

1、

 这个错误最主要应该看最下面,会显示-Cannot find class [org.apache.commons.dbcp.BasicDataSource],

最大得可能是少包:最少有commons.dbcp  ,     commons.pools,   外加mysql的:mysql-connector-java.bin包,才可以保证mybatis和数据库的连接

阅读更多

扫码向博主提问

talNot

非学,无以致疑;非问,无以广识
去开通我的Chat快问

Cannot find class [org.springframework.scheduling.timer.ScheduledTimerTask] for

05-13

2014-5-13 12:06:38 org.springframework.context.support.AbstractApplicationContext prepareRefreshrn信息: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@5ffb18: startup date [Tue May 13 12:06:38 CST 2014]; root of context hierarchyrn2014-5-13 12:06:38 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitionsrn信息: Loading XML bean definitions from class path resource [beans.xml]rnException in thread "main" org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.springframework.scheduling.timer.ScheduledTimerTask] for bean with name 'scheduledTimerTask' defined in class path resource [beans.xml]; nested exception is java.lang.ClassNotFoundException: org.springframework.scheduling.timer.ScheduledTimerTaskrn at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1327)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:594)rn at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1396)rn at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:959)rn at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:683)rn at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:760)rn at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)rn at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:139)rn at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:83)rn at com.lyy.test.mask1.main(mask1.java:15)rnCaused by: java.lang.ClassNotFoundException: org.springframework.scheduling.timer.ScheduledTimerTaskrn at java.net.URLClassLoader$1.run(URLClassLoader.java:200)rn at java.security.AccessController.doPrivileged(Native Method)rn at java.net.URLClassLoader.findClass(URLClassLoader.java:188)rn at java.lang.ClassLoader.loadClass(ClassLoader.java:306)rn at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)rn at java.lang.ClassLoader.loadClass(ClassLoader.java:251)rn at org.springframework.util.ClassUtils.forName(ClassUtils.java:236)rn at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:392)rn at org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass(AbstractBeanFactory.java:1348)rn at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1319)rn ... 9 morernrnrn[code=text]rnrnrn rn rn rnrn rn rn rn rn rn rnrn rnrn rn rn rn rn rnrnrnrnrn[/code]rnrn为什么了 已经把所有的spring 都引了还是不行

Cannot find class [org.springframework.jdbc.datasource.DriverManagerDataSource]

11-20

2009-11-20 12:19:33 org.springframework.context.support.AbstractApplicationContext prepareRefreshrn信息: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@18558d2: display name [org.springframework.context.support.ClassPathXmlApplicationContext@18558d2]; startup date [Fri Nov 20 12:19:33 CST 2009]; root of context hierarchyrn2009-11-20 12:19:34 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitionsrn信息: Loading XML bean definitions from class path resource [spring/chapter4/dao/game.xml]rn2009-11-20 12:19:34 org.springframework.context.support.AbstractApplicationContext obtainFreshBeanFactoryrn信息: Bean factory for application context [org.springframework.context.support.ClassPathXmlApplicationContext@18558d2]: org.springframework.beans.factory.support.DefaultListableBeanFactory@a8c488rn2009-11-20 12:19:34 org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletonsrn信息: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@a8c488: defining beans [dataSource,userDao]; root of factory hierarchyrn2009-11-20 12:19:34 org.springframework.beans.factory.support.DefaultSingletonBeanRegistry destroySingletonsrn信息: Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@a8c488: defining beans [dataSource,userDao]; root of factory hierarchyrnException in thread "main" org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.springframework.jdbc.datasource.DriverManagerDataSource] for bean with name 'dataSource' defined in class path resource [spring/chapter4/dao/game.xml]; nested exception is java.lang.ClassNotFoundException: org.springframework.jdbc.datasource.DriverManagerDataSourcern at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1141)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:524)rn at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1177)rn at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:758)rn at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:422)rn at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)rn at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)rn at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:139)rn at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:83)rn at spring.chapter4.dao.TestUserDAO.main(TestUserDAO.java:8)rnCaused by: java.lang.ClassNotFoundException: org.springframework.jdbc.datasource.DriverManagerDataSourcern at java.net.URLClassLoader$1.run(Unknown Source)rn at java.security.AccessController.doPrivileged(Native Method)rn at java.net.URLClassLoader.findClass(Unknown Source)rn at java.lang.ClassLoader.loadClass(Unknown Source)rn at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)rn at java.lang.ClassLoader.loadClass(Unknown Source)rn at org.springframework.util.ClassUtils.forName(ClassUtils.java:211)rn at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:385)rn at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1138)rn ... 9 morern看配置文件都没错的啊,该怎么解决~

Cannot find class [com.fh.interceptor.shiro.ShiroRealm]

05-21

我在编译项目时,总是报错:rn017-05-21 21:49:55 -955 [localhost-startStop-1] INFO - Bean 'org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#0' of type [class org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)rn2017-05-21 21:49:56 -1112 [localhost-startStop-1] ERROR - Context initialization failedrnorg.springframework.beans.factory.BeanCreationException: Error creating bean with name 'shiroFilter' defined in class path resource [spring/ApplicationContext.xml]: Cannot resolve reference to bean 'securityManager' while setting bean property 'securityManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'securityManager' defined in class path resource [spring/ApplicationContext.xml]: Cannot resolve reference to bean 'ShiroRealm' while setting bean property 'realm'; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [com.fh.interceptor.shiro.ShiroRealm] for bean with name 'ShiroRealm' defined in class path resource [spring/ApplicationContext.xml]; nested exception is java.lang.ClassNotFoundException: com.fh.interceptor.shiro.ShiroRealmrnrn大概就是说没有找到com.fh.interceptor.shiro.ShiroRealm这个类,可是这个类明明是在src里有的呀rn[img=http://img.bbs.csdn.net/upload/201705/21/1495374843_428196.png][/img]

没有更多推荐了,返回首页