ruby on rails - JRuby Rails3 Trinidad/Jetty_Rails fails on simplest install - feeling as dim as a 2watt bulb -


ok. been getting quite frustrated trying jruby/rails3 running jetty , tomcat. trying local install of jruby/rails3 , jetty/tomcat app running on os-x. (and ubuntu stage , live server) error on startup

could not find activerecord-jdbc-adapter-1.1.1 in of sources try running `bundle install`. 

i've tried googling myself distraction trying find out why happens. 1 source mentioned issue 'bundler' didn't give version information. others gave varying options change gemfile have tried exhaustively last 5 hours no luck.

in exasperation decided start scratch plain install.

installed jruby in /opt/jruby-1.6.0.rc1/ symlink /opt/jruby. gems installed:

jruby -s gem list  *** local gems ***  abstract (1.0.0) actionmailer (3.0.3, 2.3.5) actionpack (3.0.3, 2.3.5) activemodel (3.0.3) activerecord (3.0.3, 2.3.5) activerecord-jdbc (0.5) activerecord-jdbc-adapter (1.1.1) activerecord-jdbcmysql-adapter (1.1.1) activeresource (3.0.3, 2.3.5) activesupport (3.0.3, 2.3.5) arel (2.0.8, 2.0.7, 2.0.6) bouncy-castle-java (1.5.0145.2) builder (2.1.2) bundler (1.0.10) daemon_controller (0.2.5) erubis (2.6.6) fastthread (1.0.7) file-tail (1.0.5) gem_plugin (0.2.3) htmlentities (4.2.4) i18n (0.5.0) jdbc-mysql (5.1.13) jetty-rails (0.8.1) jruby-jars (1.5.6) jruby-openssl (0.7.3) jruby-rack (1.0.5) mail (2.2.15, 2.2.12) mime-types (1.16) mongrel (1.1.5 java) nokogiri (1.4.1 java) passenger (3.0.2) polyglot (0.3.1) rack (1.2.1, 1.0.1) rack-mount (0.6.13) rack-test (0.5.7, 0.5.6) rails (3.0.3, 2.3.5) railties (3.0.3) rake (0.8.7) ruby-mp3info (0.6.13) rubyzip (0.9.4) sources (0.0.1) spruz (0.2.5) thor (0.14.6) treetop (1.4.9) trinidad (1.0.5) trinidad_jars (1.0.0) tzinfo (0.3.24, 0.3.23) warbler (1.2.1) 

as can see have installed quite few gems working. sigh... might activerecord-jdbc?

anyway, go dev folder:

cd ~/dev_folder jruby -s rails new test_app --database mysql --template http://jruby.org ...the normal create/apply/gsub output... cd test_app bundle install ...normal bundle output... using activerecord (3.0.3)  using activerecord-jdbc-adapter (1.1.1)  using activeresource (3.0.3)  using bundler (1.0.10)  using jdbc-mysql (5.1.13)  ...rest of bundle output... 

now start trinidad example:

jruby -s trinidad feb 9, 2011 1:36:13 pm org.apache.coyote.abstractprotocolhandler init info: initializing protocolhandler ["http-bio-3000"] feb 9, 2011 1:36:13 pm org.apache.catalina.core.standardservice startinternal info: starting service tomcat feb 9, 2011 1:36:13 pm org.apache.catalina.core.standardengine startinternal info: starting servlet engine: apache tomcat/7.0.6 feb 9, 2011 1:36:13 pm org.apache.catalina.startup.contextconfig webconfig info: no global web.xml found feb 9, 2011 1:36:15 pm org.apache.catalina.core.applicationcontext log info: info: using runtime pool timeout of 30 seconds feb 9, 2011 1:36:15 pm org.apache.catalina.core.applicationcontext log info: info: received min runtimes = 1 feb 9, 2011 1:36:15 pm org.apache.catalina.core.applicationcontext log info: info: received max runtimes = 5 not find activerecord-jdbc-adapter-1.1.1 in of sources try running `bundle install`. exception in thread "jruby-rack-app-init-0" org.jruby.exceptions.mainexitexception: aborted feb 9, 2011 1:36:45 pm org.apache.coyote.abstractprotocolhandler start info: starting protocolhandler ["http-bio-3000"] ^c 

