How do I debug a plugin in PyCharm (or RubyMine, WebStorm, etc)?

Hello,

I've been building and debugging a plugin in IntelliJ Commnity Edition and Intellij Ultimate edition and have run into an issue specifically in PyCharms. My plugin doesn't work in PyCharms and I have no idea why. When I tried to change my plugin project's SDK to point to the PyCharms Community Edition and go into debug mode, it died with a NullPointer exception (which I will report on YouTrack when it is back up).


Is there some recommended way to test plugins in non-community edition IntelliJ? I am thinking of just maybe writing log statements to a text file or something...


The exception I get when I try to debug my plugin on PyCharms is:

com.intellij.ide.plugins.PluginManager$StartupAbortedException: java.lang.reflect.InvocationTargetException
    at com.intellij.ide.plugins.PluginManager$2.run(PluginManager.java:88)
    at java.lang.Thread.run(Thread.java:695)
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.intellij.ide.plugins.PluginManager$2.run(PluginManager.java:85)
    ... 1 more
Caused by: java.lang.NullPointerException
    at com.intellij.openapi.application.impl.ApplicationInfoImpl.getFullApplicationName(ApplicationInfoImpl.java:390)
    at com.intellij.idea.IdeaLogger$1.getInfo(IdeaLogger.java:202)
    at com.intellij.idea.IdeaLogger.logErrorHeader(IdeaLogger.java:146)
    at com.intellij.idea.IdeaLogger.error(IdeaLogger.java:142)
    at com.intellij.openapi.diagnostic.Logger.error(Logger.java:107)
    at com.intellij.openapi.application.impl.ApplicationInfoImpl.getShadowInstance(ApplicationInfoImpl.java:441)
    at com.intellij.idea.StartupUtil.startLogging(StartupUtil.java:275)
    at com.intellij.idea.StartupUtil.prepareAndStart(StartupUtil.java:105)
    at com.intellij.idea.MainImpl.start(MainImpl.java:34)

9 comments
Comment actions Permalink

" My plugin doesn't work in PyCharm" = ??

0
Comment actions Permalink

Right, I don't know why my Plugin doesn't work in PyCharm, I'm trying to figure out why. The plugin is complicated and basic features do not work. There are no exceptions. I am not asking about why my plugin doesn't work. I am asking how I can debug my plugin using PyCharm. My plugin works fine in IntelliJ and RubyMine and WebStorm.

0
Comment actions Permalink

Yes, I absolutely followed the rules there. The plugin compiles when following these instructions:

In order to do that, you can create an IntelliJ IDEA SDK pointing to an installation of RubyMine or PyCharm, compile your plugin against that SDK and verify that everything compiles.

It's when I try to launch the debugger that I get an exception in IntelliJ IDEA (Ultimate 13).

Now I'm actually getting a different exception when I try to debug:

com.intellij.ide.plugins.PluginManager$StartupAbortedException: Fatal error initializing 'com.intellij.openapi.fileTypes.FileTypeManager'
java.lang.RuntimeException: com.intellij.ide.plugins.PluginManager$StartupAbortedException: Fatal error initializing 'com.intellij.openapi.fileTypes.FileTypeManager'

com.intellij.openapi should be available to PyCharm right?
0
Comment actions Permalink

Thanks again for your help.

Here is my source code:  https://github.com/btipling/DiskRead

Here is how I've setup my SDK:

http://glui.me/?i=6pjmwa71c2bopca/2014-02-04_at_8.17_AM_2x.png/

http://glui.me/?i=mj7szt4is1u7d49/2014-02-04_at_8.17_AM_2x_(1).png/

http://glui.me/?i=wjgr8zxsk017l2j/2014-02-04_at_8.17_AM_2x_(2).png/

http://glui.me/?i=5cna0imut50jsf7/2014-02-04_at_8.18_AM_2x.png/

These are the exceptions I've seen:



