#1122 ✓resolved
Alex Coles

ArgumentError when running dm-core specs using SQLite3 adapter on JRuby

Reported by Alex Coles | November 12th, 2009 @ 11:02 AM | in 1.0.0

ADAPTERS=sqlite3 jruby -S rake spec SPEC=spec/semipublic/adapters/sqlite3_adapter_spec.rb

results in

Could not connect to the database using "sqlite3::memory:" because: #<ArgumentError: wrong # of arguments(1 for 0)>

Using the same "sqlite3::memory:" URL error with DataObjects directly connects successfully. MRI does not exhibit same behaviour.

Comments and changes to this ticket

  • Alex Coles

    Alex Coles November 13th, 2009 @ 06:01 AM

    • State changed from “unconfirmed” to “accepted”
  • Alex Coles

    Alex Coles November 16th, 2009 @ 09:10 AM

    • State changed from “accepted” to “not-applicable”

    others couldn't confirm this one and after reinstalling dependencies, I'm no longer able to reproduce this issue.

  • Alex Coles

    Alex Coles November 16th, 2009 @ 01:32 PM

    • State changed from “not-applicable” to “accepted”

    Re-opened. Report of this occurring in #datamapper channel.

  • Peter Brant

    Peter Brant November 17th, 2009 @ 06:35 PM

    It might have a different root cause, but the explanation for this behavior is likely the same as I was seeing with the PG adapter. If there is a problem loading DoSqlite3ExtService, JRuby silently eats the exception. The result is that the entire Connection class consists of

      module DataObjects
        module Sqlite3
          class Connection
            def self.pool_size
              # sqlite3 can have only one write access at a time, with this
              # concurrent write access will result in "Database locked" errors

    which, of course, doesn't have an initialize method that takes the URL to connect to.

    JRuby's handling of this is pretty atrocious, IMO. The only way I could figure out what was going on was running JRuby (and Tomcat in my case) under the debugger.

  • Dan Kubb (dkubb)

    Dan Kubb (dkubb) November 18th, 2009 @ 04:38 AM

    (from [da1b14f6c2c98289824bcd9fc18feddb02de1742]) Prefer class_eval to reopening Connection class

    • Should aid situation where JRuby extension (do_DRIVER_ext.jar) does not load and no Error is raised. (Re-)opening the class in these situations was causing an ArgumentError to be raised (because the correct #initialize method is not defined) rather than a constant missing error.
    • Thanks to Peter Brant for helping diagnosis this behaviour.
    • Remove overriden pool_size: this is now defined for JRuby in DataObjects::Pooling.


    Signed-off-by: Alex Coles alex@alexcolesportfolio.com

  • Dan Kubb (dkubb)

    Dan Kubb (dkubb) February 1st, 2010 @ 04:33 PM

    • Milestone changed from 0.10.2 to 1.0.0
  • Dan Kubb (dkubb)

    Dan Kubb (dkubb) May 26th, 2010 @ 01:25 AM

    • State changed from “accepted” to “resolved”

    I just ran the dm-core specs with dm-sqlite3-adapter on JRuby and all specs pass. Marking this as resolved for now. If it is not, please create a new ticket or reopen this with a test case or instructions to reproduce the problem.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »