1. 程式人生 > >Maven--java.lang.NoClassDefFoundError: org/codehaus/plexus/compiler/util/scan/InclusionScanException

Maven--java.lang.NoClassDefFoundError: org/codehaus/plexus/compiler/util/scan/InclusionScanException

maven報錯 java.lang.NoClassDefFoundError: org/codehaus/plexus/compiler/util/scan/InclusionScanException
問題的解決方案會在文章的中間給出,請一步一步閱讀。

Maven是一個非常強大的構建工具,能夠幫助我們自動化構建過程,從清理、編譯、測試到生成報告,再到打包和部署,Maven都可以。

Maven對於專案目錄結構、測試用例命名方法等內容有既定的規則,只要遵循這些規則,使用者在專案間切換的時候就免去了額外學習的成本,也就是約定優於配置(Convention Over Configuration)。

第一個Maven專案

建立

採用IDEA

File -> New -> Project

這裡寫圖片描述

選擇Maven(不要勾選Create from archetype)

這裡寫圖片描述

填寫Maven的三座標(GroupId,ArtifactId、Version)

這裡寫圖片描述

SNAPSHOT是快照的意思,說明該專案處於開發中,是不穩定的版本,隨著專案的發展,Version會不斷更新,如升級為1.0,1.1-SNAPSHOT,1.1,2.0等。

填寫Project name和專案儲存的路徑

這裡寫圖片描述

完成之後生成的專案骨架

這裡寫圖片描述

Maven的約定

pom.xml在專案的根目錄下

假設該目錄為${proj-dir},那麼Maven有以下假設:

${proj-dir}/src/main/java —— 存放專案的.java檔案。
${proj-dir}/src/main/resources —— 存放專案資原始檔,如spring, hibernate,log4j等配置檔案。
${proj-dir}/src/test/jave —— 存放所有測試.java檔案,如JUnit測試類。以*Test.java命名
${proj-dir}/src/test/resources —— 測試資原始檔。
${proj-dir}/target —— 專案輸出位置。

專案的路徑

這裡寫圖片描述

編寫簡單的helloworld

這裡寫圖片描述

該Hello類所在的報名要與GroupId、ArtifactId相吻合。

引入Junit依賴,在pom.xml中

這裡寫圖片描述

編寫測試用例

這裡寫圖片描述

採用Maven來構建專案

用Maven來執行測試用例

這裡寫圖片描述

執行會報錯

C:\Java\jdk1.7.0_21\bin\java -Dmaven.multiModuleProjectDirectory=C:\Users\GWCheng\IdeaProjects\maven-hello -Dmaven.home=D:\servers\apache-maven-3.3.9 -Dclassworlds.conf=D:\servers\apache-maven-3.3.9\bin\m2.conf -Didea.launcher.port=7532 "-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA 15.0.4\bin" -Dfile.encoding=UTF-8 -classpath "D:\servers\apache-maven-3.3.9\boot\plexus-classworlds-2.5.2.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 15.0.4\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain org.codehaus.classworlds.Launcher -Didea.version=15.0.4 -s E:\JavaLibrary\.m2\settings.xml test
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building maven-hello 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for org.apache.maven.plugins:maven-compiler-plugin:jar:3.1 is missing, no dependency information available
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ maven-hello ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ maven-hello ---
[WARNING] The POM for org.apache.maven.plugins:maven-compiler-plugin:jar:3.1 is missing, no dependency information available
[WARNING] Error injecting: org.apache.maven.plugin.compiler.CompilerMojo
java.lang.NoClassDefFoundError: org/codehaus/plexus/compiler/util/scan/InclusionScanException
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2413)
    at java.lang.Class.getDeclaredConstructors(Class.java:1855)
    at com.google.inject.spi.InjectionPoint.forConstructorOf(InjectionPoint.java:245)
    at com.google.inject.internal.ConstructorBindingImpl.create(ConstructorBindingImpl.java:99)
    at com.google.inject.internal.InjectorImpl.createUninitializedBinding(InjectorImpl.java:658)
    at com.google.inject.internal.InjectorImpl.createJustInTimeBinding(InjectorImpl.java:882)
    at com.google.inject.internal.InjectorImpl.createJustInTimeBindingRecursive(InjectorImpl.java:805)
    at com.google.inject.internal.InjectorImpl.getJustInTimeBinding(InjectorImpl.java:282)
    at com.google.inject.internal.InjectorImpl.getBindingOrThrow(InjectorImpl.java:214)
    at com.google.inject.internal.InjectorImpl.getProviderOrThrow(InjectorImpl.java:1006)
    at com.google.inject.internal.InjectorImpl.getProvider(InjectorImpl.java:1038)
    at com.google.inject.internal.InjectorImpl.getProvider(InjectorImpl.java:1001)
    at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1051)
    at org.eclipse.sisu.space.AbstractDeferredClass.get(AbstractDeferredClass.java:48)
    at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:81)
    at com.google.inject.internal.InternalFactoryToInitializableAdapter.provision(InternalFactoryToInitializableAdapter.java:53)
    at com.google.inject.internal.ProviderInternalFactory$1.call(ProviderInternalFactory.java:65)
    at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:115)
    at org.eclipse.sisu.bean.BeanScheduler$Activator.onProvision(BeanScheduler.java:176)
    at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:126)
    at com.google.inject.internal.ProvisionListenerStackCallback.provision(ProvisionListenerStackCallback.java:68)
    at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:63)
    at com.google.inject.internal.InternalFactoryToInitializableAdapter.get(InternalFactoryToInitializableAdapter.java:45)
    at com.google.inject.internal.InjectorImpl$2$1.call(InjectorImpl.java:1016)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1092)
    at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1012)
    at org.eclipse.sisu.inject.Guice4$1.get(Guice4.java:162)
    at org.eclipse.sisu.inject.LazyBeanEntry.getValue(LazyBeanEntry.java:81)
    at org.eclipse.sisu.plexus.LazyPlexusBean.getValue(LazyPlexusBean.java:51)
    at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:263)
    at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:255)
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo(DefaultMavenPluginManager.java:517)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:121)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
    at org.codehaus.classworlds.Launcher.main(Launcher.java:47)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