[  66873]  ERROR - llij.ide.plugins.PluginManager - com.intellij.ide.plugins.PluginManager$StartupAbortedException: Fatal error initializing 'com.intellij.openapi.fileTypes.FileTypeManager'
java.lang.RuntimeException: com.intellij.ide.plugins.PluginManager$StartupAbortedException: Fatal error initializing 'com.intellij.openapi.fileTypes.FileTypeManager'
 at com.intellij.idea.IdeaApplication.run(IdeaApplication.java:258)
 at com.intellij.idea.MainImpl$1$1$1.run(MainImpl.java:57)
 at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
 at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:715)
 at java.awt.EventQueue.access$400(EventQueue.java:82)
 at java.awt.EventQueue$2.run(EventQueue.java:676)
 at java.awt.EventQueue$2.run(EventQueue.java:674)
 at java.security.AccessController.doPrivileged(Native Method)
 at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:86)
 at java.awt.EventQueue.dispatchEvent(EventQueue.java:685)
 at com.intellij.ide.IdeEventQueue.e(IdeEventQueue.java:696)
 at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:524)
 at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:335)
 at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
 at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
 at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
 at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
 at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
 at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Caused by: com.intellij.ide.plugins.PluginManager$StartupAbortedException: Fatal error initializing 'com.intellij.openapi.fileTypes.FileTypeManager'
 at com.intellij.ide.plugins.PluginManager.handleComponentError(PluginManager.java:215)
 at com.intellij.openapi.application.impl.ApplicationImpl.handleInitComponentError(ApplicationImpl.java:366)
 at com.intellij.openapi.components.impl.ComponentManagerImpl$ComponentConfigComponentAdapter$1.getComponentInstance(ComponentManagerImpl.java:570)
 at com.intellij.openapi.components.impl.ComponentManagerImpl$ComponentConfigComponentAdapter.getComponentInstance(ComponentManagerImpl.java:590)
 at com.intellij.util.pico.DefaultPicoContainer.getLocalInstance(DefaultPicoContainer.java:226)
 at com.intellij.util.pico.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:213)
 at com.intellij.util.pico.DefaultPicoContainer.getComponentInstance(DefaultPicoContainer.java:200)
 at org.picocontainer.alternatives.AbstractDelegatingMutablePicoContainer.getComponentInstance(AbstractDelegatingMutablePicoContainer.java:75)
 at com.intellij.openapi.components.impl.ComponentManagerImpl.createComponent(ComponentManagerImpl.java:121)
 at com.intellij.openapi.application.impl.ApplicationImpl.createComponent(ApplicationImpl.java:386)
 at com.intellij.openapi.components.impl.ComponentManagerImpl.a(ComponentManagerImpl.java:112)
 at com.intellij.openapi.components.impl.ComponentManagerImpl.init(ComponentManagerImpl.java:89)
 at com.intellij.openapi.components.impl.stores.ApplicationStoreImpl.load(ApplicationStoreImpl.java:87)
 at com.intellij.openapi.application.impl.ApplicationImpl.load(ApplicationImpl.java:525)
 at com.intellij.idea.IdeaApplication.run(IdeaApplication.java:250)
 ... 18 more
Caused by: org.picocontainer.defaults.UnsatisfiableDependenciesException: com.intellij.persistence.database.DbFileTypeFactory has unsatisfied dependency: class com.intellij.ultimate.UltimateVerifier among unsatisfiable dependencies: [[class com.intellij.ultimate.UltimateVerifier]] where AreaPicoContainer[null] was the leaf container being asked for dependencies.
 at org.picocontainer.defaults.ConstructorInjectionComponentAdapter.getGreediestSatisfiableConstructor(ConstructorInjectionComponentAdapter.java:191)
 at org.picocontainer.defaults.ConstructorInjectionComponentAdapter$1.run(ConstructorInjectionComponentAdapter.java:210)
 at org.picocontainer.defaults.ThreadLocalCyclicDependencyGuard.observe(ThreadLocalCyclicDependencyGuard.java:53)
 at org.picocontainer.defaults.ConstructorInjectionComponentAdapter.getComponentInstance(ConstructorInjectionComponentAdapter.java:248)
 at org.picocontainer.defaults.DecoratingComponentAdapter.getComponentInstance(DecoratingComponentAdapter.java:60)
 at org.picocontainer.defaults.CachingComponentAdapter.getComponentInstance(CachingComponentAdapter.java:58)
 at com.intellij.openapi.extensions.impl.ExtensionComponentAdapter.getComponentInstance(ExtensionComponentAdapter.java:74)
 at com.intellij.openapi.extensions.impl.ExtensionComponentAdapter.getExtension(ExtensionComponentAdapter.java:111)
 at com.intellij.openapi.extensions.impl.ExtensionPointImpl.processAdapters(ExtensionPointImpl.java:241)
 at com.intellij.openapi.extensions.impl.ExtensionPointImpl.getExtensions(ExtensionPointImpl.java:185)
 at com.intellij.openapi.extensions.Extensions.getExtensions(Extensions.java:111)
 at com.intellij.openapi.extensions.Extensions.getExtensions(Extensions.java:98)
 at com.intellij.openapi.fileTypes.impl.FileTypeManagerImpl.a(FileTypeManagerImpl.java:153)
 at com.intellij.openapi.fileTypes.impl.FileTypeManagerImpl.initComponent(FileTypeManagerImpl.java:284)
 at com.intellij.openapi.components.impl.ComponentManagerImpl$ComponentConfigComponentAdapter$1.getComponentInstance(ComponentManagerImpl.java:548)
 ... 30 more
[  66876]  ERROR - llij.ide.plugins.PluginManager - PyCharm Community Edition 3.0.2  Build #131.SNAPSHOT
[  66876]  ERROR - llij.ide.plugins.PluginManager - JDK: 1.6.0_65
[  66876]  ERROR - llij.ide.plugins.PluginManager - VM: Java HotSpot(TM) 64-Bit Server VM
[  66876]  ERROR - llij.ide.plugins.PluginManager - Vendor: Apple Inc.
[  66876]  ERROR - llij.ide.plugins.PluginManager - OS: Mac OS X
[  66876]  ERROR - llij.ide.plugins.PluginManager - Last Action:


com.intellij.ide.plugins.PluginManager$StartupAbortedException: java.lang.reflect.InvocationTargetException
at com.intellij.ide.plugins.PluginManager$2.run(PluginManager.java:88)
at java.lang.Thread.run(Thread.java:695)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.intellij.ide.plugins.PluginManager$2.run(PluginManager.java:85)
... 1 more
Caused by: java.lang.NullPointerException
at com.intellij.openapi.application.impl.ApplicationInfoImpl.getFullApplicationName(ApplicationInfoImpl.java:390)
at com.intellij.idea.IdeaLogger$1.getInfo(IdeaLogger.java:202)
at com.intellij.idea.IdeaLogger.logErrorHeader(IdeaLogger.java:146)
at com.intellij.idea.IdeaLogger.error(IdeaLogger.java:142)
at com.intellij.openapi.diagnostic.Logger.error(Logger.java:107)
at com.intellij.openapi.application.impl.ApplicationInfoImpl.getShadowInstance(ApplicationInfoImpl.java:441)
at com.intellij.idea.StartupUtil.startLogging(StartupUtil.java:275)
at com.intellij.idea.StartupUtil.prepareAndStart(StartupUtil.java:105)
at com.intellij.idea.MainImpl.start(MainImpl.java:34)
... 6 more
0
Comment actions Permalink

Please check your PyCharm SDK classpath for anything named "database" or "persistence" or anything else pointing to plugins/API only available in IntelliJ IDEA Ultimate Edition and remove all these entries.

0
Comment actions Permalink

