Java异常大体分两类:RuntimeException,其他;注意:两类异常都是在程序运行期间出现!只不过后者必须在编译期间进行处理,一般是try catch或throw;程序期间出现了此类异常时会执行catch和finally语句。而RuntimeException不必明确指出处理方式,大概更底层的虚拟机里有处理过程吧(这个我瞎猜的)。
1,NoClassDefFoundError
首先可以肯定的一点是,这不是ClassNotFoundException;JDK文档对NoClassDefFoundError的描述是
Thrown if the Java Virtual Machine or a ClassLoader instance tries to load in the
definition of a class (as part of a normal method call or as part of creating a new
instance using the new expression) and no definition of the class could be found.
The searched-for class definition existed when the currently executing class was compiled,
but the definition can no longer be found.直接点就是编译通过了,但是运行时,JVM或者类加载器想要加载类却找不到这个类。
解决BeanCreationException的办法:百度了半天解决不了,Bing搜索一下就出来了。以前只是听说Bing好用,今天算是体会到了。
2java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
缺少commons-logging.jar包
NoClassDefFoundError: org/apache/commons/httpclient/HttpMethod
原因:缺少commons-httpclient-3.0.jar
3、Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.Log
原因:缺少commons-logging.jar包
四月 02, 2017 12:33:51 下午 org.apache.tomcat.util.digester.SetPropertiesRule begin 警告: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:YSDelivery' did not find a matching property. 四月 02, 2017 12:33:51 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Server version: Apache Tomcat/9.0.0.M17 四月 02, 2017 12:33:51 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Server built: Jan 10 2017 20:59:20 UTC 四月 02, 2017 12:33:51 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Server number: 9.0.0.0 四月 02, 2017 12:33:51 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: OS Name: Windows 8 四月 02, 2017 12:33:51 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: OS Version: 6.2 四月 02, 2017 12:33:51 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Architecture: amd64 四月 02, 2017 12:33:51 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Java Home: C:Program FilesJavajre1.8.0_121 四月 02, 2017 12:33:51 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: JVM Version: 1.8.0_121-b13 四月 02, 2017 12:33:51 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: JVM Vendor: Oracle Corporation 四月 02, 2017 12:33:51 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: CATALINA_BASE: E:CodingIDEServerapache-tomcat-9.0.0.M17 四月 02, 2017 12:33:51 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: CATALINA_HOME: E:CodingIDEServerapache-tomcat-9.0.0.M17 四月 02, 2017 12:33:51 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Command line argument: -Dcatalina.base=E:CodingIDEServerapache-tomcat-9.0.0.M17 四月 02, 2017 12:33:51 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Command line argument: -Dcatalina.home=E:CodingIDEServerapache-tomcat-9.0.0.M17 四月 02, 2017 12:33:51 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Command line argument: -Dwtp.deploy=E:CodingIDEServerapache-tomcat-9.0.0.M17wtpwebapps 四月 02, 2017 12:33:51 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Command line argument: -Djava.endorsed.dirs=E:CodingIDEServerapache-tomcat-9.0.0.M17endorsed 四月 02, 2017 12:33:51 下午 org.apache.catalina.startup.VersionLoggerListener log 信息: Command line argument: -Dfile.encoding=GBK 四月 02, 2017 12:33:51 下午 org.apache.catalina.core.AprLifecycleListener lifecycleEvent 信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:Program FilesJavajre1.8.0_121in;C:WindowsSunJavain;C:Windowssystem32;C:Windows;C:/Program Files/Java/jre1.8.0_121/bin/server;C:/Program Files/Java/jre1.8.0_121/bin;C:/Program Files/Java/jre1.8.0_121/lib/amd64;E:CodingIDEPython36Scripts;E:CodingIDEPython36;E:CodingIDEDataBaseoraclexeapporacleproduct11.2.0serverin;;C:ProgramDataOracleJavajavapath;C:Windowssystem32;C:Windows;C:WindowsSystem32Wbem;C:WindowsSystem32WindowsPowerShellv1.0;C:Program FilesJavajdk1.8.0_121in;C:Program FilesJavajdk1.8.0_121jrein;E:CodingIDEDataBasemysql-5.7.17-winx64in;E:CodingIDE ode-v6.10.1-win-x64;E:CodingIDEeclipse-jee-neon-3-RC3-win32-x86_64eclipse;;. 四月 02, 2017 12:33:51 下午 org.apache.coyote.AbstractProtocol init 信息: Initializing ProtocolHandler ["http-nio-8080"] 四月 02, 2017 12:33:52 下午 org.apache.tomcat.util.net.NioSelectorPool getSharedSelector 信息: Using a shared selector for servlet write/read 四月 02, 2017 12:33:52 下午 org.apache.coyote.AbstractProtocol init 信息: Initializing ProtocolHandler ["ajp-nio-8009"] 四月 02, 2017 12:33:52 下午 org.apache.tomcat.util.net.NioSelectorPool getSharedSelector 信息: Using a shared selector for servlet write/read 四月 02, 2017 12:33:52 下午 org.apache.catalina.startup.Catalina load 信息: Initialization processed in 1084 ms 四月 02, 2017 12:33:52 下午 org.apache.catalina.core.StandardService startInternal 信息: Starting service Catalina 四月 02, 2017 12:33:52 下午 org.apache.catalina.core.StandardEngine startInternal 信息: Starting Servlet Engine: Apache Tomcat/9.0.0.M17 四月 02, 2017 12:33:54 下午 org.apache.catalina.core.ContainerBase startInternal 严重: A child container failed during start java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/YSDelivery]] at java.util.concurrent.FutureTask.report(Unknown Source) at java.util.concurrent.FutureTask.get(Unknown Source) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:939) at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:872) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/YSDelivery]] at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:441) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:198) ... 6 more Caused by: java.lang.NoClassDefFoundError: Lorg/apache/commons/logging/Log; at java.lang.Class.getDeclaredFields0(Native Method) at java.lang.Class.privateGetDeclaredFields(Unknown Source) at java.lang.Class.getDeclaredFields(Unknown Source) at org.apache.catalina.util.Introspection.getDeclaredFields(Introspection.java:110) at org.apache.catalina.startup.WebAnnotationSet.loadFieldsAnnotation(WebAnnotationSet.java:262) at org.apache.catalina.startup.WebAnnotationSet.loadApplicationServletAnnotations(WebAnnotationSet.java:136) at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:66) at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:328) at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:778) at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:299) at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5077) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ... 6 more Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.Log at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1275) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1109) ... 19 more 四月 02, 2017 12:33:54 下午 org.apache.catalina.core.ContainerBase startInternal 严重: A child container failed during start java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: A child container failed during start at java.util.concurrent.FutureTask.report(Unknown Source) at java.util.concurrent.FutureTask.get(Unknown Source) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:939) at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.core.StandardService.startInternal(StandardService.java:422) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:793) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.startup.Catalina.start(Catalina.java:655) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:355) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:495) Caused by: org.apache.catalina.LifecycleException: A child container failed during start at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:948) at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:872) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) 四月 02, 2017 12:33:54 下午 org.apache.catalina.startup.Catalina start 严重: The required Server component failed to start so Tomcat is unable to start. org.apache.catalina.LifecycleException: A child container failed during start at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:948) at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.core.StandardService.startInternal(StandardService.java:422) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:793) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) at org.apache.catalina.startup.Catalina.start(Catalina.java:655) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:355) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:495) 四月 02, 2017 12:33:54 下午 org.apache.coyote.AbstractProtocol pause 信息: Pausing ProtocolHandler ["http-nio-8080"] 四月 02, 2017 12:33:54 下午 org.apache.coyote.AbstractProtocol pause 信息: Pausing ProtocolHandler ["ajp-nio-8009"] 四月 02, 2017 12:33:54 下午 org.apache.catalina.core.StandardService stopInternal 信息: Stopping service Catalina 四月 02, 2017 12:33:54 下午 org.apache.coyote.AbstractProtocol destroy 信息: Destroying ProtocolHandler ["http-nio-8080"] 四月 02, 2017 12:33:54 下午 org.apache.coyote.AbstractProtocol destroy 信息: Destroying ProtocolHandler ["ajp-nio-8009"]
、