Jruby 1.9 and count method doesn't work

rails c
irb(main):002:0> Shop.count
Java::JavaLang::NullPointerException

Why?
It’s strange to me that with jruby 1.9 the count method doesn’t work
while it works well with jruby 1.8.

On Sat, Sep 10, 2011 at 11:01 PM, Mauro [email protected] wrote:

rails c
irb(main):002:0> Shop.count
Java::JavaLang::NullPointerException

Why?

Why not? You cannot expect us to believe your reports if you miss
important info like jruby version, gem list or bundler gemfile, and in
this particular case how you configured database.yml …

It’s strange to me that with jruby 1.9 the count method doesn’t work
while it works well with jruby 1.8.

Look at this statement. Count does not work in 1.9. I’m sorry, but
‘count’ works.

Have you performed successfully your migrations? You should give more
info before systematically complaining.


Christian

jruby-1.6.4, activerecord-jdbc-adapter taken from github master branch
because version 1.1.3 is not compatible with rails 3.1.
My migrations are ok, in fact if I use jruby -v 1.8 and I do, for
example, Show.count, it works, I have the number of records of Show.
If I switch with jruby -v 1.9 and I do Show.count I have the error
Java::JavaLang::NullPointerException.
Database.yml is:

development:
adapter: postgresql
encoding: unicode
database: attivita_produttive_development
pool: 5
username: xxx
password: yyy

host: localhost
port: 5432

test: &test
adapter: postgresql
encoding: unicode
database: attivita_produttive_test
pool: 5
username: xxx
password: yyy

host: localhost
port: 5432

My Gemfile is:

gem ‘rails’
gem ‘annotate’
gem ‘normalize_attributes’
gem ‘haml-rails’
gem ‘devise_ldap_authenticatable’
gem ‘meta_search’
gem ‘simple_form’
gem ‘fastercsv’
gem ‘inherited_resources’
gem ‘app_config’
gem ‘simple-navigation’
gem ‘thin’
gem ‘kaminari’

I repeat that If I use jruby 1.8 I have no problems, they are only if
I use jruby 1.9.

On Sun, Sep 11, 2011 at 8:24 PM, Mauro [email protected] wrote:

encoding: unicode
encoding: unicode
gem ‘rails’
gem ‘thin’
gem ‘kaminari’

I repeat that If I use jruby 1.8 I have no problems, they are only if
I use jruby 1.9.

This database.yml is not using jdbc, so I fail to see why you keep
mentioning activerecord-jdbc-adapter.

It seems you’re mixing behavior from 1.8 and 1.9.

Are you really using jruby in 1.9 mode from the very start to the
first problems ? Or are you passing some failing steps using 1.8 mode
? In case you would be mixing 1.8 and 1.9, you might report an issue
that people cannot reproduce in 1.9 mode since they’ll see another
error prior to yours.


Christian

On Mon, Sep 12, 2011 at 9:40 AM, Mauro [email protected] wrote:

development:
test: &test
My Gemfile is:
gem ‘app_config’
mentioning activerecord-jdbc-adapter.
jruby 1.6.4 (ruby-1.9.2-p136) (2011-08-23 17ea768) (OpenJDK 64-Bit
Server VM 1.6.0_23) [linux-amd64-java]

If database.yml was wrong then, I think, nor Shop.all or Shop.find could work.
Instead these commands and others work, only Shop.count doesn’t work.
By the way I’ve changed the adapter using jdbcpostgresql and things do
not change.

I am not saying database.yml is wrong.

I am saying I do not understand the link between pure postgresql
database.yml and this sentence: << activerecord-jdbc-adapter taken
from github master branch because version 1.1.3 is not compatible with
rails 3.1 >>

You have not answered if you are using jruby in 1.9 mode from the very
start (gem bundling installation, rails project creation, etc…).

Separate suggestion : have you tried forcing 32 bits mode on your jvm ?


Christian

On 12 September 2011 09:45, Christian MICHON
[email protected] wrote:

I am not saying database.yml is wrong.

I am saying I do not understand the link between pure postgresql
database.yml and this sentence: << activerecord-jdbc-adapter taken
from github master branch because version 1.1.3 is not compatible with
rails 3.1 >>

I’ve read from
http://old.nabble.com/Migration-problem-in-Rails.3.1rc6-and-JRuby-td32325120.html

On 12 September 2011 09:19, Christian MICHON
[email protected] wrote:

adapter: postgresql
adapter: postgresql

gem ‘simple-navigation’

It seems you’re mixing behavior from 1.8 and 1.9.

Are you really using jruby in 1.9 mode from the very start to the
first problems ? Or are you passing some failing steps using 1.8 mode
? In case you would be mixing 1.8 and 1.9, you might report an issue
that people cannot reproduce in 1.9 mode since they’ll see another
error prior to yours.

jruby -v
jruby 1.6.4 (ruby-1.9.2-p136) (2011-08-23 17ea768) (OpenJDK 64-Bit
Server VM 1.6.0_23) [linux-amd64-java]

If database.yml was wrong then, I think, nor Shop.all or Shop.find could
work.
Instead these commands and others work, only Shop.count doesn’t work.
By the way I’ve changed the adapter using jdbcpostgresql and things do
not change.