Thanks again for your help, I don't have anything like that. Here's my entire classpath contents:

  • jar:///System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/deploy.jar!/
  • jar:///System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/dt.jar!/
  • jar:///System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/javaws.jar!/
  • jar:///System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/jce.jar!/
  • jar:///System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/jconsole.jar!/
  • jar:///System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/management-agent.jar!/
  • jar:///System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/plugin.jar!/
  • jar:///System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/sa-jdi.jar!/
  • jar:///System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/charsets.jar!/
  • jar:///System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/classes.jar!/
  • jar:///System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/jsse.jar!/
  • jar:///System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/ui.jar!/
  • jar:///System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext/apple_provider.jar!/
  • jar:///System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext/dnsns.jar!/
  • jar:///System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext/localedata.jar!/
  • jar:///System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext/sunjce_provider.jar!/
  • jar:///System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext/sunpkcs11.jar!/
  • jar:///Applications/PyCharm.app/lib/alloy.jar!/
  • jar:///Applications/PyCharm.app/lib/annotations.jar!/
  • jar:///Applications/PyCharm.app/lib/asm-commons.jar!/
  • jar:///Applications/PyCharm.app/lib/asm.jar!/
  • jar:///Applications/PyCharm.app/lib/asm4-all.jar!/
  • jar:///Applications/PyCharm.app/lib/automaton.jar!/
  • jar:///Applications/PyCharm.app/lib/batik.jar!/
  • jar:///Applications/PyCharm.app/lib/boot.jar!/
  • jar:///Applications/PyCharm.app/lib/bootstrap.jar!/
  • jar:///Applications/PyCharm.app/lib/cglib-2.2.2.jar!/
  • jar:///Applications/PyCharm.app/lib/cli-parser-1.1.jar!/
  • jar:///Applications/PyCharm.app/lib/commons-codec-1.3.jar!/
  • jar:///Applications/PyCharm.app/lib/commons-httpclient-3.1-patched.jar!/
  • jar:///Applications/PyCharm.app/lib/commons-logging-1.1.1.jar!/
  • jar:///Applications/PyCharm.app/lib/commons-net-3.1.jar!/
  • jar:///Applications/PyCharm.app/lib/coverage-agent.jar!/
  • jar:///Applications/PyCharm.app/lib/coverage-util.jar!/
  • jar:///Applications/PyCharm.app/lib/cucumber-core-1.0.14.jar!/
  • jar:///Applications/PyCharm.app/lib/extensions.jar!/
  • jar:///Applications/PyCharm.app/lib/forms_rt.jar!/
  • jar:///Applications/PyCharm.app/lib/gherkin-2.11.2.jar!/
  • jar:///Applications/PyCharm.app/lib/groovy-all-2.0.6.jar!/
  • jar:///Applications/PyCharm.app/lib/gson-2.2.3.jar!/
  • jar:///Applications/PyCharm.app/lib/guava-14.0.1.jar!/
  • jar:///Applications/PyCharm.app/lib/icons.jar!/
  • jar:///Applications/PyCharm.app/lib/instrumenter.jar!/
  • jar:///Applications/PyCharm.app/lib/isorelax.jar!/
  • jar:///Applications/PyCharm.app/lib/jaxen-1.1.3.jar!/
  • jar:///Applications/PyCharm.app/lib/jayatana-1.2.4.jar!/
  • jar:///Applications/PyCharm.app/lib/jdom.jar!/
  • jar:///Applications/PyCharm.app/lib/jettison-1.3.2.jar!/
  • jar:///Applications/PyCharm.app/lib/jgoodies-forms.jar!/
  • jar:///Applications/PyCharm.app/lib/jh.jar!/
  • jar:///Applications/PyCharm.app/lib/jing.jar!/
  • jar:///Applications/PyCharm.app/lib/jna-utils.jar!/
  • jar:///Applications/PyCharm.app/lib/jna.jar!/
  • jar:///Applications/PyCharm.app/lib/jsch-0.1.50.jar!/
  • jar:///Applications/PyCharm.app/lib/jsr173_1.0_api.jar!/
  • jar:///Applications/PyCharm.app/lib/junit-4.10.jar!/
  • jar:///Applications/PyCharm.app/lib/jzlib-1.1.1.jar!/
  • jar:///Applications/PyCharm.app/lib/log4j.jar!/
  • jar:///Applications/PyCharm.app/lib/markdownj-core-0.4.2-SNAPSHOT.jar!/
  • jar:///Applications/PyCharm.app/lib/microba.jar!/
  • jar:///Applications/PyCharm.app/lib/miglayout-swing.jar!/
  • jar:///Applications/PyCharm.app/lib/nanoxml-2.2.3.jar!/
  • jar:///Applications/PyCharm.app/lib/netty-all-4.1.0.Alpha1.jar!/
  • jar:///Applications/PyCharm.app/lib/openapi.jar!/
  • jar:///Applications/PyCharm.app/lib/oromatcher.jar!/
  • jar:///Applications/PyCharm.app/lib/picocontainer.jar!/
  • jar:///Applications/PyCharm.app/lib/proxy-vole_20120920.jar!/
  • jar:///Applications/PyCharm.app/lib/pycharm-pydev.jar!/
  • jar:///Applications/PyCharm.app/lib/pycharm.jar!/
  • jar:///Applications/PyCharm.app/lib/resolver.jar!/
  • jar:///Applications/PyCharm.app/lib/resources.jar!/
  • jar:///Applications/PyCharm.app/lib/resources_en.jar!/
  • jar:///Applications/PyCharm.app/lib/rhino-js-1_7R4.jar!/
  • jar:///Applications/PyCharm.app/lib/rngom-20051226-patched.jar!/
  • jar:///Applications/PyCharm.app/lib/sanselan-0.98-snapshot.jar!/
  • jar:///Applications/PyCharm.app/lib/serviceMessages.jar!/
  • jar:///Applications/PyCharm.app/lib/snappy-java-1.0.5.jar!/
  • jar:///Applications/PyCharm.app/lib/swingx-core-1.6.2.jar!/
  • jar:///Applications/PyCharm.app/lib/trang-core.jar!/
  • jar:///Applications/PyCharm.app/lib/trove4j.jar!/
  • jar:///Applications/PyCharm.app/lib/util.jar!/
  • jar:///Applications/PyCharm.app/lib/velocity.jar!/
  • jar:///Applications/PyCharm.app/lib/winp-1.17-patched.jar!/
  • jar:///Applications/PyCharm.app/lib/xbean.jar!/
  • jar:///Applications/PyCharm.app/lib/xerces.jar!/
  • jar:///Applications/PyCharm.app/lib/xmlrpc-2.0.jar!/
  • jar:///Applications/PyCharm.app/lib/xpp3-1.1.4-min.jar!/
  • jar:///Applications/PyCharm.app/lib/xstream-1.4.3.jar!/
  • jar:///Applications/PyCharm.app/lib/yjp-controller-api-redist.jar!/
  • jar:///Applications/PyCharm.app/plugins/DatabaseSupport/lib/database-openapi.jar!/
  • jar:///Applications/PyCharm.app/plugins/DatabaseSupport/lib/resources_en.jar!/
  • jar:///Applications/PyCharm.app/plugins/CSS/lib/css-openapi.jar!/
  • jar:///Applications/PyCharm.app/plugins/CSS/lib/resources_en.jar!/
  • jar:///Applications/PyCharm.app/plugins/uml/lib/diagram-api.jar!/
0
Comment actions Permalink

Please remove anything from PyCharm.app/plugins/*

0
Comment actions Permalink

Thanks for your help again. I removed all PyCharm class paths referencing "plugin" and ran into some more bad dependencies at runtime. I will just have to go through the jars and remove them one at a time to see which ones contain things I don't need and remove them.

Thanks again.

0

Please sign in to leave a comment.