Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sinatra Jruby Heroku - jruby: No such file or directory -- trinidad (LoadError)

I'm trying to get this application running: github.com/Soliah/sinatra-jruby-heroku.git

One update was necessary according to this release note from Heroku:

http://devcenter.heroku.com/articles/release-note-java-2011-09-29

The build goes fine, without any errors. Bellow some log parts:

   [INFO] --- jruby-rake-plugin:1.6.3:jruby (install-bundler) @ jruby-heroku ---
   [INFO] Successfully installed bundler-1.0.21
   [INFO] 1 gem installed
   [INFO] 
   [INFO] --- jruby-rake-plugin:1.6.3:jruby (bundle-install) @ jruby-heroku ---
   [INFO] Fetching source index for http://rubygems.org/
   [INFO] Installing jruby-rack (1.0.10) 
   [INFO] Installing rack (1.3.2) 
   [INFO] Installing tilt (1.3.3) 
   [INFO] Installing sinatra (1.2.6) 
   [INFO] Installing trinidad_jars (1.0.1) 
   [INFO] Installing trinidad (1.2.3) 
   [INFO] Using bundler (1.0.21) 
   [INFO] Your bundle is complete! It was installed into ./vendor/bundle

   (...)

   [INFO] BUILD SUCCESS
   [INFO] ------------------------------------------------------------------------
   [INFO] Total time: 33.408s
   [INFO] Finished at: Tue Jan 31 10:58:03 UTC 2012
   [INFO] Final Memory: 9M/490M
   [INFO] ------------------------------------------------------------------------
  -----> Discovering process types
         Procfile declares types -> jruby, web
  -----> Compiled slug size is 18.6MB
  -----> Launching... done, v5
         http://jrubyandjava.herokuapp.com deployed to Heroku

But when I access the deployed application. An application error occurs.

Here is the log, with the error:

  $ heroku logs
  2012-01-31T10:57:21+00:00 heroku[slugc]: Slug compilation started
  2012-01-31T10:58:13+00:00 heroku[web.1]: State changed from created to starting
  2012-01-31T10:58:19+00:00 heroku[web.1]: Starting process with command `sh script/jruby -S trinidad -p 52233`
  2012-01-31T10:58:20+00:00 app[web.1]: Classpath is: :/app/etc:/app/target/dependency/jruby-complete.jar
  2012-01-31T10:58:21+00:00 app[web.1]: jruby: No such file or directory -- trinidad (LoadError)
  2012-01-31T10:58:23+00:00 heroku[web.1]: State changed from starting to crashed
  2012-01-31T10:58:23+00:00 heroku[web.1]: State changed from crashed to created
  2012-01-31T10:58:23+00:00 heroku[web.1]: State changed from created to starting
  2012-01-31T10:58:23+00:00 heroku[web.1]: Process exited
  2012-01-31T10:58:28+00:00 heroku[web.1]: Starting process with command `sh script/jruby -S trinidad -p 26224`
  2012-01-31T10:58:28+00:00 app[web.1]: Classpath is: :/app/etc:/app/target/dependency/jruby-complete.jar
  2012-01-31T10:58:31+00:00 app[web.1]: jruby: No such file or directory -- trinidad (LoadError)
  2012-01-31T10:58:32+00:00 heroku[web.1]: State changed from starting to crashed
  2012-01-31T10:58:33+00:00 heroku[web.1]: Process exited
  2012-01-31T10:58:33+00:00 heroku[router]: Error H10 (App crashed) -> GET jrubyandjava.herokuapp.com/ dyno= queue= wait= service= status=503 bytes=

It seems that JRuby is not finding the gems. But I've tried all kinds of configurations (in script/jruby, heroku config:add, Procfile, etc.) and no one worked.

One more thing: this is the actual heroku config output (stack cedar).

  $ heroku config
  DATABASE_URL        => postgres://kfgubrhars:[email protected]/kfgubrhars
  JAVA_OPTS           => -Xmx384m -Xss512k -XX:+UseCompressedOops
  MAVEN_OPTS          => -Xmx384m -Xss512k -XX:+UseCompressedOops
  PATH                => /usr/local/bin:/usr/bin:/bin
  SHARED_DATABASE_URL => postgres://kfgubrhars:[email protected]/kfgubrhars

Here is the updated repository: https://github.com/tomasmuller/sinatra-jruby-heroku

Thank's in advance!

like image 815
Tomás Müller Avatar asked Jan 23 '26 10:01

Tomás Müller


1 Answers

Ok! I found the solution. Here are the steps:

  • Adjust the GEM_HOME, in script/jruby to:

    GEM_HOME="$APPDIR"/vendor/bundle
    
  • Created the script/bundle, with ENV['GEM_HOME'] and ENV['GEM_PATH'] pointing to 'vendor/bundle' dir.

  • Adjusted the executions of jruby-rake-plugin, in pom.xml:

    install-bundler: <args>-S gem install bundler --no-ri --no-rdoc --install-dir vendor/bundle</args>
    
    bundle-install: <args>script/bundle install --without development:test</args>
    
like image 109
Tomás Müller Avatar answered Jan 24 '26 23:01

Tomás Müller