Caused by: java.lang.ClassNotFoundException: org.codehaus.plexus.compiler.util.scan.InclusionScanException
    at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
    ... 61 more
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 22.637 s
[INFO] Finished at: 2016-03-24T13:34:34+08:00
[INFO] Final Memory: 6M/90M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project maven-hello: Execution default-compile of goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile failed: A required class was missing while executing org.apache.maven.plugins:maven-compiler-plugin:3.1:compile: org/codehaus/plexus/compiler/util/scan/InclusionScanException
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>org.apache.maven.plugins:maven-compiler-plugin:3.1
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/E:/JavaLibrary/.m2/repository/org/apache/maven/plugins/maven-compiler-plugin/3.1/maven-compiler-plugin-3.1.jar
[ERROR] urls[1] = file:/E:/JavaLibrary/.m2/repository/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]]
[ERROR] 
[ERROR] -----------------------------------------------------: org.codehaus.plexus.compiler.util.scan.InclusionScanException
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException

Process finished with exit code 1

定位到錯誤發生的地方

[WARNING] Error injecting: org.apache.maven.plugin.compiler.CompilerMojo
java.lang.NoClassDefFoundError: org/codehaus/plexus/compiler/util/scan/InclusionScanException

意思是說注入org.apache.maven.plugin.compiler.CompilerMojo的時候找不到org/codehaus/plexus/compiler/util/scan/InclusionScanException

我找了半天在InfoQ上找到了合理的解釋

Maven官方有兩個外掛列表,第一個列表的GroupId為org.apache.maven.plugins,這裡的外掛最為成熟,具體地址為:http://maven.apache.org/plugins/index.html。第二個列表的GroupId為org.codehaus.mojo,這裡的外掛沒有那麼核心,但也有不少十分有用,其地址為:http://mojo.codehaus.org/plugins.html

InfoQ的連線

從InfoQ的解釋和報錯資訊來看,是我們的maven在編譯時採用的外掛沒找到

去maven官網的編譯外掛瞅瞅

發現了一個重要資訊

這裡寫圖片描述

在Usage中我們去訪問plugin’s wiki page 我們發現

這裡寫圖片描述

這就是錯誤的根本原因,原來codehaus不可用了

這裡寫圖片描述

順著它給的思路去配置maven,這個感興趣的讀者可以試一下,我試了,不起作用,還有一點我用eclipse是可以執行了,可能eclipse預設採用org.apache.maven.plugins外掛,而IDEA採用org.codehaus.mojo吧,我也想不明白?既然是maven的配置檔案配置的,IDE工具只是負責載入,為什麼會不一樣呢?

