jenkinsci/jenkins.rb

Getting error with a simple generator

rauhryan opened this issue · 13 comments

    Loading /home/rauhryan/lecode/ruby/sabatoast/models/mongodb_publisher.rb
    ArgumentError: wrong number of arguments (2 for 1)
    /home/rauhryan/.rvm/gems/jruby-1.6.5.1/gems/jenkins-plugin-runtime-0.1.27/lib/jenkins/plugin.rb:116:in `register_extension'
    /home/rauhryan/.rvm/gems/jruby-1.6.5.1/gems/jenkins-plugin-runtime-0.1.27/lib/jenkins/plugin.rb:135:in `register_describable'
    org/jruby/RubyProc.java:268:in `call'
    org/jruby/RubyProc.java:228:in `call'
    /home/rauhryan/.rvm/gems/jruby-1.6.5.1/gems/jenkins-plugin-runtime-0.1.27/lib/jenkins/plugin.rb:250:in `callback'
    /home/rauhryan/.rvm/gems/jruby-1.6.5.1/gems/jenkins-plugin-runtime-0.1.27/lib/jenkins/plugin.rb:245:in `fire'
    org/jruby/RubyArray.java:1602:in `each'
    /home/rauhryan/.rvm/gems/jruby-1.6.5.1/gems/jenkins-plugin-runtime-0.1.27/lib/jenkins/plugin.rb:244:in `fire'
    /home/rauhryan/.rvm/gems/jruby-1.6.5.1/gems/jenkins-plugin-runtime-0.1.27/lib/jenkins/plugin.rb:148:in `start'
    Apr 2, 2012 10:43:47 AM jenkins.InitReactorRunner$1 onAttained
    INFO: Prepared all plugins
    SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
    SLF4J: Defaulting to no-operation (NOP) logger implementation
    SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
    Apr 2, 2012 10:43:49 AM jenkins.InitReactorRunner$1 onAttained

I'm getting an argument error when I generate a publisher that just prints "Hello world" in the perform method.

Perhaps I'm doing something wrong?

Can you upgrade your jenkins-plugin-runtime to 0.2.0 and try again?

Updated my gem file to 0.2.0 ran bundle update then jpi server I still
get the same error

To reproduce.

  • freshly install jruby with rvm
  • gem install jpi
  • jpi new myproj
  • bundle install
  • jpi generate builder test
  • jpi server

On Mon, Apr 2, 2012 at 10:54 AM, Charles Lowell <
reply@reply.github.com

wrote:

Can you upgrade your jenkins-plugin-runtime to 0.2.0 and try again?


Reply to this email directly or view it on GitHub:
https://github.com/cowboyd/jenkins.rb/issues/38#issuecomment-4881448

I followed your exact steps and here's the result:

Things we should check next:

version of jruby
version of jenkins-war

Using /Users/cowboyd/.rvm/gems/jruby-1.6.7
legolas:~ cowboyd$ jpi -v
0.3.4
legolas:~ cowboyd$ jpi new myproj
      create  myproj/Gemfile
      create  myproj/myproj.pluginspec
legolas:~ cowboyd$ cd myproj/
legolas:myproj cowboyd$ ls
Gemfile         myproj.pluginspec
legolas:myproj cowboyd$ jpi g builder test
      create  models/test_builder.rb
legolas:myproj cowboyd$ jpi server
Listening for transport dt_socket at address: 8000
Running from: /Users/cowboyd/.rvm/gems/jruby-1.6.7/gems/jenkins-war-1.447/lib/jenkins/jenkins.war
webroot: System.getProperty("JENKINS_HOME")
[Winstone 2012/04/02 11:19:24] - Beginning extraction from war file
Jenkins home directory: /Users/cowboyd/myproj/work found at: System.getProperty("JENKINS_HOME")
[Winstone 2012/04/02 11:19:32] - HTTP Listener started: port=8080
[Winstone 2012/04/02 11:19:32] - AJP13 Listener started: port=8009
[Winstone 2012/04/02 11:19:32] - Winstone Servlet Engine v0.9.10 running: controlPort=disabled
Apr 2, 2012 11:19:32 AM jenkins.InitReactorRunner$1 onAttained
INFO: Started initialization
Apr 2, 2012 11:19:36 AM hudson.PluginManager$1$3$1 isDuplicate
INFO: Ignoring /Users/cowboyd/myproj/work/plugins/myproj.hpl because /Users/cowboyd/myproj/work/plugins/myproj.hpl is already loaded
Apr 2, 2012 11:19:44 AM jenkins.InitReactorRunner$1 onAttained
INFO: Listed all plugins
Apr 2, 2012 11:19:44 AM ruby.RubyRuntimePlugin start
INFO: Injecting JRuby into XStream
Trying to load models from /Users/cowboyd/myproj/models
Loading /Users/cowboyd/myproj/models/test_builder.rb
Apr 2, 2012 11:19:52 AM jenkins.InitReactorRunner$1 onAttained
INFO: Prepared all plugins
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Apr 2, 2012 11:19:58 AM jenkins.InitReactorRunner$1 onAttained
INFO: Started all plugins
Apr 2, 2012 11:19:58 AM jenkins.InitReactorRunner$1 onAttained
INFO: Augmented all extensions
Apr 2, 2012 11:19:58 AM jenkins.InitReactorRunner$1 onAttained
INFO: Loaded all jobs
Apr 2, 2012 11:19:58 AM org.jenkinsci.main.modules.sshd.SSHD start
INFO: Started SSHD at port 51678
Apr 2, 2012 11:19:58 AM jenkins.InitReactorRunner$1 onAttained
INFO: Completed initialization
Apr 2, 2012 11:19:58 AM hudson.TcpSlaveAgentListener <init>
INFO: JNLP slave agent listener started on TCP port 51679
Apr 2, 2012 11:20:08 AM hudson.WebAppMain$2 run
INFO: Jenkins is fully up and running
    ➜  sabatoast  gem list

    *** LOCAL GEMS ***

    bouncy-castle-java (1.5.0146.1)
    bundler (1.1.3 ruby)
    jenkins-plugin-runtime (0.2.0, 0.1.27)
    jenkins-war (1.447)
    jpi (0.3.4)
    jruby-launcher (1.0.12 java)
    jruby-openssl (0.7.6.1)
    json (1.6.6 java)
    rake (0.9.2, 0.8.7)
    rubyzip (0.9.6.1)
    slop (3.0.4)
    thor (0.14.6)

    ➜  sabatoast  ruby -v
    jruby 1.6.5.1 (ruby-1.8.7-p330) (2011-12-27 1bf37c2) (OpenJDK 64-Bit Server VM 1.6.0_23) [linux-amd64-java]

I'm using Ubuntu latest??? Any issues there?

Hmm, before we try anything else, let's also make sure you have a good version of the ruby runtime on the Java side.

You can update the dependency in your .pluginspec

 # This is a required dependency for every ruby plugin.
  plugin.depends_on 'ruby-runtime', '0.9'

Listening for transport dt_socket at address: 8000
Running from: /home/rauhryan/.rvm/gems/jruby-1.6.5.1/gems/jenkins-war-1.447/lib/jenkins/jenkins.war
webroot: System.getProperty("JENKINS_HOME")
[Winstone 2012/04/02 15:15:58] - Beginning extraction from war file
Jenkins home directory: /home/rauhryan/lecode/ruby/sabatoast/work found at: System.getProperty("JENKINS_HOME")
[Winstone 2012/04/02 15:16:01] - HTTP Listener started: port=8080
[Winstone 2012/04/02 15:16:01] - AJP13 Listener started: port=8009
[Winstone 2012/04/02 15:16:01] - Winstone Servlet Engine v0.9.10 running: controlPort=disabled
Apr 2, 2012 3:16:01 PM jenkins.InitReactorRunner$1 onAttained
INFO: Started initialization
Apr 2, 2012 3:16:02 PM hudson.PluginManager$1$3$1 isDuplicate
INFO: Ignoring /home/rauhryan/lecode/ruby/sabatoast/work/plugins/sabatoast.hpl because /home/rauhryan/lecode/ruby/sabatoast/work/plugins/sabatoast.hpl is already loaded
Apr 2, 2012 3:16:03 PM jenkins.InitReactorRunner$1 onAttained
INFO: Listed all plugins
Apr 2, 2012 3:16:03 PM ruby.RubyRuntimePlugin start
INFO: Injecting JRuby into XStream
Trying to load models from /home/rauhryan/lecode/ruby/sabatoast/models
Loading /home/rauhryan/lecode/ruby/sabatoast/models/mongo_builder.rb
ArgumentError: wrong number of arguments (2 for 1)
/home/rauhryan/.rvm/gems/jruby-1.6.5.1/gems/jenkins-plugin-runtime-0.2.0/lib/jenkins/plugin.rb:116:in register_extension' /home/rauhryan/.rvm/gems/jruby-1.6.5.1/gems/jenkins-plugin-runtime-0.2.0/lib/jenkins/plugin.rb:135:inregister_describable'
org/jruby/RubyProc.java:258:in call' /home/rauhryan/.rvm/gems/jruby-1.6.5.1/gems/jenkins-plugin-runtime-0.2.0/lib/jenkins/plugin.rb:250:incallback'
/home/rauhryan/.rvm/gems/jruby-1.6.5.1/gems/jenkins-plugin-runtime-0.2.0/lib/jenkins/plugin.rb:245:in fire' org/jruby/RubyArray.java:1612:ineach'
/home/rauhryan/.rvm/gems/jruby-1.6.5.1/gems/jenkins-plugin-runtime-0.2.0/lib/jenkins/plugin.rb:244:in fire' /home/rauhryan/.rvm/gems/jruby-1.6.5.1/gems/jenkins-plugin-runtime-0.2.0/lib/jenkins/plugin.rb:148:instart'
Apr 2, 2012 3:16:10 PM jenkins.InitReactorRunner$1 onAttained
INFO: Prepared all plugins

Updated ruby-runtime still getting error

It seems very likely that it is related to the ruby-runtime version, because there was very recently introduced a second method for addExtension() to take ordinal values.

https://github.com/cowboyd/jenkins.rb/blob/master/java-runtime/src/main/java/ruby/RubyPlugin.java#L101-118

I would also try upgrading jruby to latest and see if that solves it.

Hmm its strange that no one else is having the issue

I will try it later tonight on my mac book and see if its an environment issue

what should I upgrade jruby to?

I'm on the latest stable

1.6.5.1

Latest stable is 1.6.7. Maybe you need to upgrade rvm?

Updated rvm and jruby and still the same error

SUCCESS!

The latest version of ruby-runtime is required which is 0.10

    #this is a required dependency for every plugin
    plugin.depends_on "ruby_runtime", "0.10"