or jetty_rails:

jruby -s jetty_rails 2011-02-09 13:44:10.122::info:  logging stderr via org.mortbay.log.stderrlog starting server 3000 2011-02-09 13:44:10.272::info:  jetty-6.1.14 2011-02-09 13:44:11.045:/:info:  info: using runtime pool timeout of 30 seconds 2011-02-09 13:44:11.045:/:info:  info: received min runtimes = 1 2011-02-09 13:44:11.045:/:info:  info: received max runtimes = 5 not find activerecord-jdbc-adapter-1.1.1 in of sources try running `bundle install`. exception in thread "jruby-rack-app-init-0" org.jruby.exceptions.mainexitexception: aborted ^c 

i'm going re-install jruby in new folder , install absolute minimum gems , try same thing again.

in meantime, if has clue why happening please post, i'm sure i'm not alone on one...

kimbo.

ah. hmm. ok. here's transcript complete "from-bare-metal" install.

i archived previous jruby install , re-unpacked tarball, then:

jruby -s gem install rails jruby limited openssl loaded. http://jruby.org/openssl gem install jruby-openssl full support. fetching: activesupport-3.0.4.gem (100%) fetching: builder-2.1.2.gem (100%) fetching: i18n-0.5.0.gem (100%) fetching: activemodel-3.0.4.gem (100%) fetching: rack-1.2.1.gem (100%) fetching: rack-test-0.5.7.gem (100%) fetching: rack-mount-0.6.13.gem (100%) fetching: tzinfo-0.3.24.gem (100%) fetching: abstract-1.0.0.gem (100%) fetching: erubis-2.6.6.gem (100%) fetching: actionpack-3.0.4.gem (100%) fetching: arel-2.0.8.gem (100%) fetching: activerecord-3.0.4.gem (100%) fetching: activeresource-3.0.4.gem (100%) fetching: mime-types-1.16.gem (100%) fetching: polyglot-0.3.1.gem (100%) fetching: treetop-1.4.9.gem (100%) fetching: mail-2.2.15.gem (100%) fetching: actionmailer-3.0.4.gem (100%) fetching: thor-0.14.6.gem (100%) fetching: railties-3.0.4.gem (100%) fetching: bundler-1.0.10.gem (100%) fetching: rails-3.0.4.gem (100%) installed activesupport-3.0.4 installed builder-2.1.2 installed i18n-0.5.0 installed activemodel-3.0.4 installed rack-1.2.1 installed rack-test-0.5.7 installed rack-mount-0.6.13 installed tzinfo-0.3.24 installed abstract-1.0.0 installed erubis-2.6.6 installed actionpack-3.0.4 installed arel-2.0.8 installed activerecord-3.0.4 installed activeresource-3.0.4 installed mime-types-1.16 installed polyglot-0.3.1 installed treetop-1.4.9 installed mail-2.2.15 installed actionmailer-3.0.4 installed thor-0.14.6 installed railties-3.0.4 installed bundler-1.0.10 installed rails-3.0.4 23 gems installed 

install other gems:

