Could not load resource factory class [Root exception is java.lang.ClassNotFoundException: org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory]

 1 WARNING: Failed to register in JMX: javax.naming.NamingException: Could not load resource factory class [Root exception is java.lang.ClassNotFoundException: org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory]
 2 十二月 24, 2015 10:43:49 下午 org.apache.catalina.mbeans.GlobalResourcesLifecycleListener createMBeans
 3 SEVERE: Exception processing Global JNDI Resources
 4 javax.naming.NamingException: Could not load resource factory class [Root exception is java.lang.ClassNotFoundException: org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory]
 5 at org.apache.naming.factory.FactoryBase.getObjectInstance(FactoryBase.java:66)
 6 at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321)
 7 at org.apache.naming.NamingContext.lookup(NamingContext.java:841)
 8 at org.apache.naming.NamingContext.lookup(NamingContext.java:152)
 9 at org.apache.naming.NamingContextBindingsEnumeration.nextElementInternal(NamingContextBindingsEnumeration.java:117)
10 at org.apache.naming.NamingContextBindingsEnumeration.next(NamingContextBindingsEnumeration.java:71)
11 at org.apache.naming.NamingContextBindingsEnumeration.next(NamingContextBindingsEnumeration.java:34)
12 at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:138)
13 at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:145)
14 at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:110)
15 at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.lifecycleEvent(GlobalResourcesLifecycleListener.java:82)
16 at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
17 at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
18 at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:402)
19 at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:347)
20 at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:762)
21 at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
22 at org.apache.catalina.startup.Catalina.start(Catalina.java:625)
23 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
24 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
25 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
26 at java.lang.reflect.Method.invoke(Method.java:601)
27 at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:351)
28 at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:485)
29 Caused by: java.lang.ClassNotFoundException: org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory
30 at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
31 at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
32 at java.security.AccessController.doPrivileged(Native Method)
33 at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
34 at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
35 at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
36 at org.apache.naming.factory.FactoryBase.getObjectInstance(FactoryBase.java:61)
37 ... 23 more

1.警告: Failed to register in JMX: javax.naming.NamingException: Could not load resource factory class [Root exception is java.lang.ClassNotFoundException: org.apache.commons.dbcp.BasicDataSourceFactory]
  
2.Caused by: java.lang.NoClassDefFoundError: org/apache/commons/pool/impl/GenericObjectPool
  我今天遇到这个错误了,不过在网上终于找到了答案,主要是一个包没有导入进去,除了需要commons-dbcp.jar之外还需要commons-pool.jar这个包,把后面这个commons-pool.jar包导入tomcat的安装路径的lib下进去就应该行了。
  总结:凡是看到ClassNotFoundException、NoClassDefFoundError等之类的,基本都是缺少什么包的,把相应的包导进去就行了。

posted @ 2015-12-24 22:50  ngulc  阅读(10000)  评论(0编辑  收藏  举报