Forum: JRuby Error: wrong number of arguments (1 for 0)

Posted by Jas Grewal (jgrewal)
on 2010-02-27 22:17
Hi,

I am working on an application with Jruby and rails. I recently upgraded
Jruby version to 1.4 and rails (Jruby gem) version to 2.3.5.

I randomly get the following error. The error occurs before any of the
application code is called. I am not sure why rails or jruby is passing
some arguments to controller method. The problem only occurs when the
project is deployed in tomcat. It works fine with mongrel.

Any help will be greatly appreciated.

Error:
==============================================================

ArgumentError in Client/authController#login
wrong number of arguments (1 for 0)
RAILS_ROOT: /var/lib/tomcat6/webapps/ida2/WEB-INF

Application Trace | Framework Trace | Full Trace
file:/var/lib/tomcat6/webapps/ida2/WEB-INF/lib/jruby-stdlib-1.4.0.jar!/META-INF/jruby.home/lib/ruby/site_ruby/shared/builtin/javasupport/java.rb:50:in
`method_missing'
/usr/share/tomcat6/webapps/ida2/WEB-INF/gems/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:289:in
`qualified_const_defined?'
/usr/share/tomcat6/webapps/ida2/WEB-INF/gems/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:287:in
`each'
/usr/share/tomcat6/webapps/ida2/WEB-INF/gems/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:287:in
`inject'
/usr/share/tomcat6/webapps/ida2/WEB-INF/gems/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:287:in
`qualified_const_defined?'
/usr/share/tomcat6/webapps/ida2/WEB-INF/gems/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:413:in
`load_missing_constant'
/usr/share/tomcat6/webapps/ida2/WEB-INF/gems/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:96:in
`const_missing'
/usr/share/tomcat6/webapps/ida2/WEB-INF/gems/gems/activesupport-2.3.5/lib/active_support/inflector.rb:361:in
`constantize'
/usr/share/tomcat6/webapps/ida2/WEB-INF/gems/gems/activesupport-2.3.5/lib/active_support/inflector.rb:360:in
`each'
/usr/share/tomcat6/webapps/ida2/WEB-INF/gems/gems/activesupport-2.3.5/lib/active_support/inflector.rb:360:in
`constantize'
/usr/share/tomcat6/webapps/ida2/WEB-INF/gems/gems/activesupport-2.3.5/lib/active_support/core_ext/string/inflections.rb:162:in
`constantize'
/usr/share/tomcat6/webapps/ida2/WEB-INF/gems/gems/actionpack-2.3.5/lib/action_controller/routing/route_set.rb:443:in
`recognize'
/usr/share/tomcat6/webapps/ida2/WEB-INF/gems/gems/actionpack-2.3.5/lib/action_controller/routing/route_set.rb:436:in
`call'
file:/var/lib/tomcat6/webapps/ida2/WEB-INF/lib/jruby-stdlib-1.4.0.jar!/META-INF/jruby.home/lib/ruby/site_ruby/shared/builtin/javasupport/java.rb:50:in
`method_missing'
/usr/share/tomcat6/webapps/ida2/WEB-INF/gems/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:87:in
`dispatch'
/usr/share/tomcat6/webapps/ida2/WEB-INF/gems/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:121:in
`_call'
/usr/share/tomcat6/webapps/ida2/WEB-INF/gems/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:130:in
`build_middleware_stack'
/usr/share/tomcat6/webapps/ida2/WEB-INF/gems/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:114:in
`call'
/usr/share/tomcat6/webapps/ida2/WEB-INF/gems/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:108:in
`call'
file:/var/lib/tomcat6/webapps/ida2/WEB-INF/lib/jruby-rack-0.9.5.jar!/rack/adapter/rails.rb:35:in
`serve_rails'
file:/var/lib/tomcat6/webapps/ida2/WEB-INF/lib/jruby-rack-0.9.5.jar!/rack/adapter/rails.rb:51:in
`call'
file:/var/lib/tomcat6/webapps/ida2/WEB-INF/lib/jruby-rack-0.9.5.jar!/jruby/rack/rails.rb:148:in
`call'
file:/var/lib/tomcat6/webapps/ida2/WEB-INF/lib/jruby-rack-0.9.5.jar!/rack/handler/servlet.rb:18:in
`call'
file:/var/lib/tomcat6/webapps/ida2/WEB-INF/lib/jruby-stdlib-1.4.0.jar!/META-INF/jruby.home/lib/ruby/site_ruby/shared/builtin/javasupport/java.rb:50:in
`method_missing'
/usr/share/tomcat6/webapps/ida2/WEB-INF/gems/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:289:in
`qualified_const_defined?'
/usr/share/tomcat6/webapps/ida2/WEB-INF/gems/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:287:in
`each'
/usr/share/tomcat6/webapps/ida2/WEB-INF/gems/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:287:in
`inject'
/usr/share/tomcat6/webapps/ida2/WEB-INF/gems/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:287:in
`qualified_const_defined?'
/usr/share/tomcat6/webapps/ida2/WEB-INF/gems/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:413:in
`load_missing_constant'
/usr/share/tomcat6/webapps/ida2/WEB-INF/gems/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:96:in
`const_missing'
/usr/share/tomcat6/webapps/ida2/WEB-INF/gems/gems/activesupport-2.3.5/lib/active_support/inflector.rb:361:in
`constantize'
/usr/share/tomcat6/webapps/ida2/WEB-INF/gems/gems/activesupport-2.3.5/lib/active_support/inflector.rb:360:in
`each'
/usr/share/tomcat6/webapps/ida2/WEB-INF/gems/gems/activesupport-2.3.5/lib/active_support/inflector.rb:360:in
`constantize'
/usr/share/tomcat6/webapps/ida2/WEB-INF/gems/gems/activesupport-2.3.5/lib/active_support/core_ext/string/inflections.rb:162:in
`constantize'
/usr/share/tomcat6/webapps/ida2/WEB-INF/gems/gems/actionpack-2.3.5/lib/action_controller/routing/route_set.rb:443:in
`recognize'
/usr/share/tomcat6/webapps/ida2/WEB-INF/gems/gems/actionpack-2.3.5/lib/action_controller/routing/route_set.rb:436:in
`call'
/usr/share/tomcat6/webapps/ida2/WEB-INF/gems/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:87:in
`dispatch'
/usr/share/tomcat6/webapps/ida2/WEB-INF/gems/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:121:in
`_call'
/usr/share/tomcat6/webapps/ida2/WEB-INF/gems/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:130:in
`build_middleware_stack'
/usr/share/tomcat6/webapps/ida2/WEB-INF/gems/gems/activerecord-2.3.5/lib/active_record/query_cache.rb:29:in
`call'
/usr/share/tomcat6/webapps/ida2/WEB-INF/gems/gems/activerecord-2.3.5/lib/active_record/query_cache.rb:29:in
`call'
/usr/share/tomcat6/webapps/ida2/WEB-INF/gems/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in
`cache'
/usr/share/tomcat6/webapps/ida2/WEB-INF/gems/gems/activerecord-2.3.5/lib/active_record/query_cache.rb:9:in
`cache'
/usr/share/tomcat6/webapps/ida2/WEB-INF/gems/gems/activerecord-2.3.5/lib/active_record/query_cache.rb:28:in
`call'
/usr/share/tomcat6/webapps/ida2/WEB-INF/gems/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in
`call'
/usr/share/tomcat6/webapps/ida2/WEB-INF/gems/gems/actionpack-2.3.5/lib/action_controller/string_coercion.rb:25:in
`call'
/usr/share/tomcat6/webapps/ida2/WEB-INF/gems/gems/rack-1.0.1/lib/rack/head.rb:9:in
`call'
/usr/share/tomcat6/webapps/ida2/WEB-INF/gems/gems/rack-1.0.1/lib/rack/methodoverride.rb:24:in
`call'
/usr/share/tomcat6/webapps/ida2/WEB-INF/gems/gems/actionpack-2.3.5/lib/action_controller/params_parser.rb:15:in
`call'
/usr/share/tomcat6/webapps/ida2/WEB-INF/gems/gems/actionpack-2.3.5/lib/action_controller/session/cookie_store.rb:93:in
`call'
/usr/share/tomcat6/webapps/ida2/WEB-INF/gems/gems/actionpack-2.3.5/lib/action_controller/failsafe.rb:26:in
`call'
/usr/share/tomcat6/webapps/ida2/WEB-INF/gems/gems/rack-1.0.1/lib/rack/lock.rb:11:in
`call'
/usr/share/tomcat6/webapps/ida2/WEB-INF/gems/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:114:in
`call'
/usr/share/tomcat6/webapps/ida2/WEB-INF/gems/gems/actionpack-2.3.5/lib/action_controller/reloader.rb:34:in
`run'
/usr/share/tomcat6/webapps/ida2/WEB-INF/gems/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:108:in
`call'
file:/var/lib/tomcat6/webapps/ida2/WEB-INF/lib/jruby-rack-0.9.5.jar!/rack/adapter/rails.rb:35:in
`serve_rails'
file:/var/lib/tomcat6/webapps/ida2/WEB-INF/lib/jruby-rack-0.9.5.jar!/rack/adapter/rails.rb:51:in
`call'
file:/var/lib/tomcat6/webapps/ida2/WEB-INF/lib/jruby-rack-0.9.5.jar!/jruby/rack/rails.rb:148:in
`call'
file:/var/lib/tomcat6/webapps/ida2/WEB-INF/lib/jruby-rack-0.9.5.jar!/rack/handler/servlet.rb:18:in
`call'
:1
Request
Parameters:

{"language"=>"en",
 "brand"=>"ida"}

Show session dump

---

Response
Headers:

{"Cache-Control"=>"no-cache",
 "Content-Type"=>""}
======================================================================

Regards,
Jas
Posted by Jas Grewal (jgrewal)
on 2010-03-02 18:11
After a few print statements in active_support/dependencies.rb class in 
'qualified_const_defined?' method, I notice that this error occurs after 
this method is trying to resolve a Java class named Client with some 
package name. Could there be a conflict with resolving the package 
Client of the controller Client::AuthController?

-Jas
Posted by Charles Nutter (headius)
on 2010-03-02 19:34
(Received via mailing list)
It certainly could be. Can you file a bug for it and try to reduce it
to a simple case? You may also want to try on JRuby 1.5, where some
class resolution/const_missing issues have been fixed.

On Tue, Mar 2, 2010 at 11:11 AM, Jas Grewal <lists@ruby-forum.com> 
wrote:
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email
Posted by Jas Grewal (jgrewal)
on 2010-03-03 23:15
Thanks Charles,

I'll try to reduce the problem. I have filed a bug for it:
http://jira.codehaus.org/browse/JRUBY-4613

I thought the latest version of JRuby was 1.4. Where can I get version 
1.5 from?

Regards,
Jas
Posted by Charles Nutter (headius)
on 2010-03-04 01:21
(Received via mailing list)
On Wed, Mar 3, 2010 at 4:15 PM, Jas Grewal <lists@ruby-forum.com> wrote:
> Thanks Charles,
>
> I'll try to reduce the problem. I have filed a bug for it:
> http://jira.codehaus.org/browse/JRUBY-4613
>
> I thought the latest version of JRuby was 1.4. Where can I get version
> 1.5 from?

At http://ci.jruby.org/snapshots :)

- Charlie

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email
Posted by Jas Grewal (jgrewal)
on 2010-03-12 18:45
Hi,

I was finally able to resolve the problem. It was related to another 
issue that I have posted:
http://www.ruby-forum.com/topic/205436#new

Upgrading jruby-rack jar file from 0.9.5 to 0.9.6, resolved the problem.

From what I understand, there is a problem with locking in jruby-rack 
jar file, which was causing a deadlock. I was able to get around that by 
removing a lock in action-pack gem reloader class (see the above post 
for more info).
I didn't get any deadlocks after that, but it removing the lock caused 
problem with loading of the classes.

Thank you for all your help. I really appreciate it.

Regards,
Jas
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.