PMD Not loading due to error

Issue #1994 resolved
Tony White created an issue

Not sure if it is an issue with Webstorm or not but found it is not loading the PMD library for me, and this is in the error log:

2021-10-22 10:33:44,325 [ 183189] ERROR - aemon.impl.PassExecutorService - net/sourceforge/pmd/PMDConfiguration
java.lang.NoClassDefFoundError: net/sourceforge/pmd/PMDConfiguration
at com.illuminatedcloud.intellij.inspection.pmdApex.PMDApexInspection.checkFile(SourceFile:206)
at com.intellij.codeInspection.LocalInspectionTool$1.visitFile(LocalInspectionTool.java:145)
at com.intellij.extapi.psi.PsiFileBase.accept(PsiFileBase.java:60)
at com.intellij.codeInspection.InspectionEngine.acceptElements(InspectionEngine.java:64)
at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.lambda$visitRestElementsAndCleanup$7(LocalInspectionsPass.java:353)
at com.intellij.util.AstLoadingFilter.lambda$toComputable$2(AstLoadingFilter.java:172)
at com.intellij.util.AstLoadingFilter.disallowTreeLoading(AstLoadingFilter.java:130)
at com.intellij.util.AstLoadingFilter.disallowTreeLoading(AstLoadingFilter.java:119)
at com.intellij.util.AstLoadingFilter.disallowTreeLoading(AstLoadingFilter.java:109)
at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.lambda$visitRestElementsAndCleanup$10(LocalInspectionsPass.java:353)
at com.intellij.concurrency.ApplierCompleter.execAndForkSubTasks(ApplierCompleter.java:136)
at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1078)
at com.intellij.concurrency.ApplierCompleter.lambda$wrapInReadActionAndIndicator$1(ApplierCompleter.java:92)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:705)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:647)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:63)
at com.intellij.concurrency.ApplierCompleter.wrapInReadActionAndIndicator(ApplierCompleter.java:104)
at com.intellij.concurrency.ApplierCompleter.lambda$compute$0(ApplierCompleter.java:83)
at com.intellij.openapi.application.impl.ReadMostlyRWLock.executeByImpatientReader(ReadMostlyRWLock.java:174)
at com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:183)
at com.intellij.concurrency.ApplierCompleter.compute(ApplierCompleter.java:83)
at java.base/java.util.concurrent.CountedCompleter.exec(CountedCompleter.java:746)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
2021-10-22 10:33:44,326 [ 183190] ERROR - aemon.impl.PassExecutorService - WebStorm 2021.2.3 Build #WS-212.5457.55
2021-10-22 10:33:44,326 [ 183190] ERROR - aemon.impl.PassExecutorService - JDK: 11.0.12; VM: OpenJDK 64-Bit Server VM; Vendor: JetBrains s.r.o.
2021-10-22 10:33:44,326 [ 183190] ERROR - aemon.impl.PassExecutorService - OS: Mac OS X
2021-10-22 10:33:44,326 [ 183190] ERROR - aemon.impl.PassExecutorService - Plugin to blame: Illuminated Cloud 2 version: 2.1.9.3
2021-10-22 10:33:44,326 [ 183190] ERROR - aemon.impl.PassExecutorService - Last Action:

