« Return to Thread: problem accessing H2 db in tomcat, w/warble war and jruby-rack

problem accessing H2 db in tomcat, w/warble war and jruby-rack

by Stephen Bannasch-3 :: Rate this Message:

Reply to Author | View in Thread

I have a very simple test Rails app here:

    https://svn.concord.org/svn/projects/trunk/common/rails/blog

The code is also visible in trac here:

   http://trac.cosmos.concord.org/projects/browser/trunk/common/rails/blog

It works fine in Mongrel but I can't seem to get database access
working when I create a WAR with Warble and deploy it with JRuby-Rack
to Tomcat.

I am using JRuby trunk r6268, trunk JRuby-Rack, warbler (0.9.4), and
activerecord-jdbc-adapter and activerecord-jdbch2-adapter v0.8

The README here:

http://trac.cosmos.concord.org/projects/browser/trunk/common/rails/blog/doc/README_FOR_APP

describes just how the app was pu together.

When deployed in Tomcat the tables in the database are not visible.

The home page view of the app:

http://trac.cosmos.concord.org/projects/browser/trunk/common/rails/blog/app/views/home/index.html.erb

produces this data when run in Mongrel:

ActiveRecord::Base.connection.config:
        * allow_concurrency => false
        * database => db/h2_database
        * hostname => localhost
        * adapter => jdbch2
        * url => jdbc:h2:db/h2_database
        * driver => org.h2.Driver
        * username => sa
        * password =>
        * retry_count => 5
        * connection_alive_sql => select 1
ActiveRecord::Base.connection.tables:
        * comments
        * schema_info


and this data when run from Tomcat:

RAILS_ROOT: /Users/stephen/dev/mytomcat/webapps/blog2/WEB-INF
ActiveRecord::Base.connection.config:
        * allow_concurrency => false
        * database => db/h2_database
        * hostname => localhost
        * adapter => jdbch2
        * url => jdbc:h2:db/h2_database
        * driver => org.h2.Driver
        * username => sa
        * password =>
        * retry_count => 5
        * connection_alive_sql => select 1
ActiveRecord::Base.connection.tables:
        *

In Tomcat no tables are visible.

Here's the error when I try and access comments/

ActiveRecord::StatementInvalid (ActiveRecord::ActiveRecordError:
Table COMMENTS not found; SQL statement:
SELECT * FROM comments    [42S02-63]: SELECT * FROM comments   ):
 
/gems/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract_adapter.rb:150:in
`log'
 
/gems/gems/activerecord-jdbc-adapter-0.8/lib/active_record/connection_adapters/jdbc_adapter.rb:520:in
`execute'
 
/gems/gems/activerecord-jdbc-adapter-0.8/lib/active_record/connection_adapters/jdbc_adapter.rb:580:in
`select'
 
/gems/gems/activerecord-jdbc-adapter-0.8/lib/active_record/connection_adapters/jdbc_adapter.rb:505:in
`jdbc_select_all'
 
/gems/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/query_cache.rb:53:in
`select_all_with_query_cache'
 
/gems/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/query_cache.rb:74:in
`cache_sql'
 
/gems/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/query_cache.rb:53:in
`select_all_with_query_cache'
     /gems/gems/activerecord-2.0.2/lib/active_record/base.rb:532:in
`find_by_sql'
     /gems/gems/activerecord-2.0.2/lib/active_record/base.rb:1231:in
`find_every'
     /gems/gems/activerecord-2.0.2/lib/active_record/base.rb:503:in `find'
     /app/controllers/comments_controller.rb:8:in `index'



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

    http://xircles.codehaus.org/manage_email


 « Return to Thread: problem accessing H2 db in tomcat, w/warble war and jruby-rack