RackInitializationException: cattr_accessor

I’m trying to run rails in Tomcat using a WAR file created with the
warble gem. When I hit the webserver, I get the following error:

org.jruby.rack.RackInitializationException: undefined method
`cattr_accessor’ for ActiveRecord::Base:Class

I have the following environment:

Warble 0.9.9
Tomcat 6.0.16
MySQL 5.0.38-Ubuntu
Rails 1.2.3
activerecord-jdbcmysql-adapter 0.8.2
Ubuntu 7.0.4 (Feisty)

Has anyone seen this problem?

Caleb

“I do not know which makes a man more conservative—to know nothing but
the present, or nothing but the past.”

  • John Maynard Keynes

On Tue, Jun 24, 2008 at 1:35 AM, Caleb P. [email protected]
wrote:

MySQL 5.0.38-Ubuntu
Rails 1.2.3
activerecord-jdbcmysql-adapter 0.8.2
Ubuntu 7.0.4 (Feisty)

Has anyone seen this problem?

Do you have anything unusual/non-standard in your Rails config? This
used to be the message you’d see if you mis-configured
activerecord-jdbc. Ah! But you’re using Rails 1.2! Do you have the
"require ‘jdbc_adapter’ line in config/environment.rb as per step 8 on
http://wiki.jruby.org/wiki/Running_Rails_with_ActiveRecord-JDBC ?

/Nick


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

On Tue, Jun 24, 2008 at 11:44 AM, Nick S. [email protected]
wrote:

Tomcat 6.0.16
"require ‘jdbc_adapter’ line in config/environment.rb as per step 8 on
http://wiki.jruby.org/wiki/Running_Rails_with_ActiveRecord-JDBC ?

/Nick

Hi Nick,

thanks for the reply. I don’t think I have anything unusual in the
Rails config. Yes, I added the following to the environment.rb file:

if RUBY_PLATFORM =~ /java/
require ‘rubygems’
gem ‘activerecord-jdbcmysql-adapter’
require ‘active_record/connection_adapters/jdbcmysql_adapter’
end

Otherwise, I haven’t touched the environment file. My database.yml
file looks like this (for all three db environments):

development:
adapter: jdbcmysql
database: xptoronto_development
username: root
password:
#socket: /var/run/mysqld/mysqld.sock

I’ve tried a number of different configurations for the database.yml
file with no luck. In your opinion, is upgrading to Rails Version 2.1
likely to make any difference?


Caleb

“I do not know which makes a man more conservative—to know nothing but
the present, or nothing but the past.”

  • John Maynard Keynes

On Tue, Jun 24, 2008 at 2:13 PM, Caleb P. [email protected]
wrote:

I’ve tried a number of different configurations for the database.yml
file with no luck. In your opinion, is upgrading to Rails Version 2.1
likely to make any difference?

My next best guess is that there’s a compatibility issue with AR-JDBC
and Rails 1.2. If you can, try a temporary upgrade to Rails 2.0.2 or
2.1 and see if that fixes the issue.

Do you see the same error running with jetty-rails (which uses
JRuby-Rack internally)?

/Nick


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

On Tue, Jun 24, 2008 at 3:52 PM, Nick S. [email protected]
wrote:

/Nick

I haven’t tried Jetty-Rails yet. I will try a Rails upgrade first (I
was planning to do so anyways on the next version of the app) and see
if that helps.
Thanks for the feedback Nick! I will let you know how it goes.


Caleb

“I do not know which makes a man more conservative—to know nothing but
the present, or nothing but the past.”

  • John Maynard Keynes

On Tue, Jun 24, 2008 at 5:17 PM, Caleb P. [email protected]
wrote:

#socket: /var/run/mysqld/mysqld.sock
JRuby-Rack internally)?
Caleb

“I do not know which makes a man more conservative—to know nothing but
the present, or nothing but the past.”

  • John Maynard Keynes

Hi Nick,

upgrading to rails 2.1.0 resolved the problem. Thanks again for your
help!


Caleb

“I do not know which makes a man more conservative—to know nothing but
the present, or nothing but the past.”

  • John Maynard Keynes

On Tue, Jun 24, 2008 at 10:27 PM, Caleb P. [email protected]
wrote:

upgrading to rails 2.1.0 resolved the problem. Thanks again for your help!

You’re welcome! Good to know, there’s probably a compatibility issue
with AR-JDBC 0.8 and Rails 1.2.

Thanks,
/Nick


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email