jruby -s gem install jruby-openssl jruby limited openssl loaded. http://jruby.org/openssl gem install jruby-openssl full support. fetching: bouncy-castle-java-1.5.0145.2.gem (100%) fetching: jruby-openssl-0.7.3.gem (100%) installed bouncy-castle-java-1.5.0145.2 installed jruby-openssl-0.7.3 2 gems installed  jruby -s gem install activerecord-jdbc-adapter  fetching: activerecord-jdbc-adapter-1.1.1.gem (100%) installed activerecord-jdbc-adapter-1.1.1 1 gem installed  jruby -s gem install trinidad fetching: trinidad_jars-1.0.0.gem (100%) fetching: jruby-rack-1.0.5.gem (100%) fetching: trinidad-1.0.5.gem (100%) installed trinidad_jars-1.0.0 installed jruby-rack-1.0.5 installed trinidad-1.0.5 3 gems installed  jruby -s gem install jetty-rails fetching: jetty-rails-0.8.1.gem (100%) postinstall.txt installed jetty-rails-0.8.1 1 gem installed  jruby -s gem list  *** local gems ***  abstract (1.0.0) actionmailer (3.0.4, 2.3.5) actionpack (3.0.4, 2.3.5) activemodel (3.0.4) activerecord (3.0.4, 2.3.5) activerecord-jdbc-adapter (1.1.1) activerecord-jdbcmysql-adapter (1.1.1) activeresource (3.0.4, 2.3.5) activesupport (3.0.4, 2.3.5) arel (2.0.8) bouncy-castle-java (1.5.0145.2) builder (2.1.2) bundler (1.0.10) erubis (2.6.6) i18n (0.5.0) jdbc-mysql (5.1.13) jetty-rails (0.8.1) jruby-openssl (0.7.3) jruby-rack (1.0.5) mail (2.2.15) mime-types (1.16) nokogiri (1.4.1 java) polyglot (0.3.1) rack (1.2.1, 1.0.1) rack-mount (0.6.13) rack-test (0.5.7) rails (3.0.4, 2.3.5) railties (3.0.4) rake (0.8.7) ruby-mp3info (0.6.13) sources (0.0.1) thor (0.14.6) treetop (1.4.9) trinidad (1.0.5) trinidad_jars (1.0.0) tzinfo (0.3.24)  jruby -s rails new testapp --database=mysql --template http://jruby.org create   create  readme ... blah blah... ... create  vendor/plugins create  vendor/plugins/.gitkeep apply  http://jruby.org apply    http://jruby.org/templates/default.rb gsub      gemfile gsub      config/database.yml  cd testapp cat gemfile source 'http://rubygems.org'  gem 'rails', '3.0.4'  # bundle edge rails instead: # gem 'rails', :git => 'git://github.com/rails/rails.git'  platforms :ruby   gem 'mysql2' end  platforms :jruby   gem 'activerecord-jdbc-adapter'   gem 'jdbc-mysql', :require => false end ...blah blah...  cat config/database.yml  ...elided... development:   adapter: mysql   encoding: utf8   reconnect: false   database: testapp_development   pool: 5   username: root   password:   socket: /tmp/mysql.sock ...elided...  bundle install fetching source index http://rubygems.org/ using rake (0.8.7)  using abstract (1.0.0)  using activesupport (3.0.4)  using builder (2.1.2)  using i18n (0.5.0)  using activemodel (3.0.4)  using erubis (2.6.6)  using rack (1.2.1)  using rack-mount (0.6.13)  using rack-test (0.5.7)  using tzinfo (0.3.24)  using actionpack (3.0.4)  using mime-types (1.16)  using polyglot (0.3.1)  using treetop (1.4.9)  using mail (2.2.15)  using actionmailer (3.0.4)  using arel (2.0.8)  using activerecord (3.0.4)  using activerecord-jdbc-adapter (1.1.1)  using activeresource (3.0.4)  using bundler (1.0.10)  using jdbc-mysql (5.1.13)  using thor (0.14.6)  using railties (3.0.4)  using rails (3.0.4)  bundle complete! use `bundle show [gemname]` see bundled gem installed. 

now create databases:

mysql> create database testapp_development default character set utf8; query ok, 1 row affected (0.05 sec)  mysql> create database testapp_test default character set utf8; query ok, 1 row affected (0.00 sec)  mysql> create database testapp_production default character set utf8; query ok, 1 row affected (0.02 sec) 

test webrick:

jruby -s rails server => booting webrick => rails 3.0.4 application starting in development on http://0.0.0.0:3000 => call -d detach => ctrl-c shutdown server [2011-02-09 14:40:40] info  webrick 1.3.1 [2011-02-09 14:40:40] info  ruby 1.8.7 (2011-01-10) [java] [2011-02-09 14:40:40] info  webrick::httpserver#start: pid=25549 port=3000 started "/rails/info/properties" 0:0:0:0:0:0:0:1%0 @ wed feb 09 14:40:43 +1000 2011 sql (3.0ms)  set sql_auto_is_null=0 processing rails::infocontroller#properties  rendered inline template (1.0ms) completed 200 ok in 269ms (views: 7.0ms | activerecord: 3.0ms) 

browse http://localhost:3000/rails/info/properties

ruby version    1.8.7 (java) rubygems version    1.4.2 rack version    1.2 rails version   3.0.4 active record version   3.0.4 action pack version 3.0.4 active resource version 3.0.4 action mailer version   3.0.4 active support version  3.0.4 middleware   actiondispatch::static rack::lock activesupport::cache::strategy::localcache rack::runtime rails::rack::logger actiondispatch::showexceptions actiondispatch::remoteip rack::sendfile actiondispatch::callbacks activerecord::connectionadapters::connectionmanagement activerecord::querycache actiondispatch::cookies actiondispatch::session::cookiestore actiondispatch::flash actiondispatch::paramsparser rack::methodoverride actiondispatch::head actiondispatch::beststandardssupport application root    /users/kim/projects/testapp environment development database adapter    mysql database schema version 0 

try trinidad:

jruby -s trinidad feb 9, 2011 2:42:05 pm org.apache.coyote.abstractprotocolhandler init info: initializing protocolhandler ["http-bio-3000"] feb 9, 2011 2:42:05 pm org.apache.catalina.core.standardservice startinternal info: starting service tomcat feb 9, 2011 2:42:05 pm org.apache.catalina.core.standardengine startinternal info: starting servlet engine: apache tomcat/7.0.6 feb 9, 2011 2:42:05 pm org.apache.catalina.startup.contextconfig webconfig info: no global web.xml found feb 9, 2011 2:42:07 pm org.apache.catalina.core.applicationcontext log info: info: using runtime pool timeout of 30 seconds feb 9, 2011 2:42:07 pm org.apache.catalina.core.applicationcontext log info: info: received min runtimes = 1 feb 9, 2011 2:42:07 pm org.apache.catalina.core.applicationcontext log info: info: received max runtimes = 5 not find jdbc-mysql-5.1.13 in of sources feb 9, 2011 2:42:10 pm org.apache.catalina.core.applicationcontext log severe: error: unable initialize application org.jruby.rack.rackinitializationexception: exit org/jruby/rubykernel.java:838:in `exit' /opt/jruby-1.6.0.rc1/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/setup.rb:10:in `(root)' org/jruby/rubykernel.java:1041:in `require' /opt/jruby-1.6.0.rc1/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/setup.rb:34:in `require' /users/kim/rubymineprojects/testapp/config/boot.rb:6:in `(root)' org/jruby/rubykernel.java:1041:in `require' /users/kim/rubymineprojects/testapp/config/boot.rb:165:in `load_environment' file:/opt/jruby-1.6.0.rc1/lib/ruby/gems/1.8/gems/jruby-rack-1.0.5/lib/jruby-rack-1.0.5.jar!/jruby/rack/rails.rb:173:in `to_app' file:/opt/jruby-1.6.0.rc1/lib/ruby/gems/1.8/gems/jruby-rack-1.0.5/lib/jruby-rack-1.0.5.jar!/jruby/rack/rails.rb:194:in `new' <web.xml>:1:in `(root)' org/jruby/rubyobject.java:1204:in `instance_eval' file:/opt/jruby-1.6.0.rc1/lib/ruby/gems/1.8/gems/jruby-rack-1.0.5/lib/jruby-rack-1.0.5.jar!/vendor/rack-1.2.1/rack/builder.rb:46:in `initialize' <web.xml>:1:in `(root)' @ org.jruby.rack.defaultrackapplicationfactory$4.init(defaultrackapplicationfactory.java:198) @ org.jruby.rack.poolingrackapplicationfactory$1.run(poolingrackapplicationfactory.java:160) @ java.lang.thread.run(thread.java:680) caused by: org.jruby.exceptions.raiseexception: (systemexit) exit 

whoops. missed jdbc-mysql:

jruby -s gem install jdbc-mysql installed jdbc-mysql-5.1.13 1 gem installed  jruby -s trinidad feb 9, 2011 2:45:03 pm org.apache.coyote.abstractprotocolhandler init info: initializing protocolhandler ["http-bio-3000"] feb 9, 2011 2:45:03 pm org.apache.catalina.core.standardservice startinternal info: starting service tomcat feb 9, 2011 2:45:03 pm org.apache.catalina.core.standardengine startinternal info: starting servlet engine: apache tomcat/7.0.6 feb 9, 2011 2:45:04 pm org.apache.catalina.startup.contextconfig webconfig info: no global web.xml found feb 9, 2011 2:45:05 pm org.apache.catalina.core.applicationcontext log info: info: using runtime pool timeout of 30 seconds feb 9, 2011 2:45:05 pm org.apache.catalina.core.applicationcontext log info: info: received min runtimes = 1 feb 9, 2011 2:45:05 pm org.apache.catalina.core.applicationcontext log info: info: received max runtimes = 5 feb 9, 2011 2:45:13 pm org.apache.catalina.core.applicationcontext log info: info: add application pool. size = 1 feb 9, 2011 2:45:13 pm org.apache.coyote.abstractprotocolhandler start info: starting protocolhandler ["http-bio-3000"] feb 9, 2011 2:45:19 pm org.apache.catalina.core.applicationcontext log info:  

browse http://localhost:3000/rails/info/properties , ok.

started "/rails/info/properties" 0:0:0:0:0:0:0:1%0 @ wed feb 09 14:45:19 +1000 2011 feb 9, 2011 2:45:19 pm org.apache.catalina.core.applicationcontext log info:   sql (4.0ms)  set sql_auto_is_null=0 feb 9, 2011 2:45:19 pm org.apache.catalina.core.applicationcontext log info:   processing rails::infocontroller#properties  feb 9, 2011 2:45:20 pm org.apache.catalina.core.applicationcontext log info: rendered inline template (2.0ms) feb 9, 2011 2:45:20 pm org.apache.catalina.core.applicationcontext log info: completed 200 ok in 75ms (views: 9.0ms | activerecord: 4.0ms) 

edit public index.html , changes available.

now try jetty_rails

jruby -s jetty_rails /opt/jruby-1.6.0.rc1/lib/ruby/site_ruby/1.8/rubygems.rb:242:in `activate': can't activate activesupport (= 2.3.5, runtime) [], activated activesupport-3.0.4 ["jetty-rails-0.8.1"] (gem::loaderror) /opt/jruby-1.6.0.rc1/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:33:in `require' /opt/jruby-1.6.0.rc1/lib/ruby/gems/1.8/gems/jetty-rails-0.8.1/lib/jetty_rails.rb:10:in `(root)' org/jruby/rubykernel.java:1041:in `require' /opt/jruby-1.6.0.rc1/lib/ruby/gems/1.8/gems/jetty-rails-0.8.1/lib/jetty_rails.rb:29:in `require' /opt/jruby-1.6.0.rc1/lib/ruby/gems/1.8/gems/jetty-rails-0.8.1/bin/jetty_rails:37:in `(root)' org/jruby/rubykernel.java:1066:in `load' 

