Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-14633

Ruby Plugin causes jobs to fail to load

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      Adding an action to a build using a Ruby plugin causes the build to fail to load when Jenkins is restarted.

      The error looks like this:

      SEVERE: Failed Loading job cool
      java.lang.ClassCastException: org.jruby.RubyObject cannot be cast to hudson.model.Action
      	at hudson.model.Run.onLoad(Run.java:293)
      	at hudson.model.RunMap.load(RunMap.java:234)
      	at hudson.model.AbstractProject.onLoad(AbstractProject.java:254)
      	at hudson.model.Project.onLoad(Project.java:88)
      	at hudson.model.Items.load(Items.java:115)
      	at jenkins.model.Jenkins$14.run(Jenkins.java:2360)
      	at org.jvnet.hudson.reactor.TaskGraphBuilder$TaskImpl.run(TaskGraphBuilder.java:146)
      	at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:259)
      	at jenkins.model.Jenkins$5.runTask(Jenkins.java:800)
      	at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:187)
      	at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:94)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      	at java.lang.Thread.run(Thread.java:680)
      

      The bug was originally mentioned in IRC on April 11th by dragonkh_: http://echelog.com/logs/browse/jenkins/1334095200

      Relevant parts of the IRC conversattion:

      <cowboyd> dragonkh_: do you get an exception on startup?
      <dragonkh_> cowboyd - it happens when I start up jenkins
      <dragonkh_> cowboyd - http://pastie.org/3768530
      <dragonkh_> cowboyd - thats the exception I get on starting up jenkins - the job fails to load
      <dragonkh_> is it in the ruby-runtime somewhere?
      <cowboyd> can you send me the xml for the job?
      <cowboyd> It's the persistence that is getting confused.
      <dragonkh_> cowboyd - isnt this the config? http://pastie.org/3768541
      <dragonkh_> cowboyd - check my code here: https://github.com/masterthought/jenkins-cucumber-jvm-reports-plugin
      <cowboyd> dragonkh: can I see the xml for the build?
      <dragonkh_> cowboyd - http://pastie.org/3768765
      <cowboyd> yes, that's it. kohsuke: ^^ any idea why jruby-xstream would be handing the ruby object and not the jruby proxy?

      <dragonkh> cowboyd - got any idea where I can have a look ?
      <cowboyd> yes, it's in the deserialization code. https://github.com/jenkinsci/jruby-xstream
      <dragonkh> is that part of the main jenkins release?
      <cowboyd> all ruby plugins depend on it
      <dragonkh> or is it part of the ruby-runtime ?
      <cowboyd> jenkins.rb/java-runtime depends on it

        Attachments

          Activity

          dpogue Darryl Pogue created issue -
          dpogue Darryl Pogue made changes -
          Field Original Value New Value
          Description Adding an action to a build using a Ruby plugin causes the build to fail to load when Jenkins is restarted.

          The error looks like this
          {{SEVERE: Failed Loading job cool
          java.lang.ClassCastException: org.jruby.RubyObject cannot be cast to hudson.model.Action
          at hudson.model.Run.onLoad(Run.java:293)
          at hudson.model.RunMap.load(RunMap.java:234)
          at hudson.model.AbstractProject.onLoad(AbstractProject.java:254)
          at hudson.model.Project.onLoad(Project.java:88)
          at hudson.model.Items.load(Items.java:115)
          at jenkins.model.Jenkins$14.run(Jenkins.java:2360)
          at org.jvnet.hudson.reactor.TaskGraphBuilder$TaskImpl.run(TaskGraphBuilder.java:146)
          at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:259)
          at jenkins.model.Jenkins$5.runTask(Jenkins.java:800)
          at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:187)
          at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:94)
          at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
          at java.lang.Thread.run(Thread.java:680)}}

          The bug was originally mentioned in IRC on April 11th by dragonkh_: http://echelog.com/logs/browse/jenkins/1334095200

          Relevant parts of the IRC conversattion:
          {quote}
          <cowboyd> dragonkh_: do you get an exception on startup?
          <dragonkh_> cowboyd - it happens when I start up jenkins
          <dragonkh_> cowboyd - http://pastie.org/3768530
          <dragonkh_> cowboyd - thats the exception I get on starting up jenkins - the job fails to load
          <dragonkh_> is it in the ruby-runtime somewhere?
          <cowboyd> can you send me the xml for the job?
          <cowboyd> It's the persistence that is getting confused.
          <dragonkh_> cowboyd - isnt this the config? http://pastie.org/3768541
          <dragonkh_> cowboyd - check my code here: https://github.com/masterthought/jenkins-cucumber-jvm-reports-plugin
          <cowboyd> dragonkh: can I see the xml for the build?
          <dragonkh_> cowboyd - http://pastie.org/3768765
          <cowboyd> yes, that's it. kohsuke: ^^ any idea why jruby-xstream would be handing the ruby object and not the jruby proxy?

          <dragonkh> cowboyd - got any idea where I can have a look ?
          <cowboyd> yes, it's in the deserialization code. https://github.com/jenkinsci/jruby-xstream
          <dragonkh> is that part of the main jenkins release?
          <cowboyd> all ruby plugins depend on it
          <dragonkh> or is it part of the ruby-runtime ?
          <cowboyd> jenkins.rb/java-runtime depends on it
          {quote}
          Adding an action to a build using a Ruby plugin causes the build to fail to load when Jenkins is restarted.

          The error looks like this
          {{
          SEVERE: Failed Loading job cool
          java.lang.ClassCastException: org.jruby.RubyObject cannot be cast to hudson.model.Action
          at hudson.model.Run.onLoad(Run.java:293)
          at hudson.model.RunMap.load(RunMap.java:234)
          at hudson.model.AbstractProject.onLoad(AbstractProject.java:254)
          at hudson.model.Project.onLoad(Project.java:88)
          at hudson.model.Items.load(Items.java:115)
          at jenkins.model.Jenkins$14.run(Jenkins.java:2360)
          at org.jvnet.hudson.reactor.TaskGraphBuilder$TaskImpl.run(TaskGraphBuilder.java:146)
          at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:259)
          at jenkins.model.Jenkins$5.runTask(Jenkins.java:800)
          at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:187)
          at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:94)
          at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
          at java.lang.Thread.run(Thread.java:680)
          }}

          The bug was originally mentioned in IRC on April 11th by dragonkh_: http://echelog.com/logs/browse/jenkins/1334095200

          Relevant parts of the IRC conversattion:
          {quote}
          <cowboyd> dragonkh_: do you get an exception on startup?
          <dragonkh_> cowboyd - it happens when I start up jenkins
          <dragonkh_> cowboyd - http://pastie.org/3768530
          <dragonkh_> cowboyd - thats the exception I get on starting up jenkins - the job fails to load
          <dragonkh_> is it in the ruby-runtime somewhere?
          <cowboyd> can you send me the xml for the job?
          <cowboyd> It's the persistence that is getting confused.
          <dragonkh_> cowboyd - isnt this the config? http://pastie.org/3768541
          <dragonkh_> cowboyd - check my code here: https://github.com/masterthought/jenkins-cucumber-jvm-reports-plugin
          <cowboyd> dragonkh: can I see the xml for the build?
          <dragonkh_> cowboyd - http://pastie.org/3768765
          <cowboyd> yes, that's it. kohsuke: ^^ any idea why jruby-xstream would be handing the ruby object and not the jruby proxy?

          <dragonkh> cowboyd - got any idea where I can have a look ?
          <cowboyd> yes, it's in the deserialization code. https://github.com/jenkinsci/jruby-xstream
          <dragonkh> is that part of the main jenkins release?
          <cowboyd> all ruby plugins depend on it
          <dragonkh> or is it part of the ruby-runtime ?
          <cowboyd> jenkins.rb/java-runtime depends on it
          {quote}
          dpogue Darryl Pogue made changes -
          Description Adding an action to a build using a Ruby plugin causes the build to fail to load when Jenkins is restarted.

          The error looks like this
          {{
          SEVERE: Failed Loading job cool
          java.lang.ClassCastException: org.jruby.RubyObject cannot be cast to hudson.model.Action
          at hudson.model.Run.onLoad(Run.java:293)
          at hudson.model.RunMap.load(RunMap.java:234)
          at hudson.model.AbstractProject.onLoad(AbstractProject.java:254)
          at hudson.model.Project.onLoad(Project.java:88)
          at hudson.model.Items.load(Items.java:115)
          at jenkins.model.Jenkins$14.run(Jenkins.java:2360)
          at org.jvnet.hudson.reactor.TaskGraphBuilder$TaskImpl.run(TaskGraphBuilder.java:146)
          at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:259)
          at jenkins.model.Jenkins$5.runTask(Jenkins.java:800)
          at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:187)
          at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:94)
          at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
          at java.lang.Thread.run(Thread.java:680)
          }}

          The bug was originally mentioned in IRC on April 11th by dragonkh_: http://echelog.com/logs/browse/jenkins/1334095200

          Relevant parts of the IRC conversattion:
          {quote}
          <cowboyd> dragonkh_: do you get an exception on startup?
          <dragonkh_> cowboyd - it happens when I start up jenkins
          <dragonkh_> cowboyd - http://pastie.org/3768530
          <dragonkh_> cowboyd - thats the exception I get on starting up jenkins - the job fails to load
          <dragonkh_> is it in the ruby-runtime somewhere?
          <cowboyd> can you send me the xml for the job?
          <cowboyd> It's the persistence that is getting confused.
          <dragonkh_> cowboyd - isnt this the config? http://pastie.org/3768541
          <dragonkh_> cowboyd - check my code here: https://github.com/masterthought/jenkins-cucumber-jvm-reports-plugin
          <cowboyd> dragonkh: can I see the xml for the build?
          <dragonkh_> cowboyd - http://pastie.org/3768765
          <cowboyd> yes, that's it. kohsuke: ^^ any idea why jruby-xstream would be handing the ruby object and not the jruby proxy?

          <dragonkh> cowboyd - got any idea where I can have a look ?
          <cowboyd> yes, it's in the deserialization code. https://github.com/jenkinsci/jruby-xstream
          <dragonkh> is that part of the main jenkins release?
          <cowboyd> all ruby plugins depend on it
          <dragonkh> or is it part of the ruby-runtime ?
          <cowboyd> jenkins.rb/java-runtime depends on it
          {quote}
          Adding an action to a build using a Ruby plugin causes the build to fail to load when Jenkins is restarted.

          The error looks like this:
          {code}
          SEVERE: Failed Loading job cool
          java.lang.ClassCastException: org.jruby.RubyObject cannot be cast to hudson.model.Action
          at hudson.model.Run.onLoad(Run.java:293)
          at hudson.model.RunMap.load(RunMap.java:234)
          at hudson.model.AbstractProject.onLoad(AbstractProject.java:254)
          at hudson.model.Project.onLoad(Project.java:88)
          at hudson.model.Items.load(Items.java:115)
          at jenkins.model.Jenkins$14.run(Jenkins.java:2360)
          at org.jvnet.hudson.reactor.TaskGraphBuilder$TaskImpl.run(TaskGraphBuilder.java:146)
          at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:259)
          at jenkins.model.Jenkins$5.runTask(Jenkins.java:800)
          at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:187)
          at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:94)
          at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
          at java.lang.Thread.run(Thread.java:680)
          {code}

          The bug was originally mentioned in IRC on April 11th by dragonkh_: http://echelog.com/logs/browse/jenkins/1334095200

          Relevant parts of the IRC conversattion:
          {quote}
          <cowboyd> dragonkh_: do you get an exception on startup?
          <dragonkh_> cowboyd - it happens when I start up jenkins
          <dragonkh_> cowboyd - http://pastie.org/3768530
          <dragonkh_> cowboyd - thats the exception I get on starting up jenkins - the job fails to load
          <dragonkh_> is it in the ruby-runtime somewhere?
          <cowboyd> can you send me the xml for the job?
          <cowboyd> It's the persistence that is getting confused.
          <dragonkh_> cowboyd - isnt this the config? http://pastie.org/3768541
          <dragonkh_> cowboyd - check my code here: https://github.com/masterthought/jenkins-cucumber-jvm-reports-plugin
          <cowboyd> dragonkh: can I see the xml for the build?
          <dragonkh_> cowboyd - http://pastie.org/3768765
          <cowboyd> yes, that's it. kohsuke: ^^ any idea why jruby-xstream would be handing the ruby object and not the jruby proxy?

          <dragonkh> cowboyd - got any idea where I can have a look ?
          <cowboyd> yes, it's in the deserialization code. https://github.com/jenkinsci/jruby-xstream
          <dragonkh> is that part of the main jenkins release?
          <cowboyd> all ruby plugins depend on it
          <dragonkh> or is it part of the ruby-runtime ?
          <cowboyd> jenkins.rb/java-runtime depends on it
          {quote}
          Hide
          jorgenpt Jørgen Tjernø added a comment -

          Assigning to Charles (I hope this is allright?)

          Show
          jorgenpt Jørgen Tjernø added a comment - Assigning to Charles (I hope this is allright?)
          jorgenpt Jørgen Tjernø made changes -
          Assignee Jørgen Tjernø [ jorgenpt ] Charles Lowell [ cowboyd ]
          Hide
          dpogue Darryl Pogue added a comment -

          Researching this a bit more tonight...

          It seems to only affect build actions, and seems to stem from the fact that Action is an interface rather than a class. You can't make the proxy class a subclass of the interface, and then it fails to cast the proxied object.

          It works if you define your Proxy class like this:

          module TestPlugin
            class TestProxy < Java.hudson.model.InvisibleAction
              include Jenkins::Model::DescribableProxy
          
              proxy_for TestAction
            end
          end
          
          Show
          dpogue Darryl Pogue added a comment - Researching this a bit more tonight... It seems to only affect build actions, and seems to stem from the fact that Action is an interface rather than a class. You can't make the proxy class a subclass of the interface, and then it fails to cast the proxied object. It works if you define your Proxy class like this: module TestPlugin class TestProxy < Java.hudson.model.InvisibleAction include Jenkins::Model::DescribableProxy proxy_for TestAction end end
          rtyler R. Tyler Croy made changes -
          Workflow JNJira [ 145329 ] JNJira + In-Review [ 176319 ]

            People

            Assignee:
            cowboyd Charles Lowell
            Reporter:
            dpogue Darryl Pogue
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated: