NoClassDefFoundError with "psiMethod"

Answered

I was trying to use the "psi demo example" in github in my plugin

https://github.com/JetBrains/intellij-sdk-docs/blob/master/code_samples/psi_demo/src/main/java/org/intellij/sdk/psi/PsiNavigationDemoAction.java

It compiles, ok but when executing I have :

2020-07-24 18:08:16,338 [ 11440] ERROR - llij.ide.plugins.PluginManager - com/intellij/psi/PsiMethod
java.lang.NoClassDefFoundError: com/intellij/psi/PsiMethod

I'm using Intellij ultimate 2020.1 (Build #IU-201.8743.12)

Any clues ?

 

0
30 comments

I have the same problem with "PsiClass" or "PsiClassImpl" or "PsiMethodImpl"

But "PsiNamedElement" or "PsiNameIdentifierOwner" works ok

For the PsiClass, if in the debugger I do "vPsiClass.getClass()", I will have :

"com.intellij.lang.ecmascript6.psi.impl.ES6ClassImpl"

I tried to "import it", but com.intellij.lang doesn't have a "ecmascript6" ???

0

Do you have the following dependency set in your plugin.xml?

<depends>com.intellij.modules.java</depends>
 
1

My "depends" entry was

<depends>com.intellij.modules.platform</depends>


So I changed to the one you suggested. Now my code execute correctly, but it doesn"t find any "current method" or "current class", I'm using ES6 JavaScript

 

0

ES6ClassImpl is available in the JavaScript plugin. You have to add the dependency to the JavaScript plugin both in your Gradle and plugin.xml. Keep in mind, that it's available in IntelliJ Ultimate only:

intellij {
type = "IU"
setPlugins("JavaScript")
}
0

Sorry but how to I add 

intellij {
type = "IU"
setPlugins("JavaScript")
}

to my plugin.xml ?

For Gradle i'm not using it 

 

0

The above snippet should be applied to the Gradle configuration.

0

What about plugin.xml ?

0

As mentioned above - dependency is called JavaScript for both.

0

Is  there a way to know if a PsiElement is a method without depending on other plugins? i want a general isMethod or something that will catch all languages, or at least the languages that have methods/functions like java ,python etc.

 

0

How can I determine if a PsiElement corresponds to a method, without using any plugin-specific APIs?

drift boss

0

I ran into the same issue before — updating the IntelliJ SDK and re-importing the dependencies fixed the psiMethod error for me.
 

1

This error usually means an IntelliJ SDK mismatch.
PsiMethod isn’t found at runtime because the plugin was built against a different IDE version or missing PSI dependencies.
Check sinceBuild / untilBuild, align the IntelliJ Platform version, and make sure PSI is included.

1

This error usually points to a missing or incompatible dependency at runtime. If psiMethod is involved, it’s worth double-checking the IntelliJ platform or plugin SDK versions to make sure they match the IDE you’re running. Cleaning the build and re-syncing dependencies can also help narrow down the cause.

0

This error explanation is really helpful. I’ve run into NoClassDefFoundError with psiMethod when working on IntelliJ plugins, and the classpath mismatch insight makes a lot of sense. Thanks for breaking it down clearly.

 

0

Good write-up! The part about dependency versions and IDE SDK compatibility helped me spot the issue in my setup. I didn’t realize psiMethod could fail just because of an outdated IntelliJ platform.

0

Thanks for sharing this. The explanation about how psiMethod gets loaded at runtime really helped me understand why the NoClassDefFoundError happens in some environments but not others.

0

This post saved me a lot of time. I was chasing the wrong cause until I realized the issue was related to IntelliJ SDK and missing classes like psiMethod. Very useful breakdown.

0

Errors like this often happen when an IntelliJ/IDEA PSI class isn’t available at runtime even though it compiled fine. Double-checking plugin or SDK versions helps a lot. Randomly, I relax between fixes by browsing drawing ideas

 

0

I’ve seen this when Gradle builds fine but the IDE runtime doesn’t include certain platform libraries. Re-importing the project and rebuilding can sometimes fix it.

 

0

Could be a classloader issue, especially in plugin development. Make sure the required IntelliJ modules are declared in your plugin configuration.

 

0

If you recently updated the IDE or SDK, some internal APIs might have moved or changed. Invalidating caches and restarting the IDE is worth trying.

 

0

Check your dependency tree for exclusions. Sometimes a transitive dependency containing PSI classes gets excluded without you noticing.

 

0

This kind of NoClassDefFoundError usually points to a missing dependency at runtime rather than a compilation issue. In IntelliJ plugin development, classes like PsiMethod belong to specific modules (like java), so if your plugin doesn’t declare the proper dependency in plugin.xml (e.g., <depends>com.intellij.modules.java</depends>), you’ll hit exactly this error. Visualizing dependency trees can get messy—tools like Nano AI could actually help map these relationships more clearly.

0

Overall, the fix is usually straightforward: add the correct module dependency (especially com.intellij.modules.java) and ensure your SDK includes Java support. Once that’s done, the error should disappear. It’s like getting past an early obstacle in slope unblocked—once configured correctly, everything flows smoothly.

0

Given that the code compiles but fails at runtime, it strongly suggests your SDK setup or plugin configuration is incomplete. The PSI APIs are not always included by default depending on your target platform. It’s similar to how using something like lyrics to song AI requires the right input context—without the proper setup, the output just won’t work as expected.

0

Another thing to check is whether your plugin is targeting the correct IntelliJ platform (IDEA vs. other JetBrains IDEs). Some IDEs don’t bundle Java PSI მხარდაჭერა unless explicitly added. It’s a bit like running a game such as speed stars—if the environment isn’t right, even simple actions fail.

0

Also make sure your Gradle (if you’re using it) includes the correct IntelliJ plugin configuration, like intellij { plugins = ['java'] }. Without that, the runtime won’t have access to PsiMethod. It’s comparable to missing core mechanics in something like baseball bros—the structure is there, but key components are absent.

0

The official PSI demo assumes you’re working within a properly configured IntelliJ SDK environment. If you copied the code into a different setup, it may not bring all required modules with it. This kind of mismatch is similar to logic gaps you might see in puzzle flows like blockblast online, where one missing piece breaks the whole chain.

0

Double-check your plugin.xml and ensure dependencies are declared correctly. This is often overlooked but critical. Think of it like setting up rules before starting a match in basketball game—without the right setup, nothing runs properly.

0

Please sign in to leave a comment.