不想那麼多了,還是看看怎麼解決吧

進入usage頁面

這裡寫圖片描述

發現瞭解決方案

    <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-compiler-plugin</artifactId>
              <version>3.5.1</version>
              <configuration>
                <!-- put your configurations here -->
              </configuration>
            </plugin>
          </plugins>
       </pluginManagement>
  </build>

按照各個配置一下pom.xml

我的配置如下,將下面的程式碼放在dependencies之後

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.5.1</version>
                    <configuration>
                        <!-- put your configurations here -->
                        <source>1.7</source>
                        <target>1.7</target>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

我們再次執行上面的test命令

結果如下

C:\Java\jdk1.7.0_21\bin\java -Dmaven.multiModuleProjectDirectory=C:\Users\GWCheng\IdeaProjects\maven-hello -Dmaven.home=D:\servers\apache-maven-3.3.9 -Dclassworlds.conf=D:\servers\apache-maven-3.3.9\bin\m2.conf -Didea.launcher.port=7534 "-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA 15.0.4\bin" -Dfile.encoding=UTF-8 -classpath "D:\servers\apache-maven-3.3.9\boot\plexus-classworlds-2.5.2.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 15.0.4\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain org.codehaus.classworlds.Launcher -Didea.version=15.0.4 -s E:\JavaLibrary\.m2\settings.xml test
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building maven-hello 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ maven-hello ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.5.1:compile (default-compile) @ maven-hello ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 1 source file to C:\Users\GWCheng\IdeaProjects\maven-hello\target\classes
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ maven-hello ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\Users\GWCheng\IdeaProjects\maven-hello\src\test\resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.5.1:testCompile (default-testCompile) @ maven-hello ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 1 source file to C:\Users\GWCheng\IdeaProjects\maven-hello\target\test-classes
[INFO] 
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ maven-hello ---
[INFO] Surefire report directory: C:\Users\GWCheng\IdeaProjects\maven-hello\target\surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running com.gwc.mavenlearn.hello.HelloTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.063 sec

Results :

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 36.692 s
[INFO] Finished at: 2016-03-24T15:28:58+08:00
[INFO] Final Memory: 14M/114M
[INFO] ------------------------------------------------------------------------

Process finished with exit code 0

從輸出可以看出命令執行完成,測試用例也順利運行了,而且專案中還多了一個target資料夾

這裡寫圖片描述

這就是maven為我們做的,它會用我們剛才配置的那個外掛編譯我們的程式碼

[INFO] Compiling 1 source file to C:\Users\GWCheng\IdeaProjects\maven-hello\target\test-classes

然後幫我們執行了測試用例

[INFO] 
[INFO] --- maven-compiler-plugin:3.5.1:testCompile (default-testCompile) @ maven-hello ---

這就是Maven的強大之處,只要我們遵循Maven的約定,它就能自動地執行清理、編譯、測試到生成報告,再到打包和部署。

我們package

這裡寫圖片描述

Maven會幫我們把專案打包

這裡寫圖片描述

命名規則是ArtifactId-Version.jar命名的。

參考文獻

許曉斌. Maven實戰[M]. 機械工業出版社, 2011.

一篇部落格

相關推薦

Maven--java.lang.NoClassDefFoundError: org/codehaus/plexus/compiler/util/scan/InclusionScanException

maven報錯 java.lang.NoClassDefFoundError: org/codehaus/plexus/compiler/util/scan/InclusionScanException 問題的解決方案會在文章的中間給出,請一步一步閱讀。 M

java.lang.NoClassDefFoundError: org/codehaus/plexus/compiler/manager/NoSuchCompilerException

樓主環境 jdk1.8 tomcat7.0.9 maven 3.5.4 maven compile package install專案報錯 檢視網上的各種帖子 部落格 有說pom中這