Comments (10)

  1. Scott Wells repo owner

    Tony, I did try it with all supported IDEs on Windows and IntelliJ IDEA Ultimate and Community Editions and WebStorm on Mac and Linux. Only once did I see a weird issue where it didn't initialize the classloader properly. That was on Mac, and everything worked properly after restarting the IDE.

    If that doesn't work for you, which PMD distribution are you using, and how have you configured IC2 to point at it? If you want to get more logging, you can add the following to Help>Diagnostic Tools>Debug Log Settings:

    #com.illuminatedcloud.intellij.inspection.pmdApex.PMDApexInspection
    

    Go ahead and restart after doing that so that the classloader is reinitialized, and then attach the resulting idea.log for review.

  2. Tony White reporter

    Seems to be working now, I had restarted it previously.

    Actually now looking at it, it might have been that I was using PMD installed via homebrew, which appears to NOT have the lib folder or at least not the same folder structure.

  3. Tony White reporter

    Likely issue with folder structure when using PMD installed via Homebrew missing the lib folder. Resolved by downloading the PMD directly

  4. Scott Wells repo owner

    Ah, I see. If this becomes a common issue, I'll do a Homebrew install on my Mac and see if I can add folder structure detection for that type of install as well.

  5. Xander Victory

    @Scott Wells I’m getting a similar issue - which is causing all sorts of ‘errors' during code typing to not go away. What’s the required version of PMD? I’ve got it pointed at 6.26.0 (Windows)

    Please add a try/catch in there somewhere 😅

    2021-10-26 09:02:21,402 [1327345]  ERROR - aemon.impl.PassExecutorService - Exception 'java.lang.NoClassDefFoundError: net/sourceforge/pmd/RuleSetLoader' was reported 240 times 
    2021-10-26 09:02:31,034 [1336977]  ERROR - aemon.impl.PassExecutorService - Exception 'java.lang.NoClassDefFoundError: net/sourceforge/pmd/RuleSetLoader' was reported 250 times 
    2021-10-26 09:02:33,507 [1339450]  ERROR - aemon.impl.PassExecutorService - Exception 'java.lang.NoClassDefFoundError: net/sourceforge/pmd/RuleSetLoader' was reported 100 times 
    2021-10-26 09:02:42,956 [1348899]  ERROR - aemon.impl.PassExecutorService - Exception 'java.lang.NoClassDefFoundError: net/sourceforge/pmd/RuleSetLoader' was reported 260 times 
    2021-10-26 09:02:43,711 [1349654]  ERROR - aemon.impl.PassExecutorService - Exception 'java.lang.NoClassDefFoundError: net/sourceforge/pmd/RuleSetLoader' was reported 110 times 
    2021-10-26 09:02:59,826 [1365769]  ERROR - aemon.impl.PassExecutorService - Exception 'java.lang.NoClassDefFoundError: net/sourceforge/pmd/RuleSetLoader' was reported 120 times 
    2021-10-26 09:03:12,041 [1377984]  ERROR - aemon.impl.PassExecutorService - net/sourceforge/pmd/RuleSetLoader 
    java.lang.NoClassDefFoundError: net/sourceforge/pmd/RuleSetLoader
        at com.illuminatedcloud.intellij.inspection.pmdApex.PMDApexInspection.checkFile(SourceFile:237)
        at com.intellij.codeInspection.LocalInspectionTool$1.visitFile(LocalInspectionTool.java:145)
        at com.intellij.extapi.psi.PsiFileBase.accept(PsiFileBase.java:60)
        at com.intellij.codeInspection.InspectionEngine.acceptElements(InspectionEngine.java:64)
        at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.lambda$visitRestElementsAndCleanup$7(LocalInspectionsPass.java:353)
        at com.intellij.util.AstLoadingFilter.lambda$toComputable$2(AstLoadingFilter.java:172)
        at com.intellij.util.AstLoadingFilter.disallowTreeLoading(AstLoadingFilter.java:130)
        at com.intellij.util.AstLoadingFilter.disallowTreeLoading(AstLoadingFilter.java:119)
        at com.intellij.util.AstLoadingFilter.disallowTreeLoading(AstLoadingFilter.java:109)
        at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.lambda$visitRestElementsAndCleanup$10(LocalInspectionsPass.java:353)
        at com.intellij.concurrency.ApplierCompleter.execAndForkSubTasks(ApplierCompleter.java:136)
        at com.intellij.concurrency.ApplierCompleter.execAndForkSubTasks(ApplierCompleter.java:149)
        at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1078)
        at com.intellij.concurrency.ApplierCompleter.lambda$wrapInReadActionAndIndicator$1(ApplierCompleter.java:92)
        at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:705)
        at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:647)
        at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:63)
        at com.intellij.concurrency.ApplierCompleter.wrapInReadActionAndIndicator(ApplierCompleter.java:104)
        at com.intellij.concurrency.ApplierCompleter.lambda$compute$0(ApplierCompleter.java:83)
        at com.intellij.openapi.application.impl.ReadMostlyRWLock.executeByImpatientReader(ReadMostlyRWLock.java:174)
        at com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:183)
        at com.intellij.concurrency.ApplierCompleter.compute(ApplierCompleter.java:83)
        at java.base/java.util.concurrent.CountedCompleter.exec(CountedCompleter.java:746)
        at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
        at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
        at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
        at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
        at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
    2021-10-26 09:03:12,042 [1377985]  ERROR - aemon.impl.PassExecutorService - IntelliJ IDEA 2021.2.3  Build #IU-212.5457.46 
    2021-10-26 09:03:12,042 [1377985]  ERROR - aemon.impl.PassExecutorService - JDK: 11.0.12; VM: OpenJDK 64-Bit Server VM; Vendor: JetBrains s.r.o. 
    2021-10-26 09:03:12,042 [1377985]  ERROR - aemon.impl.PassExecutorService - OS: Windows 10 
    2021-10-26 09:03:12,042 [1377985]  ERROR - aemon.impl.PassExecutorService - Plugin to blame: Illuminated Cloud 2 version: 2.1.9.3 
    2021-10-26 09:03:12,042 [1377985]  ERROR - aemon.impl.PassExecutorService - Last Action: EditorCopy 
    2021-10-26 09:03:14,384 [1380327]  ERROR - aemon.impl.PassExecutorService - Exception 'java.lang.NoClassDefFoundError: net/sourceforge/pmd/RuleSetLoader' was reported 270 times 
    2021-10-26 09:03:23,285 [1389228]  ERROR - aemon.impl.PassExecutorService - Exception 'java.lang.NoClassDefFoundError: net/sourceforge/pmd/RuleSetLoader' was reported 280 times 
    

  6. Scott Wells repo owner

    Xander, the latest is 6.39.0, and 6.40.0 will be out this week. The version you're on is from July, 2020, so it's not at all surprising that things have changed. You should upgrade to the latest.

    I'm happy to add a try/catch, but the most I can likely do in the event of a NoClassDefFoundError is just shut down that code inspection until a new distribution is selected. Because IC2 isn't bundling the PMD jars but it is invoking against the public interface of a recent release, it's going to be critical that folks use a current distribution.

  7. Xander Victory

    For sure, happy for it to reject PMD / disable the inspection if it fails or is too old (it’s just a distro I had lying around and configured back when the lesser-inspection was first added)

  8. Scott Wells repo owner

    Okay, the situation of a PMD failure is now handled gracefully:

    Issue_1994_NoClassDefFoundError_Fix.png

    This change will be included in the next build.

  9. Scott Wells repo owner

    I just made a pretty comprehensive pass on the PMD Apex code inspection to make it much more robust with regard to the various types of failures that can occur when you're trying to extend an existing Java process with external jars. I also made it much more flexible in how/where it picks up the required jar files from the configured distribution, so it will not work just fine with a Homebrew-based install (or anything else where the expected jars are found somewhere beneath the distribution root).

  10. Log in to comment