Issues debugging a plugin I am building specifically for RubyMine

Hi,

I am building a plugin that I am specifically targeting for RubyMine.  I was trying to debug the project in IntelliJ with the Ruby Plugin installed, but ran into some mismatching libraries (the source I was seeing during debugging was different than the source being executed) , so I switched to using my RubyMine SDK instead and debugging it there.  Unfortunately, once I did that, I started getting an error message when I debug the plugin and it opens a RubyMine instance.  In RubyMine, I get the following error:

Plugin Error
Problems found loading plugins:
Plugin "Ruby" was not loaded: required plugin "org.jetbrains.plugins.yaml" not installed.
Disable Ruby
Open plugin manager

I don't get this when I open RubyMine directly (rather than via debugging the plugin from my project in Idea).  I am not sure if this is due to some mismatch between the libraries or SDK loaded in my Idea project, or if there is some other issue.  I have tried various combinations, but right now I am doing the most obvious one to me.  

EDIT: I noticed I had the Ruby.jar file listed as a module dependency for my plugin project.  I no longer get the above error message after removing that dependence.  Everything else below is still the same.

Here is my setup:

Mac OS X Yosemite
Intellij Idea 14.1.4 Ultimate
     Plugin Project using my RubyMine app folder as the SDK source, which shows up as this: RubyMine RM-141.1835 (java version "1.8.0_45")
RubyMine 7.1.4
     Using SDK: Ruby-2.0.0-p481

I have a configuration, and can execute a process by from context, but am unable to get my plugin to break into the debugger to debug the ruby gem that is launched and am trying to re-use some of the ruby libraries, specifically "RubyRunConfigurationType", "RubyRunConfigurationFactory", "RubyRunConfiguration" and "RubyDebugRunner".  Basically what I have is a DebugRunner inheriting from RubyDebugRunner.  I create an instance of the RubyRunConfiguration using the RubyRunConfigurationType and RubyRunConfigurationFactory and then try to execute the RubyRunConfiguration from my DebugRunner with this code:

super.doExecute(project, rubyConfig.getState(env.getExecutor(), env),contentToReuse, env);

When that line is executed, I get the following exception logged to console with no stack trace in the RubyMine that is opened by debugging the plugin:
Error running testfile.rb: [Lorg.jetbrains.plugins.ruby.ruby.sdk.RubySupportProvider; cannot be cast to [Lorg.jetbrains.plugins.ruby.ruby.sdk.RubySupportProvider;

Looking in the RubyMine log file, I see this stack trace:

com.intellij.execution.ExecutionException: [Lorg.jetbrains.plugins.ruby.ruby.sdk.RubySupportProvider; cannot be cast to [Lorg.jetbrains.plugins.ruby.ruby.sdk.RubySupportProvider;
 at org.jetbrains.plugins.ruby.ruby.run.configuration.AbstractRubyRunConfiguration.getState(AbstractRubyRunConfiguration.java:233)
 at com.puppetlabs.BeakerIntellijPlugin.execution.BeakerDebugProgramRunner.doExecute(BeakerDebugProgramRunner.java:62)
 at com.intellij.execution.runners.GenericProgramRunner.doExecute(GenericProgramRunner.java:50)
 at com.intellij.execution.runners.GenericProgramRunner$1.execute(GenericProgramRunner.java:43)
 at com.intellij.execution.RunProfileStarter.execute(RunProfileStarter.java:39)
 at com.intellij.execution.impl.ExecutionManagerImpl$3.run(ExecutionManagerImpl.java:219)
 at com.intellij.execution.impl.ExecutionManagerImpl.compileAndRun(ExecutionManagerImpl.java:134)
 at com.intellij.execution.impl.ExecutionManagerImpl.startRunProfile(ExecutionManagerImpl.java:259)
 at com.intellij.execution.runners.GenericProgramRunner.execute(GenericProgramRunner.java:40)
 at com.intellij.execution.runners.BaseProgramRunner.execute(BaseProgramRunner.java:64)
 at com.intellij.execution.runners.GenericProgramRunner.execute(GenericProgramRunner.java:31)
 at com.intellij.execution.runners.BaseProgramRunner.execute(BaseProgramRunner.java:53)
 at com.intellij.execution.runners.GenericProgramRunner.execute(GenericProgramRunner.java:31)
 at com.intellij.execution.ProgramRunnerUtil.executeConfiguration(ProgramRunnerUtil.java:94)
 at com.intellij.execution.impl.ExecutionManagerImpl.a(ExecutionManagerImpl.java:396)
 at com.intellij.execution.impl.ExecutionManagerImpl.access$400(ExecutionManagerImpl.java:61)
 at com.intellij.execution.impl.ExecutionManagerImpl$5.run(ExecutionManagerImpl.java:384)
 at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:238)
 at com.intellij.util.Alarm$Request$1.run(Alarm.java:351)
 at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:332)
 at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
 at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
 at java.awt.EventQueue.access$500(EventQueue.java:97)
 at java.awt.EventQueue$3.run(EventQueue.java:709)
 at java.awt.EventQueue$3.run(EventQueue.java:703)
 at java.security.AccessController.doPrivileged(Native Method)
 at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
 at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
 at com.intellij.ide.IdeEventQueue.e(IdeEventQueue.java:734)
 at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:569)
 at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:382)
 at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
 at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
 at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
 at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
 at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
 at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Caused by: java.lang.ClassCastException: [Lorg.jetbrains.plugins.ruby.ruby.sdk.RubySupportProvider; cannot be cast to [Lorg.jetbrains.plugins.ruby.ruby.sdk.RubySupportProvider;
 at org.jetbrains.plugins.ruby.ruby.RModuleUtil.hasRubySupport(RModuleUtil.java:91)
 at org.jetbrains.plugins.ruby.ruby.RModuleUtil$1.run(RModuleUtil.java:68)
 at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:867)
 at org.jetbrains.plugins.ruby.ruby.RModuleUtil.getAllModulesWithRubySupport(RModuleUtil.java:60)
 at org.jetbrains.plugins.ruby.ruby.RModuleUtil.getModuleWithRubySupport(RModuleUtil.java:175)
 at org.jetbrains.plugins.ruby.ruby.run.configuration.AbstractRubyRunConfiguration.getModule(AbstractRubyRunConfiguration.java:138)
 at org.jetbrains.plugins.ruby.ruby.run.configuration.AbstractRubyRunConfiguration.getModuleSdk(AbstractRubyRunConfiguration.java:157)
 at org.jetbrains.plugins.ruby.ruby.run.configuration.AbstractRubyRunConfiguration.getSdk(AbstractRubyRunConfiguration.java:152)
 at org.jetbrains.plugins.ruby.ruby.run.configuration.RunConfigurationUtil.inspectSDK(RunConfigurationUtil.java:104)
 at org.jetbrains.plugins.ruby.ruby.run.configuration.rubyScript.RubyRunConfiguration.validateConfiguration(RubyRunConfiguration.java:76)
 at org.jetbrains.plugins.ruby.ruby.run.configuration.AbstractRubyRunConfiguration.getState(AbstractRubyRunConfiguration.java:226)
 ... 36 more


Any help or guidance on how to correct this would be appreciated, thanks.

3 comments
Comment actions Permalink

Hello Sam,

This CCE clearly indicates that something is not good with the classloading.
Does your plugin implement `RubySupportProvider` somewhere?
It would be nice if you shared your sdk classpath and plugin module dependencies. Probably there's something interleaving from different IDEs or something like that. I've had similar exception some time ago when developing other plugin, it was caused by some chaos in dependencies.

Do you have your code somewhere in public?
You can also write me an email (valentin.fondaratov@jetbrains.com) if you want.

Best,
  Valentin.

0
Comment actions Permalink

Thanks Valentine.  No, I do not implement RubySupportProvider anywhere.  When I ctrl-click RubySupportProvider I am able to view the source for it.  Here is the classpath for the plugin project:

  • jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/lib/ant-javafx.jar!/
  • jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/lib/dt.jar!/
  • jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/lib/javafx-mx.jar!/
  • jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/lib/jconsole.jar!/
  • jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/lib/packager.jar!/
  • jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/lib/sa-jdi.jar!/
  • jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/lib/tools.jar!/
  • jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/charsets.jar!/
  • jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/deploy.jar!/
  • jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/javaws.jar!/
  • jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/jce.jar!/
  • jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/jfr.jar!/
  • jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/jfxswt.jar!/
  • jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/jsse.jar!/
  • jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/management-agent.jar!/
  • jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/plugin.jar!/
  • jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/resources.jar!/
  • jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/rt.jar!/
  • jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/ext/cldrdata.jar!/
  • jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/ext/dnsns.jar!/
  • jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/ext/jfxrt.jar!/
  • jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/ext/localedata.jar!/
  • jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/ext/nashorn.jar!/
  • jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/ext/sunec.jar!/
  • jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/ext/sunjce_provider.jar!/
  • jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/ext/sunpkcs11.jar!/
  • jar:///Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/ext/zipfs.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/alloy.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/annotations.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/antlr-runtime-4.1.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/asm-all.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/asm-commons.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/asm.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/automaton.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/batik.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/boot.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/bootstrap.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/bytelist-1.0.2.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/cglib-2.2.2.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/cli-parser-1.1.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/clj-jsr223-0.1.1.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/clojure-1.6.0-slim.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/commons-codec-1.8.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/commons-httpclient-3.1-patched.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/commons-logging-1.1.3.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/commons-net-3.3.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/coverage-agent.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/coverage-util.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/extensions.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/fluent-hc-4.3.6.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/forms_rt.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/groovy-all-2.3.9.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/gson-2.3.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/guava-17.0.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/hamcrest-core-1.3.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/hamcrest-library-1.3.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/httpclient-4.3.6.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/httpcore-4.3.3.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/httpmime-4.3.6.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/icons.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/instrumenter.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/isorelax.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/jaxen-1.1.3.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/jayatana-1.2.4.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/jcodings-1.0.10.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/jdom.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/jettison-1.3.2.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/jgoodies-forms.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/jh.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/jing.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/jna-utils.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/jna.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/joda-time-2.3.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/joni-2.0.0.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/jsch-0.1.51.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/jsch.agentproxy.connector-factory.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/jsch.agentproxy.core.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/jsch.agentproxy.pageant.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/jsch.agentproxy.sshagent.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/jsch.agentproxy.usocket-jna.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/jsch.agentproxy.usocket-nc.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/jsr166e.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/jsr173_1.0_api.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/junit-4.11.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/jvyamlb-0.2.5.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/jzlib-1.1.1.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/kxml2-2.3.0.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/log4j.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/markdownj-core-0.4.2-SNAPSHOT.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/microba.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/miglayout-swing.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/nanoxml-2.2.3.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/nekohtml-1.9.14.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/netty-all-4.1.0.Beta4.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/openapi.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/oromatcher.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/picocontainer.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/protobuf-2.5.0.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/proxy-vole_20131209.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/pty4j-0.4.15.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/purejavacomm.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/resolver.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/resources.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/resources_en.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/rhino-js-1_7R4.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/rngom-20051226-patched.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/rubymine.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/sanselan-0.98-snapshot.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/serviceMessages.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/snakeyaml-1.13.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/snappy-in-java-0.3.1.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/sqlite-jdbc-3.6.20.1.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/swingx-core-1.6.2.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/trang-core.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/trove4j.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/trove4j_src.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/util.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/velocity.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/winp-1.21-patched.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/xbean.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/xerces.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/xmlrpc-2.0.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/xpp3-1.1.4-min.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/xstream-1.4.3.jar!/
  • jar:///Applications/RubyMine.app/Contents/lib/yjp-controller-api-redist.jar!/
  • jar:///Applications/RubyMine.app/Contents/plugins/DatabaseTools/lib/database-openapi.jar!/
  • jar:///Applications/RubyMine.app/Contents/plugins/DatabaseTools/lib/jdba.jar!/
  • jar:///Applications/RubyMine.app/Contents/plugins/DatabaseTools/lib/resources_en.jar!/
  • jar:///Applications/RubyMine.app/Contents/plugins/CSS/lib/css-openapi.jar!/
  • jar:///Applications/RubyMine.app/Contents/plugins/CSS/lib/resources_en.jar!/
  • jar:///Applications/RubyMine.app/Contents/plugins/uml/lib/diagram-api.jar!/


And the dependencies:
RubyMine RM-141.1835 (java version "1.8.0_45"
<Module source>

0
Comment actions Permalink

I didn't find the solution to this particular problem, but I was able to get debugging working via a different approach.  I basically looked at the source for the CommandRun* java files (which executes gem commands) and copied most of it.  I'm not sure what the magical solution was, but it is now working.

0

Please sign in to leave a comment.