maven java.lang.NoClassDefFoundError: org/codehaus/plexus/util/cli/CommandLineException

 建立maven專案後,clean install,報錯: [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ mavenTest --- [WARNING] Error injecting: o

java.lang.NoClassDefFoundError: org/codehaus/jackson/map/ObjectMapper

錯誤詳情: 嚴重: Servlet.service() for servlet [springmvc] in context with path [/SpringMVCTest] threw exception [Handler processing failed; nested excep

hadoop解決Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/yarn/util/Apps

linux+eclipse+本地執行WordCount丟擲下面異常: Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/yarn/util/Apps。 解決:沒有把yar

Maven專案中出現java.lang.NoClassDefFoundError: org/apache/commons/fileupload/FileItemFactory異常的解決方案!

前幾天專案出現的問題: 啟動專案時一直報異常資訊:        java.lang.NoClassDefFoundError:org/apache/commons/fileupload/FileItemFactory.

Tomcat啟動Maven專案異常:java.lang.NoClassDefFoundError: org/springframework/context/ApplicationContext

    最近從拿出以前的專案來看的時候,忽然出現一個奇怪的問題,那就是無法啟動了總是蹦出:Server Tomcat v7.0 Server at localhost failed to start 然後就以為是Tomcat的問題,一直圍著Tomcat轉,卻一直找不到真正問題所在。

MAVEN Error: java.lang.NoClassDefFoundError: org/aspectj/weaver/reflect/ReflectionWorld$ReflectionWo

MyEclipse2015+Maven3錯誤: 嚴重: Exception sending context initialized event to listener instance of class org.springframework.web.context.Con

Maven: NoClassDefFoundError: org/codehaus/plexus/classworlds/launcher/Launcher

    想在mac本上把程式程式碼也checkout下來。本來先裝的maven 3,但是同步過幾次後出現了問題,因為maven3和maven2的配置檔案要求好像有些不同,遂想重新裝maven2。     安裝maven時,因為只是需要將maven的包解壓縮後放到相應的位置,

巧建Spring Web的Maven專案來解決java.lang.NoClassDefFoundError: org/apache/commons/fileupload/FileItemFactory

有很多同學都會遇到下面這種錯誤 java.lang.NoClassDefFoundError: org/apache/commons/fileupload/FileItemFactory 這個錯

mybatis + log4j2 問題 java.lang.NoClassDefFoundError: org/apache/logging/log4j/spi/AbstractLoggerWrapper

logger nbsp 比較 mybatis oot log ogg bst modified root cause java.lang.NoClassDefFoundError: org/apache/logging/log4j/spi/AbstractLoggerWra

java.lang.NoClassDefFoundError: org/apache/commons/lang3/StringUtils

apache con ont test oca action error esp iat 1.java.lang.NoClassDefFoundError: org/apache/commons/lang3/StringUtils 缺少類 2. There is no Ac

java.lang.NoClassDefFoundError: org/apache/zookeeper/Watcher$Event$KeeperState

create col cycle eve apach sport fig depend frame 七月 29, 2017 10:51:00 上午 org.apache.catalina.core.StandardContext listenerStart嚴重: Excep

Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/boot/context/embedded/ServletRegistrationBean

cau type main ebean url nag jar except found 異常信息 2017-09-02 18:06:37.223 [main] ERROR o.s.boot.SpringApplication - Application startup

java.lang.NoClassDefFoundError: org/apache/ibatis/cursor/Cursor

error: cursor net sde 鏈接 版本 解決方法 pri batis 因為mybatis的版本和mybatis-spring的版本不兼容導致的,解決方法:mybatis的3.4.0及以上版本用mybatis-spring1.3.0及以上版本;mybatis的

java.lang.NoClassDefFoundError: org/apache/jsp/Index_jsp

internal col erl jsp catalina log pre under .class 今天在啟動Tomcat 後發現出現了這個錯誤 嚴重: Servlet.service() for servlet jsp threw exception j

java.lang.NoClassDefFoundError: org/junit/runner/manipulation/Filter

就是 bsp intercept ssi != stack ktr tex ins   今天想寫個隨筆,最近經常遇到使用junit的時候報java.lang.NoClassDefFoundError,今天算是恍然大悟了,原來junit雖然在gradle裏面配置了,也在Pro

maven Java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet

image web工程 添加 user isp 如果 img exc spring 如果你可以確認你的maven Dependencies中已經導入了如下的jar包,那麽你就要檢查下Deployment Assembly 選中項目 alt+enter,然後查看maven依

java.lang.NoClassDefFoundError: org/apache/commons/fileupload/FileUploadException

IDEA也沒提示錯誤,但是跑單元測試的時候報錯 加入以下依賴正常 > <groupId>commons-fileupload</groupId> > <artifactId>common

@EnableAspectJAutoProxy:java.lang.NoClassDefFoundError: org/aspectj/lang/annotation/Pointcut

@EnableAspectJAutoProxy註解版本不相容出現的異常 org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘org.springframework.ao