java.lang.NoClassDefFoundError: com/intellij/jsp/highlighter/NewJspFileType

Answered

I switched to the new `NewJspFileType` instead of using `StdFileTypes.JSP` as mentioned in deprecation warning, yet when I start the IDE with my plugin I get this error:

```

2024-08-19 18:44:08,138 [  46371] SEVERE - #c.i.o.u.KeyedExtensionCollector - Cannot create class com.intellij.struts2.reference.StrutsUITaglibReferenceContributor (classloader=PluginClassLoader(plugin=PluginDescriptor(name=Apache Struts, id=com.intellij.struts2, descriptorPath=plugin.xml, path=~/Projects/Apache/struts-intellij-plugin/build/idea-sandbox/plugins/struts, version=2024.4.2, package=com.intellij.struts2, isBundled=false), packagePrefix=com.intellij.struts2., state=active))
com.intellij.diagnostic.PluginException: Cannot create class com.intellij.struts2.reference.StrutsUITaglibReferenceContributor (classloader=PluginClassLoader(plugin=PluginDescriptor(name=Apache Struts, id=com.intellij.struts2, descriptorPath=plugin.xml, path=~/Projects/Apache/struts-intellij-plugin/build/idea-sandbox/plugins/struts, version=2024.4.2, package=com.intellij.struts2, isBundled=false), packagePrefix=com.intellij.struts2., state=active))
    at com.intellij.serviceContainer.ComponentManagerImpl.doInstantiateClass(ComponentManagerImpl.kt:926)
    at com.intellij.serviceContainer.ComponentManagerImpl.instantiateClass(ComponentManagerImpl.kt:902)
    at com.intellij.serviceContainer.ComponentManagerImpl.instantiateClass(ComponentManagerImpl.kt:943)
    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:199)
    at com.intellij.openapi.util.KeyedExtensionCollector.buildExtensionsFromExtensionPoint(KeyedExtensionCollector.java:161)
    at com.intellij.openapi.util.KeyedExtensionCollector.buildExtensions(KeyedExtensionCollector.java:217)
    at com.intellij.lang.LanguageExtension.buildExtensions(LanguageExtension.java:142)
    at com.intellij.lang.LanguageExtension.buildExtensions(LanguageExtension.java:19)
    at com.intellij.openapi.util.KeyedExtensionCollector.forKey(KeyedExtensionCollector.java:111)
    at com.intellij.lang.LanguageExtension.collectAllForLanguage(LanguageExtension.java:125)
    at com.intellij.lang.LanguageExtension.allForLanguage(LanguageExtension.java:118)
    at com.intellij.lang.LanguageExtension.allForLanguageOrAny(LanguageExtension.java:146)
    at com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistryImpl.createRegistrar(ReferenceProvidersRegistryImpl.java:83)
    at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708)
    at com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistryImpl.getRegistrar(ReferenceProvidersRegistryImpl.java:121)
    at com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistryImpl.doGetReferencesFromProviders(ReferenceProvidersRegistryImpl.java:142)
    at com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistry.lambda$getReferencesFromProviders$0(ReferenceProvidersRegistry.java:44)
    at com.intellij.psi.util.CachedValuesManager$1.compute(CachedValuesManager.java:173)
    at com.intellij.psi.impl.PsiCachedValueImpl$Direct.doCompute(PsiCachedValueImpl.kt:77)
    at com.intellij.util.CachedValueBase.lambda$getValueWithLock$3(CachedValueBase.java:236)
    at com.intellij.util.CachedValueBase.computeData(CachedValueBase.java:43)
    at com.intellij.util.CachedValueBase.lambda$getValueWithLock$4(CachedValueBase.java:236)
    at com.intellij.openapi.util.RecursionManager$1.computePreventingRecursion(RecursionManager.java:111)
    at com.intellij.openapi.util.RecursionGuard.doPreventingRecursion(RecursionGuard.java:27)
    at com.intellij.openapi.util.RecursionManager.doPreventingRecursion(RecursionManager.java:66)
    at com.intellij.util.CachedValueBase.getValueWithLock(CachedValueBase.java:237)
    at com.intellij.psi.impl.PsiCachedValueImpl$Direct.getValue(PsiCachedValueImpl.kt:81)
    at com.intellij.util.CachedValuesManagerImpl.getCachedValue(CachedValuesManagerImpl.java:83)
    at com.intellij.psi.util.CachedValuesManager.getCachedValue(CachedValuesManager.java:170)
    at com.intellij.psi.util.CachedValuesManager.getCachedValue(CachedValuesManager.java:136)
    at com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistry.getReferencesFromProviders(ReferenceProvidersRegistry.java:42)
    at com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistry.getReferencesFromProviders(ReferenceProvidersRegistry.java:35)
    at com.intellij.psi.impl.source.xml.XmlProcessingInstructionImpl.getReferences(XmlProcessingInstructionImpl.java:68)
    at com.intellij.psi.impl.SharedPsiElementImplUtil.addReferences(SharedPsiElementImplUtil.java:58)
    at com.intellij.psi.impl.SharedPsiElementImplUtil.findReferenceAt(SharedPsiElementImplUtil.java:33)
    at com.intellij.psi.impl.SharedPsiElementImplUtil.findReferenceAt(SharedPsiElementImplUtil.java:50)
    at com.intellij.psi.impl.source.tree.CompositePsiElement.findReferenceAt(CompositePsiElement.java:102)
    at com.intellij.psi.AbstractFileViewProvider.findReferenceAt(AbstractFileViewProvider.java:226)
    at com.intellij.psi.SingleRootFileViewProvider.findReferenceAt(SingleRootFileViewProvider.java:222)
    at com.intellij.psi.impl.source.PsiFileImpl.findReferenceAt(PsiFileImpl.java:530)
    at com.intellij.codeInsight.TargetElementUtilBase.findReference(TargetElementUtilBase.java:189)
    at com.intellij.sql.SqlHighlightAsteriskFactory.createHighlightUsagesHandler(SqlHighlightAsteriskFactory.kt:20)
    at com.intellij.codeInsight.highlighting.HighlightUsagesHandlerFactoryBase.createHighlightUsagesHandler(HighlightUsagesHandlerFactoryBase.java:53)
    at com.intellij.codeInsight.highlighting.HighlightUsagesHandlerFactoryBase.createHighlightUsagesHandler(HighlightUsagesHandlerFactoryBase.java:44)
    at com.intellij.codeInsight.highlighting.HighlightUsagesHandler.createCustomHandler(HighlightUsagesHandler.java:108)
    at com.intellij.codeInsight.daemon.impl.IdentifierHighlighterPass.doCollectInformation(IdentifierHighlighterPass.java:75)
    at com.intellij.codeInsight.highlighting.BackgroundHighlighter.lambda$submitIdentifierHighlighterPass$8(BackgroundHighlighter.java:299)
    at com.intellij.codeInsight.daemon.impl.HighlightingSessionImpl.runInsideHighlightingSession(HighlightingSessionImpl.java:171)
    at com.intellij.codeInsight.highlighting.BackgroundHighlighter.lambda$submitIdentifierHighlighterPass$9(BackgroundHighlighter.java:296)
    at com.intellij.openapi.progress.util.ProgressIndicatorUtilService.runActionAndCancelBeforeWrite(ProgressIndicatorUtilService.java:66)
    at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runActionAndCancelBeforeWrite(ProgressIndicatorUtils.java:155)
    at com.intellij.openapi.progress.util.ProgressIndicatorUtils.lambda$runWithWriteActionPriority$1(ProgressIndicatorUtils.java:138)
    at com.intellij.openapi.progress.ProgressManager.lambda$runProcess$0(ProgressManager.java:100)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:217)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$13(CoreProgressManager.java:660)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:735)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:691)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:659)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:79)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:202)
    at com.intellij.openapi.progress.ProgressManager.runProcess(ProgressManager.java:100)
    at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runWithWriteActionPriority(ProgressIndicatorUtils.java:135)
    at com.intellij.codeInsight.highlighting.BackgroundHighlighter.lambda$submitIdentifierHighlighterPass$10(BackgroundHighlighter.java:293)
    at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$OTelMonitor.callWrapped(NonBlockingReadActionImpl.java:851)
    at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$OTelMonitor$MonitoredComputation.call(NonBlockingReadActionImpl.java:883)
    at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$Submission.insideReadAction(NonBlockingReadActionImpl.java:604)
    at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$Submission.lambda$attemptComputation$4(NonBlockingReadActionImpl.java:567)
    at com.intellij.openapi.application.impl.RwLockHolder.tryRunReadAction(RwLockHolder.kt:310)
    at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:958)
    at com.intellij.openapi.progress.util.ProgressIndicatorUtils.lambda$runInReadActionWithWriteActionPriority$0(ProgressIndicatorUtils.java:93)
    at com.intellij.openapi.progress.util.ProgressIndicatorUtilService.runActionAndCancelBeforeWrite(ProgressIndicatorUtilService.java:66)
    at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runActionAndCancelBeforeWrite(ProgressIndicatorUtils.java:155)
    at com.intellij.openapi.progress.util.ProgressIndicatorUtils.lambda$runWithWriteActionPriority$1(ProgressIndicatorUtils.java:138)
    at com.intellij.openapi.progress.ProgressManager.lambda$runProcess$0(ProgressManager.java:100)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:217)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$13(CoreProgressManager.java:660)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:735)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:691)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:659)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:79)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:202)
    at com.intellij.openapi.progress.ProgressManager.runProcess(ProgressManager.java:100)
    at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runWithWriteActionPriority(ProgressIndicatorUtils.java:135)
    at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runInReadActionWithWriteActionPriority(ProgressIndicatorUtils.java:93)
    at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$Submission.attemptComputation(NonBlockingReadActionImpl.java:567)
    at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$Submission.lambda$transferToBgThread$1(NonBlockingReadActionImpl.java:466)
    at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$Submission.lambda$transferToBgThread$2(NonBlockingReadActionImpl.java:481)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:702)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:699)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:699)
    at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: java.lang.NoClassDefFoundError: com/intellij/jsp/highlighter/NewJspFileType
    at com.intellij.struts2.reference.StrutsTaglibReferenceContributorBase.<init>(StrutsTaglibReferenceContributorBase.java:136)
    at com.intellij.struts2.reference.StrutsUITaglibReferenceContributor.<init>(StrutsUITaglibReferenceContributor.java:32)
Caused by: java.lang.NoClassDefFoundError: com/intellij/jsp/highlighter/NewJspFileType

    at com.intellij.serviceContainer.ComponentManagerImpl.findConstructorAndInstantiateClass(ComponentManagerImpl.kt:908)
    at com.intellij.serviceContainer.ComponentManagerImpl.doInstantiateClass(ComponentManagerImpl.kt:917)
    ... 96 more
Caused by: java.lang.ClassNotFoundException: com.intellij.jsp.highlighter.NewJspFileType PluginClassLoader(plugin=PluginDescriptor(name=Apache Struts, id=com.intellij.struts2, descriptorPath=plugin.xml, path=~/Projects/Apache/struts-intellij-plugin/build/idea-sandbox/plugins/struts, version=2024.4.2, package=com.intellij.struts2, isBundled=false), packagePrefix=com.intellij.struts2., state=active)
    at com.intellij.ide.plugins.cl.PluginClassLoader.loadClass(PluginClassLoader.kt:156)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)
Caused by: java.lang.ClassNotFoundException: com.intellij.jsp.highlighter.NewJspFileType PluginClassLoader(plugin=PluginDescriptor(name=Apache Struts, id=com.intellij.struts2, descriptorPath=plugin.xml, path=~/Projects/Apache/struts-intellij-plugin/build/idea-sandbox/plugins/struts, version=2024.4.2, package=com.intellij.struts2, isBundled=false), packagePrefix=com.intellij.struts2., state=active)

    ... 100 more

```

0
2 comments

Hi Łukasz,

I assume you target IU as you can see the class in the editor. To make it visible to your plugin's classloader, in your plugin.xml add:

<depends>com.intellij.jsp</depends>

If it doesn't solve the issue, please share your Gradle build script and related files, and plugin.xml.

0

Thanks a lot, that was it!

0

Please sign in to leave a comment.