|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
problem accessing H2 db in tomcat, w/warble war and jruby-rackI 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 |
|
|
|
|
|
Re: problem accessing H2 db in tomcat, w/warble war and jruby-rack>On Tue, Mar 18, 2008 at 10:44 PM, Stephen Bannasch
><stephen.bannasch@...> wrote: >> 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 > >I don't have enough familiarity with H2 to know why this is happening, >but there were some posts related to H2 recently that suggested you >connect to it through JNDI when running in the appserver. Have you >tried that? > It could be that I need to use JNDI -- BUT ... I sent a co-worker a screenshot of the blog app showing comments a couple of days ago -- and I was almost certain it was in Tomcat ??? at this point I'm not quite as sure ... I'm going to add a controller that doesn't use AR but will let me enter ruby code to be evaluated -- a real hacky IRB I can run inside tomcat. --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
|
Re: problem accessing H2 db in tomcat, w/warble war and jruby-rackAt 11:10 AM -0500 3/19/08, Nick Sieger wrote:
>On Tue, Mar 18, 2008 at 10:44 PM, Stephen Bannasch ><stephen.bannasch@...> wrote: >> 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 > >I don't have enough familiarity with H2 to know why this is happening, >but there were some posts related to H2 recently that suggested you >connect to it through JNDI when running in the appserver. Have you >tried that? Nick -- the problem appears to be related to the current working directory when the jdbc url is resolved. If I change the config/database.yml so that an complete path is specified to the database then H2 works in Tomcat. Here's an example or a config/database.yml that works: development: adapter: jdbch2 database: <%= RAILS_ROOT %>/db/sds_h2_database production: adapter: jdbch2 database: <%= RAILS_ROOT %>/db/sds_h2_database --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
| Free embeddable forum powered by Nabble | Forum Help |