the fix edit /opt/jruby-1.6.0.rc1/lib/ruby/gems/1.8/gems/jetty-rails-0.8.1/lib/jetty_rails.rb:

vi /opt/jruby-1.6.0.rc1/lib/ruby/gems/1.8/gems/jetty-rails-0.8.1/lib/jetty_rails.rb 

change this:

require "java" require "rubygems" require "activesupport" require "jetty_rails/jars" 

to this:

require "java" require "rubygems" #require "activesupport" require "active_support" require "active_support/all" require "jetty_rails/jars" 

this should use rails version if/else quick fix.

jruby -s jetty_rails 2011-02-09 14:49:45.918::info:  logging stderr via org.mortbay.log.stderrlog starting server 3000 2011-02-09 14:49:46.131::info:  jetty-6.1.14 2011-02-09 14:49:46.833:/:info:  info: using runtime pool timeout of 30 seconds 2011-02-09 14:49:46.834:/:info:  info: received min runtimes = 1 2011-02-09 14:49:46.834:/:info:  info: received max runtimes = 5 2011-02-09 14:49:53.122:/:warn:  error: unable initialize application org.jruby.rack.rackinitializationexception: uninitialized constant rack::runtime /opt/jruby-1.6.0.rc1/lib/ruby/gems/1.8/gems/railties-3.0.4/lib/rails/application.rb:189:in `tap' /opt/jruby-1.6.0.rc1/lib/ruby/gems/1.8/gems/railties-3.0.4/lib/rails/application.rb:189:in `default_middleware_stack' /opt/jruby-1.6.0.rc1/lib/ruby/gems/1.8/gems/railties-3.0.4/lib/rails/application.rb:161:in `app' /opt/jruby-1.6.0.rc1/lib/ruby/gems/1.8/gems/railties-3.0.4/lib/rails/application/finisher.rb:35:in `(class finisher)' /opt/jruby-1.6.0.rc1/lib/ruby/gems/1.8/gems/railties-3.0.4/lib/rails/initializable.rb:25:in `instance_exec' /opt/jruby-1.6.0.rc1/lib/ruby/gems/1.8/gems/railties-3.0.4/lib/rails/initializable.rb:25:in `run' /opt/jruby-1.6.0.rc1/lib/ruby/gems/1.8/gems/railties-3.0.4/lib/rails/initializable.rb:50:in `run_initializers' /opt/jruby-1.6.0.rc1/lib/ruby/gems/1.8/gems/railties-3.0.4/lib/rails/initializable.rb:49:in `each' /opt/jruby-1.6.0.rc1/lib/ruby/gems/1.8/gems/railties-3.0.4/lib/rails/initializable.rb:49:in `run_initializers' /opt/jruby-1.6.0.rc1/lib/ruby/gems/1.8/gems/railties-3.0.4/lib/rails/application.rb:134:in `initialize!' /opt/jruby-1.6.0.rc1/lib/ruby/gems/1.8/gems/railties-3.0.4/lib/rails/application.rb:77:in `send' /opt/jruby-1.6.0.rc1/lib/ruby/gems/1.8/gems/railties-3.0.4/lib/rails/application.rb:77:in `method_missing' /users/kim/rubymineprojects/testapp/config/environment.rb:5:in `(root)' /users/kim/rubymineprojects/testapp/config/environment.rb:26:in `load' /users/kim/rubymineprojects/testapp/config/environment.rb:26:in `load_environment' file:/opt/jruby-1.6.0.rc1/lib/ruby/gems/1.8/gems/jetty-rails-0.8.1/lib/jruby-rack-0.9.5-snapshot.jar!/jruby/rack/rails.rb:151:in `new' <script>:2:in `(root)' file:/opt/jruby-1.6.0.rc1/lib/ruby/gems/1.8/gems/jetty-rails-0.8.1/lib/jruby-rack-0.9.5-snapshot.jar!/rack/builder.rb:29:in `instance_eval' file:/opt/jruby-1.6.0.rc1/lib/ruby/gems/1.8/gems/jetty-rails-0.8.1/lib/jruby-rack-0.9.5-snapshot.jar!/rack/builder.rb:29:in `initialize' <script>:2:in `(root)' @ org.jruby.rack.defaultrackapplicationfactory$4.init(defaultrackapplicationfactory.java:153) @ org.jruby.rack.poolingrackapplicationfactory$1.run(poolingrackapplicationfactory.java:157) @ java.lang.thread.run(thread.java:680) caused by: org.jruby.exceptions.raiseexception: (nameerror) uninitialized constant rack::runtime 2011-02-09 14:50:17.048::info:  started selectchannelconnector@0.0.0.0:3000 

rats. close...

not specific answer question, might want check out torquebox running rails apps on jruby/jboss. easy , running.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -