java.lang.ClassNotFoundException

已回答

I got this error in Goland and my dependencies were all setup. But still can't solve this error. Github link https://github.com/licheng1013/gorm-example 

2022-11-29 10:29:01,140 [  20172] SEVERE - #c.i.o.u.KeyedExtensionCollector - Cannot create class com.aiwan.gorm.line.LineIconMarkerProvider (classloader=PluginClassLoader(plugin=PluginDescriptor(name=Gorm, id=com.aiwan.gorm, descriptorPath=plugin.xml, path=E:\my-study\gorm-example\build\idea-sandbox\plugins\gorm, version=2.0.9, package=null, isBundled=false), packagePrefix=null, instanceId=106, state=active))
com.intellij.diagnostic.PluginException: Cannot create class com.aiwan.gorm.line.LineIconMarkerProvider (classloader=PluginClassLoader(plugin=PluginDescriptor(name=Gorm, id=com.aiwan.gorm, descriptorPath=plugin.xml, path=E:\my-study\gorm-example\build\idea-sandbox\plugins\gorm, version=2.0.9, package=null, isBundled=false), packagePrefix=null, instanceId=106, state=active))
    at com.intellij.serviceContainer.ComponentManagerImpl.instantiateClass(ComponentManagerImpl.kt:883)
    at com.intellij.serviceContainer.ComponentManagerImpl.instantiateClass(ComponentManagerImpl.kt:900)
    at com.intellij.serviceContainer.LazyExtensionInstance.createInstance(LazyExtensionInstance.java:55)
    at com.intellij.serviceContainer.LazyExtensionInstance.getInstance(LazyExtensionInstance.java:44)
    at com.intellij.serviceContainer.BaseKeyedLazyInstance.getInstance(BaseKeyedLazyInstance.java:38)
    at com.intellij.openapi.util.KeyedExtensionCollector.instantiate(KeyedExtensionCollector.java:166)
    at com.intellij.openapi.util.KeyedExtensionCollector.buildExtensionsFromExtensionPoint(KeyedExtensionCollector.java:153)
    at com.intellij.openapi.util.KeyedExtensionCollector.buildExtensions(KeyedExtensionCollector.java:128)
    at com.intellij.lang.LanguageExtension.buildExtensions(LanguageExtension.java:147)
    at com.intellij.lang.LanguageExtension.buildExtensions(LanguageExtension.java:16)
    at com.intellij.openapi.util.KeyedExtensionCollector.forKey(KeyedExtensionCollector.java:109)
    at com.intellij.lang.LanguageExtension.collectAllForLanguage(LanguageExtension.java:125)
    at com.intellij.lang.LanguageExtension.allForLanguage(LanguageExtension.java:116)
    at com.intellij.lang.LanguageExtension.allForLanguageOrAny(LanguageExtension.java:160)
    at com.intellij.codeInsight.daemon.impl.LineMarkersPass.getMarkerProviders(LineMarkersPass.java:159)
    at com.intellij.codeInsight.daemon.impl.LineMarkersPass.lambda$doCollectInformation$3(LineMarkersPass.java:99)
    at com.intellij.codeInsight.daemon.impl.Divider.divideInsideAndOutsideInOneRoot(Divider.java:87)
    at com.intellij.codeInsight.daemon.impl.LineMarkersPass.doCollectInformation(LineMarkersPass.java:97)
    at com.intellij.codeHighlighting.TextEditorHighlightingPass.collectInformation(TextEditorHighlightingPass.java:57)
    at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$1(PassExecutorService.java:400)
    at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1154)
    at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$2(PassExecutorService.java:393)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$12(CoreProgressManager.java:608)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:683)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:639)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:607)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:60)
    at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.doRun(PassExecutorService.java:392)
    at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$run$0(PassExecutorService.java:368)
    at com.intellij.openapi.application.impl.ReadMostlyRWLock.executeByImpatientReader(ReadMostlyRWLock.java:174)
    at com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:215)
    at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.run(PassExecutorService.java:366)
    at com.intellij.concurrency.JobLauncherImpl$VoidForkJoinTask$1.exec(JobLauncherImpl.java:184)
    at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
    at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
    at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
    at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
    at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
Caused by: com.intellij.diagnostic.PluginException: Cannot load class com.aiwan.gorm.line.LineIconMarkerProvider$1 (
  error: com/goide/psi/GoRecursiveVisitor,
  classLoader=PluginClassLoader(plugin=PluginDescriptor(name=Gorm, id=com.aiwan.gorm, descriptorPath=plugin.xml, path=E:\my-study\gorm-example\build\idea-sandbox\plugins\gorm, version=2.0.9, package=null, isBundled=false), packagePrefix=null, instanceId=106, state=active)
)
    at com.intellij.ide.plugins.cl.PluginClassLoader.loadClassInsideSelf(PluginClassLoader.java:411)
Caused by: com.intellij.diagnostic.PluginException: Cannot load class com.aiwan.gorm.line.LineIconMarkerProvider$1 (

    at com.intellij.ide.plugins.cl.PluginClassLoader.tryLoadingClass(PluginClassLoader.java:239)
  error: com/goide/psi/GoRecursiveVisitor,

    at com.intellij.ide.plugins.cl.PluginClassLoader.loadClass(PluginClassLoader.java:211)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
    at java.base/java.lang.invoke.MethodHandleNatives.resolve(Native Method)
    at java.base/java.lang.invoke.MemberName$Factory.resolve(MemberName.java:1085)
    at java.base/java.lang.invoke.MemberName$Factory.resolveOrFail(MemberName.java:1114)
    at java.base/java.lang.invoke.MethodHandles$Lookup.resolveOrFail(MethodHandles.java:3649)
    at java.base/java.lang.invoke.MethodHandles$Lookup.findConstructor(MethodHandles.java:2750)
    at com.intellij.serviceContainer.ComponentManagerImpl.instantiateClass(ComponentManagerImpl.kt:844)
    ... 37 more
Caused by: java.lang.NoClassDefFoundError: com/goide/psi/GoRecursiveVisitor
    at java.base/java.lang.ClassLoader.defineClass2(Native Method)
Caused by: java.lang.NoClassDefFoundError: com/goide/psi/GoRecursiveVisitor

    at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1103)
    at com.intellij.util.lang.UrlClassLoader.consumeClassData(UrlClassLoader.java:253)
    at com.intellij.util.lang.ZipResourceFile.findClass(ZipResourceFile.java:114)
    at com.intellij.util.lang.JarLoader.findClass(JarLoader.java:63)
    at com.intellij.util.lang.ClassPath.findClassInLoader(ClassPath.java:246)
    at com.intellij.util.lang.ClassPath.findClass(ClassPath.java:179)
    at com.intellij.ide.plugins.cl.PluginClassLoader.loadClassInsideSelf(PluginClassLoader.java:403)
    ... 46 more
Caused by: java.lang.ClassNotFoundException: com.goide.psi.GoRecursiveVisitor PluginClassLoader(plugin=PluginDescriptor(name=Gorm, id=com.aiwan.gorm, descriptorPath=plugin.xml, path=E:\my-study\gorm-example\build\idea-sandbox\plugins\gorm, version=2.0.9, package=null, isBundled=false), packagePrefix=null, instanceId=106, state=active)
Caused by: java.lang.ClassNotFoundException: com.goide.psi.GoRecursiveVisitor PluginClassLoader(plugin=PluginDescriptor(name=Gorm, id=com.aiwan.gorm, descriptorPath=plugin.xml, path=E:\my-study\gorm-example\build\idea-sandbox\plugins\gorm, version=2.0.9, package=null, isBundled=false), packagePrefix=null, instanceId=106, state=active)

    at com.intellij.ide.plugins.cl.PluginClassLoader.loadClass(PluginClassLoader.java:214)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
    ... 54 more
评论操作 固定链接

Hi,

Please follow the instruction from:
https://plugins.jetbrains.com/docs/intellij/goland.html

The differences and issues I can see in your setup:

  1. You declare the GO platform type and add the dependency on the Go plugin.
  2. You don’t declare <depends>com.intellij.modules.goland</depends>.
0
评论操作 固定链接

Karol Lewandowski I've already set it, but it's the same result.  

0
评论操作 固定链接

No, it's still incorrect. Why did you add both com.intellij.modules.go and com.intellij.modules.goland module dependencies?

Please read the docs carefully, configure the project correctly, and see if it helps. If not, please describe the steps to reproduce the issue.

0
评论操作 固定链接

Karol Lewandowski  The result is the same after modification. Start the plugins project, open any go project and select a go file to see the error. Or open the linked item to reproduce the error. https://github.com/licheng1013/io-game-go 

0
评论操作 固定链接

Hi,

Please add <depends>org.jetbrains.plugins.go</depends> (notice plugins, not modules) in your plugin.xml. Do not remove the existing <depends>com.intellij.modules.goland</depends>.

It should fix the issue.

0
评论操作 固定链接

Karol Lewandowski

The correct configuration should be this. Thank you very much.

1
评论操作 固定链接

Keep in mind that by having a dependency on com.intellij.modules.goland your plugin can only be installed into GoLand. If you'd like to use it in IntelliJ IDEA with the Go plugin, you need to remove this dependency and leave only org.jetbrains.plugins.go. 

0

请先登录再写评论。