Unable to instantiate class [com.mchange.v2.c3p0.ComboPooledDataSource] for object named 'dataSourc

最近学习shiro框架Subject认证结合MySQL,所遇到的bug:

[DEBUG] 2020-01-05 22:59:51 [org.apache.shiro.io.ResourceUtils.loadFromClassPath(ResourceUtils.java:159)] -> Opening resource from class path [config/jdbc_reaml.ini] [main] [chx]
[DEBUG] 2020-01-05 22:59:51 [org.apache.shiro.config.Ini.load(Ini.java:351)] -> Parsing [main] [main] [chx]
[DEBUG] 2020-01-05 22:59:51 [org.apache.shiro.config.IniFactorySupport.createInstance(IniFactorySupport.java:122)] -> Creating instance from Ini [sections=main] [main] [chx]
Exception in thread "main" org.apache.shiro.config.ConfigurationException: Unable to instantiate class [com.mchange.v2.c3p0.ComboPooledDataSource] for object named 'dataSource'.  Please ensure you've specified the fully qualified class name correctly.
	at org.apache.shiro.config.ReflectionBuilder.createNewInstance(ReflectionBuilder.java:309)
	at org.apache.shiro.config.ReflectionBuilder$InstantiationStatement.doExecute(ReflectionBuilder.java:927)
	at org.apache.shiro.config.ReflectionBuilder$Statement.execute(ReflectionBuilder.java:887)
	at org.apache.shiro.config.ReflectionBuilder$BeanConfigurationProcessor.execute(ReflectionBuilder.java:765)
	at org.apache.shiro.config.ReflectionBuilder.buildObjects(ReflectionBuilder.java:260)
	at org.apache.shiro.config.IniSecurityManagerFactory.buildInstances(IniSecurityManagerFactory.java:167)
	at org.apache.shiro.config.IniSecurityManagerFactory.createSecurityManager(IniSecurityManagerFactory.java:130)
	at org.apache.shiro.config.IniSecurityManagerFactory.createSecurityManager(IniSecurityManagerFactory.java:108)
	at org.apache.shiro.config.IniSecurityManagerFactory.createInstance(IniSecurityManagerFactory.java:94)
	at org.apache.shiro.config.IniSecurityManagerFactory.createInstance(IniSecurityManagerFactory.java:46)
	at org.apache.shiro.config.IniFactorySupport.createInstance(IniFactorySupport.java:123)
	at org.apache.shiro.util.AbstractFactory.getInstance(AbstractFactory.java:47)
	at com.cn.JdbcReamlTest.main(JdbcReamlTest.java:23)
Caused by: org.apache.shiro.util.UnknownClassException: Unable to load class named [com.mchange.v2.c3p0.ComboPooledDataSource] from the thread context, current, or system/application ClassLoaders.  All heuristics have been exhausted.  Class could not be found.
	at org.apache.shiro.util.ClassUtils.forName(ClassUtils.java:152)
	at org.apache.shiro.util.ClassUtils.newInstance(ClassUtils.java:168)
	at org.apache.shiro.config.ReflectionBuilder.createNewInstance(ReflectionBuilder.java:302)
	... 12 more``

引起错误的原因是没有在lib文件夹下面引入:c3p0-0.9.2.1.jar包。

c3p0-0.9.2.1.jar包下载地址

你可能感兴趣的:(常见异常,#,shiro异常)