Git Product home page Git Product logo

jruby-rack's Introduction

JRuby-Rack

JRuby-Rack is a lightweight adapter for the Java Servlet environment that allows any (Ruby) Rack-based application to run unmodified in a Java Servlet container. JRuby-Rack supports Rails as well as any Rack-compatible Ruby web framework.

For more information on Rack, visit http://rack.github.io/.

This README (master) targets JRuby-Rack 1.2 (unreleased) please use the 1.1-stable branch for current stable 1.1.x releases.

Gem Version Build Status

Compatibility

JRuby-Rack 1.1.x aims to be compatible with JRuby >= 1.6.4 (we recommend 1.7.x), Generally, any container that supports Java Servlet >= 2.5 (JEE 5) is supported.

JRuby-Rack 1.2.x is expected to officially support JRuby >= 1.7.10 and will be compiled against the Java Servlet 3.0 API.

Getting Started

The most-common way to use JRuby-Rack with a Java server is to get Warbler.

Warbler depends on the latest version of JRuby-Rack and ensures it gets placed in your WAR file when it gets built.

If you're assembling your own WAR using other means, you can install the jruby-rack gem. It provides a method to locate the jar file:

require 'jruby-rack'
FileUtils.cp JRubyJars.jruby_rack_jar_path, '.'

Otherwise you'll need to download the latest jar release, drop it into the WEB-INF/lib directory and configure the RackFilter in your application's web.xml (see following examples).

Alternatively you can use a server built upon JRuby-Rack such as Trinidad with sensible defaults, without the need to configure a deployment descriptor.

Rails

Here's sample web.xml configuration for Rails. Note the environment and min/max runtime parameters. For multi-threaded (a.k.a. threadsafe!) Rails with a single runtime, set min/max both to 1. Otherwise, define the size of the runtime pool as you wish.

<context-param>
  <param-name>rails.env</param-name>
  <param-value>production</param-value>
</context-param>
<context-param>
  <param-name>jruby.min.runtimes</param-name>
  <param-value>1</param-value>
</context-param>
<context-param>
  <param-name>jruby.max.runtimes</param-name>
  <param-value>1</param-value>
</context-param>

<filter>
  <filter-name>RackFilter</filter-name>
  <filter-class>org.jruby.rack.RackFilter</filter-class>
  <!-- optional filter configuration init-params : -->
  <init-param>
    <param-name>resetUnhandledResponse</param-name>
    <param-value>true</param-value> <!-- true (default), false or buffer -->
  </init-param>
  <init-param>
    <param-name>addsHtmlToPathInfo</param-name>
    <param-value>true</param-value> <!-- true (default), false -->
  </init-param>
  <init-param>
    <param-name>verifiesHtmlResource</param-name>
    <param-value>false</param-value> <!-- true, false (default) -->
  </init-param>
</filter>
<filter-mapping>
  <filter-name>RackFilter</filter-name>
  <url-pattern>/*</url-pattern>
</filter-mapping>

<listener>
  <listener-class>org.jruby.rack.rails.RailsServletContextListener</listener-class>
</listener>

(Other) Rack Applications

The main difference when using a non-Rails Rack application is that JRuby-Rack looks for a "rackup" file named config.ru in WEB-INF/config.ru or WEB-INF/*/config.ru. Here's a sample web.xml configuration :

<filter>
  <filter-name>RackFilter</filter-name>
  <filter-class>org.jruby.rack.RackFilter</filter-class>
  <!-- optional filter configuration init-params (@see above) -->
</filter>
<filter-mapping>
  <filter-name>RackFilter</filter-name>
  <url-pattern>/*</url-pattern>
</filter-mapping>

<listener>
  <listener-class>org.jruby.rack.RackServletContextListener</listener-class>
</listener>

If you don't have a config.ru or don't want to include it in your web app, you can embed it directly in the web.xml as follows (using Sinatra as an example):

<context-param>
  <param-name>rackup</param-name>
  <param-value>
    require 'rubygems'
    gem 'sinatra', '~&gt; 1.3'
    require './lib/app'
    set :run, false
    set :environment, :production
    run Sinatra::Application
  </param-value>
</context-param>

Be sure to escape angle-brackets for XML !

Servlet Filter

JRuby-Rack's main mode of operation is as a filter. This allows requests for static content to pass through and be served by the application server. Dynamic requests only happen for URLs that don't have a corresponding file, much like many Ruby/Rack applications expect. The (default) filter we recommend using is org.jruby.rack.RackFilter, the filter supports the following (optional) init-params:

  • responseNotHandledStatuses which statuses (when a filter chain returns) should be considered that the response has not been handled (default value: "403,404,405") and should be dispatched as a Rack application
  • resetUnhandledResponse whether an unhandled response from the filter chain gets reset (accepts values "true", "false" and "buffer" to reset the buffer only), by default "true"
  • addsHtmlToPathInfo controls whether the .html suffix is added to the URI when checking if the request is for a static page
  • verifiesHtmlResource used with the previous parameter to make sure the requested static resource exists before adding the .html request URI suffix

The application can also be configured to dispatch through a servlet instead of a filter, the servlet class name is org.jruby.rack.RackServlet.

Servlet Environment Integration

  • servlet context is accessible to any application through the Rack environment variable java.servlet_context (as well as the $servlet_context global).
  • the (native) servlet request and response objects could be obtained via the java.servlet_request and java.servlet_response keys
  • all servlet request attributes are passed through to the Rack environment (and thus might override request headers or Rack environment variables)
  • servlet sessions can be used as a (java) session store for Rails, session attributes with String keys (and String, numeric, boolean, or java object values) are automatically copied to the servlet session for you.

Rails

Several aspects of Rails are automatically set up for you.

  • ActionController::Base.relative_url_root is set for you automatically according to the context root where your webapp is deployed.
  • Rails.logger output is redirected to the application server log.
  • Page caching and asset directories are configured appropriately.

JRuby Runtime Management

JRuby runtime management and pooling is done automatically by the framework. In the case of Rails, runtimes are pooled by default (the default will most likely change with the adoption of Rails 4.0). For other Rack applications a single shared runtime is created and shared for every request by default. As of 1.1.9 if jruby.min.runtimes and jruby.max.runtimes values are specified pooling is supported for plain Rack applications as well.

We do recommend to boot your runtimes up-front to avoid the cost of initializing one while a request kicks in and find the pool empty, this can be easily avoided by setting jruby.min.runtimes equal to jruby.max.runtimes. You might also want to consider tuning the jruby.runtime.acquire.timeout parameter to not wait too long when all (max) runtimes from the pool are busy.

JRuby-Rack Configuration

JRuby-Rack can be configured by setting these key value pairs either as context init parameters in web.xml or as VM-wide system properties.

  • rackup: Rackup script for configuring how the Rack application is mounted. Required for Rack-based applications other than Rails. Can be omitted if a config.ru is included in the application root.
  • public.root: Relative path to the location of your application's static assets. Defaults to /.
  • rails.root: Root path to the location of the Rails application files. Defaults to /WEB-INF.
  • rails.env: Specify the Rails environment to run. Defaults to 'production'.
  • rails.relative_url_append: Specify a path to be appended to the ActionController::Base.relative_url_root after the context path. Useful for running a rails app from the same war as an existing app, under a sub-path of the main servlet context root.
  • gem.path: Relative path to the bundled gem repository. Defaults to /WEB-INF/gems.
  • jruby.compat.version: Set to "1.8" or "1.9" to make JRuby run a specific version of Ruby (same as the --1.8 / --1.9 command line flags).
  • jruby.min.runtimes: For non-threadsafe Rails applications using a runtime pool, specify an integer minimum number of runtimes to hold in the pool.
  • jruby.max.runtimes: For non-threadsafe Rails applications, an integer maximum number of runtimes to keep in the pool.
  • jruby.runtime.init.threads: How many threads to use for initializing application runtimes when pooling is used (default is 4). It does not make sense to set this value higher than jruby.max.runtimes.
  • jruby.runtime.init.serial: When using runtime pooling, this flag indicates that the pool should be created serially in the foreground rather than spawning (background) threads, it's by default off (set to false). For environments where creating threads is not permitted.
  • jruby.runtime.acquire.timeout: The timeout in seconds (default 10) to use when acquiring a runtime from the pool (while a pool maximum is set), an exception will be thrown if a runtime can not be acquired within this time ( accepts decimal values for fine tuning e.g. 1.25).
  • jruby.runtime.env: Allows to set a custom ENV hash for your Ruby environment and thus insulate the application from the environment it is running. By setting this option to en empty string (or 'false') it acts as if the ENV hash was cleared out (similar to the now deprecated jruby.rack.ignore.env option).
  • jruby.runtime.env.rubyopt: This option is used for compatibility with the (deprecated) jruby.rack.ignore.env option since it cleared out the ENV after RUBYOPT has been processed, by setting it to true ENV['RUBYOPT'] will be kept.
  • jruby.rack.logging: Specify the logging device to use. Defaults to servlet_context. See below.
  • jruby.rack.request.size.initial.bytes: Initial size for request body memory buffer, see also jruby.rack.request.size.maximum.bytes below.
  • jruby.rack.request.size.maximum.bytes: The maximum size for the request in memory buffer, if the body is larger than this it gets spooled to a tempfile.
  • jruby.rack.response.dechunk: Set to false to turn off response dechunking (Rails since 3.1 chunks response on render stream: true), it's on by default as frameworks such as Rails might use Rack::Chunked::Body as a Rack response body but since most servlet containers perform dechunking automatically things might end double-chunked in such cases.
  • jruby.rack.handler.env: EXPERIMENTAL Allows to change Rack's behavior on obtaining the Rack environment. The default behavior is that parameter parsing is left to be done by the Rack::Request itself (by consuming the request body in case of a POST), but if the servlet request's input stream has been previously read this leads to a limitation (Rack won't see the POST paras). Thus an alternate pure 'servlet' env "conversion" is provided that maps servlet parameters (and cookies) directly to Rack params, avoiding Rack's input parsing.
  • jruby.rack.filter.adds.html: deprecated use addsHtmlToPathInfo filter config init parameter. The default behavior for Rails and many other Ruby applications is to add an .html extension to the resource and attempt to handle it before serving a dynamic request on the original URI. However, this behavior may confuse other servlets in your application that have a wildcard mapping. Defaults to true.
  • jruby.rack.filter.verify.resource.exists: deprecated use verifiesHtmlResource filter config init parameter. If jruby.rack.filter.adds.html is true, then this setting, when true, adds an additional check using ServletContext#getResource to verify that the .html resource exists. Default is false. (Note that apparently some servers may not implement getResource in the way that is expected here, so in that case this setting won't matter.)

Initialization

There are often cases where you need to perform custom initialization of the Ruby environment before booting the application. You can create a file called META-INF/init.rb or WEB-INF/init.rb inside the war file for this purpose. These files, if found, will be evaluated before booting the Rack environment, allowing you to set environment variables, load scripts, etc.

For plain Rack applications, JRuby-Rack also supports a magic comment to solve the "rackup" chicken-egg problem (you need Rack's builder loaded before loading the config.ru, yet you may want to setup the gem version from within the rackup file). As we ship with the Rack gem bundled, otherwise when executing the provided config.ru the bundled (latest) version of Rack will get loaded.

Use rack.version to specify the Rack gem version to be loaded before rackup :

# encoding: UTF-8
# rack.version: ~>1.3.6 (before code is loaded gem '~>1.3.6' will be called)

Or the equivalent of doing bundle exec rackup ... if you're using Bundler :

# rack.version: bundler (requires 'bundler/setup' before loading the script)

Logging

JRuby-Rack sets up a delegate logger for Rails that sends logging output to javax.servlet.ServletContext#log by default. If you wish to use a different logging system, configure jruby.rack.logging as follows:

  • servlet_context (default): Sends log messages to the servlet context.
  • stdout: Sends log messages to the standard output stream System.out.
  • slf4j: Sends log messages to SLF4J. SLF4J configuration is left up to you, please refer to http://www.slf4j.org/docs.html .
  • log4j: Sends log messages to log4J. Again, Log4J configuration is left up to you, consult http://logging.apache.org/log4j/ .
  • commons_logging: Routes logs to commons-logging. You still need to configure an underlying logging implementation with JCL. We recommend using the logger library wrapper directly if possible, see http://commons.apache.org/logging/ .
  • jul: Directs log messages via Java's core logging facilities (util.logging).

For those loggers that require a specific named logger, set it with the jruby.rack.logging.name option, by default "jruby.rack" name will be used.

Building

Checkout the JRuby-Rack code using git :

git clone git://github.com/jruby/jruby-rack.git
cd jruby-rack

Ensure you have Maven installed. It is required for downloading jar artifacts that JRuby-Rack depends on.

Build the .jar using Maven :

mvn install

the generated jar should be located at target/jruby-rack-*.jar

Alternatively use Rake, e.g. to build the gem (skipping specs) :

jruby -S rake clean gem SKIP_SPECS=true

You can not use JRuby-Rack with Bundler directly from the git (or http) URL (gem 'jruby-rack', :github => 'jruby/jruby-rack') since the included .jar file is compiled and generated on-demand during the build (it would require us to package and push the .jar every time a commit changes a source file).

Support

Please use github to file bugs, patches and/or pull requests. More information at the wiki or ask us at #jruby's IRC channel.

jruby-rack's People

Contributors

ajuckel avatar atambo avatar baq avatar bugroger avatar calavera avatar cheister avatar cread avatar devth avatar emerose avatar eproxus avatar gconaty avatar guilleiguaran avatar headius avatar jberkel avatar joernh avatar jpedrosa avatar kares avatar ketan avatar kofno avatar mahaswami avatar mkristian avatar modille avatar nicksieger avatar nicobrevin avatar olabini avatar qqshfox avatar ratnikov avatar tedpennings avatar trajar avatar vfrride avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jruby-rack's Issues

JRuby::RackRewindableInput error using winstone executable war

This only appears to happen when I'm using the warbler winstone executable war:

[webapp 2011/03/15 11:35:42] - NoMethodError - undefined method `size' for #<JRuby::RackRewindableInput:0x79f71773>:
 ./lib/noah/ephemeral_routes.rb:22:in `PUT /e/*'
 /home/jvincent/.rvm/gems/jruby-1.5.6@noah_dev/gems/sinatra-1.1.2/lib/sinatra/base.rb:1057:in `compile!'
 /home/jvincent/.rvm/gems/jruby-1.5.6@noah_dev/gems/sinatra-1.1.2/lib/sinatra/base.rb:643:in `instance_eval'
 /home/jvincent/.rvm/gems/jruby-1.5.6@noah_dev/gems/sinatra-1.1.2/lib/sinatra/base.rb:643:in `route_eval'
 /home/jvincent/.rvm/gems/jruby-1.5.6@noah_dev/gems/sinatra-1.1.2/lib/sinatra/base.rb:627:in `route!'
 /home/jvincent/.rvm/gems/jruby-1.5.6@noah_dev/gems/sinatra-1.1.2/lib/sinatra/base.rb:675:in `process_route'
 /home/jvincent/.rvm/gems/jruby-1.5.6@noah_dev/gems/sinatra-1.1.2/lib/sinatra/base.rb:672:in `catch'
 /home/jvincent/.rvm/gems/jruby-1.5.6@noah_dev/gems/sinatra-1.1.2/lib/sinatra/base.rb:672:in `process_route'
 /home/jvincent/.rvm/gems/jruby-1.5.6@noah_dev/gems/sinatra-1.1.2/lib/sinatra/base.rb:626:in `route!'
 /home/jvincent/.rvm/gems/jruby-1.5.6@noah_dev/gems/sinatra-1.1.2/lib/sinatra/base.rb:625:in `each'
 /home/jvincent/.rvm/gems/jruby-1.5.6@noah_dev/gems/sinatra-1.1.2/lib/sinatra/base.rb:625:in `route!'
 /home/jvincent/.rvm/gems/jruby-1.5.6@noah_dev/gems/sinatra-1.1.2/lib/sinatra/base.rb:760:in `dispatch!'
 /home/jvincent/.rvm/gems/jruby-1.5.6@noah_dev/gems/sinatra-1.1.2/lib/sinatra/base.rb:553:in `call!'
 /home/jvincent/.rvm/gems/jruby-1.5.6@noah_dev/gems/sinatra-1.1.2/lib/sinatra/base.rb:725:in `instance_eval'
 /home/jvincent/.rvm/gems/jruby-1.5.6@noah_dev/gems/sinatra-1.1.2/lib/sinatra/base.rb:725:in `invoke'
 /home/jvincent/.rvm/gems/jruby-1.5.6@noah_dev/gems/sinatra-1.1.2/lib/sinatra/base.rb:725:in `catch'
 /home/jvincent/.rvm/gems/jruby-1.5.6@noah_dev/gems/sinatra-1.1.2/lib/sinatra/base.rb:725:in `invoke'
 /home/jvincent/.rvm/gems/jruby-1.5.6@noah_dev/gems/sinatra-1.1.2/lib/sinatra/base.rb:553:in `call!'
 /home/jvincent/.rvm/gems/jruby-1.5.6@noah_dev/gems/sinatra-1.1.2/lib/sinatra/base.rb:538:in `call'
 file:/tmp/winstone7809255237591438616webroot/noah.war/WEB-INF/lib/jruby-rack-1.0.7.jar!/vendor/rack-1.2.1/rack/commonlogger.rb:18:in `call'
 file:/tmp/winstone7809255237591438616webroot/noah.war/WEB-INF/lib/jruby-rack-1.0.7.jar!/rack/handler/servlet.rb:19:in `call'

You can see the code that triggers it here

You can download the war file from that project for testing. Simply sending an http post via curl will trigger the error:

 curl -XPUT -d"somerandomdata" http://localhost:8080/e/some/random/ephemeral/path

Silent failure of java_servlet_store with Rails 2.3.14

To recreate strange behavior:

  1. Get the example application Rails 2.3 app (jruby-rack/examples/rails) running under Trinidad with Rails 2.3.5. Everything looks good; can post data to sessions with http://localhost:3000/snoop/session_form
  2. Edit environment.rb and use Rails 2.3.14. Clear cookies/use other browser/etc.. Relaunch trinidad. Cannot store anything to session with http://localhost:3000/snoop/session_form No errors emitted. Just silent failure.

(Note this is not using a built war... just running trinidad in the app root.)

Using JRuby-1.6.4 in 1.8 mode, on Mac OS X 10.7 ...

*** LOCAL GEMS ***

actionmailer (2.3.14, 2.3.9, 2.3.8, 2.3.5)
actionpack (2.3.14, 2.3.9, 2.3.8, 2.3.5)
activerecord (2.3.14, 2.3.9, 2.3.8, 2.3.5)
activeresource (2.3.14, 2.3.9, 2.3.8, 2.3.5)
activesupport (2.3.14, 2.3.9, 2.3.8, 2.3.5)
bouncy-castle-java (1.5.0146.1)
jruby-jars (1.6.4)
jruby-launcher (1.0.8 java java)
jruby-openssl (0.7.4)
jruby-rack (1.0.10)
rack (1.1.2, 1.0.1)
rails (2.3.14, 2.3.9, 2.3.8, 2.3.5)
rake (0.9.2, 0.8.7 ruby)
rubyzip (0.9.4)
sources (0.0.1)
trinidad (1.2.3)
trinidad_jars (1.0.1)
warbler (1.3.2)

Better Bundler integration would be great

Hi,

they jruby-rack-Repos does not have a proper gemspec in its base path. This makes development of features that rely on a pre-release version on jruby-rack unnecessarily complex, as we (the Padrino team) cannot simply add the prerelease version to our Gemfile and start hacking away.

Case in point: we want to integrate the current trinidad prerelease version in Padrino which depends on a prerelease version of jruby-rack. At the moment, this means:

  • Add the rack branch of trinidad to our Gemfile
  • clone jruby-rack
  • pack jruby-rack
  • find out that it needs an old version of rspec
  • install old version of rspec
  • pack jruby-rack gem again
  • install jruby-rack gem

I would expect that the following Gemfile does all the work:

 gem "jruby-rack", :git => "...github/jruby/jruby-rack"
 gem "trinidad", :git => "...github/trinidad/trinidad", :branch => 'rack'

This would make it much easier for us to quickly check whether everything works on prerelease versions in the future.

As this project has a rather non-standard layout and needs some compilation, it would be nice if one of the maintainers could improve this situation.

Thank you in advance,
Florian

The rewindable rack input blocks until the entire request body is read

It seems that the following line will block the entire request until jruby-rack has the chance to buffer the entire request body (which prevents handling streaming requests).

https://github.com/nicksieger/jruby-rack/blob/master/src/main/java/org/jruby/rack/input/RackRewindableInput.java#L232

I'm spiking a servlet input stream wrapper that lazily writes to a tmpfile as it reads the stream. Not sure how it will turn out as my java-fu is weak.

jopenssl/version not loading

When loading my rails app from a compiled war, this error occurs (several times) during loading the app:

INFO: An exception happened during JRuby-Rack startup
load error: jopenssl -- java.lang.RuntimeException: (LoadError) no such file to load -- jopenssl/version

In a rails console (java -cp org.jruby.Main -S rails console production) on the server the file loads correctly.

The full error output can be found here: https://gist.github.com/1157043

Any hints greatly appreciated.
Chris

Release 1.1.0

The latest release was two months ago. Since then there have been a bunch of bug fixes and improvements. I think it's about time to release a new version.

I've created the milestone 1.1.0, that should be released next Monday. Please if you consider that any other bug in the open list should be included in this release, feel free to assign it to that milestone as soon as possible. Pull requests are really appreciated.

config.paths dot syntax is deprecated in Rails 3.1

Leads to lots of stuff like this in the logs on the latest version of rails:

DEPRECATION WARNING: Accessing paths using dot style as in `config.paths.app.controller` is deprecated. Please use `config.paths["app/controller"]` style instead. (called from Railtie at file:/private/var/folders/VL/VL5YOG6oHdGdG+1Qw1A1LE+++TM/-Tmp-/winstone7280557313637111506webroot/dashboard.war/WEB-INF/lib/jruby-rack-1.0.9.jar!/jruby/rack/rails/railtie.rb:14)

Looks like the updates need to happen starting on https://github.com/nicksieger/jruby-rack/blob/master/src/main/ruby/jruby/rack/rails/railtie.rb#L14

Classloader illegalStateException with Trinidad

Some users have reported this error in the last couple of weeks:

INFO: Illegal access: this web application instance has been stopped already.  Could not load java.lang.Object.  The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
java.lang.IllegalStateException
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1562)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:296)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
    at org.jruby.util.JRubyClassLoader.defineClass(JRubyClassLoader.java:76)
    at org.jruby.util.JRubyClassLoader.getJDBCDriverUnloader(JRubyClassLoader.java:66)
    at org.jruby.util.JRubyClassLoader.tearDown(JRubyClassLoader.java:47)
    at org.jruby.Ruby.tearDown(Ruby.java:2764)
    at org.jruby.embed.ScriptingContainer.terminate(ScriptingContainer.java:1719)
    at org.jruby.embed.ScriptingContainer.finalize(ScriptingContainer.java:1733)
    at java.lang.ref.Finalizer.invokeFinalizeMethod(Native Method)
    at java.lang.ref.Finalizer.runFinalizer(Finalizer.java:83)
    at java.lang.ref.Finalizer.access$100(Finalizer.java:14)
    at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:160)

Something happen when the application is redeploying and this error is raised. Otherwise it doesn't seem to affect anything but it's quite annoying and I wonder if it will be side effects if somebody tries to load java classes.

I don't know the cause yet but it seems it only happens with JRuby-rack 1.0.8.

relative_url_root= called for rails > 3

As of jruby-rack 1.1.1 it appears relative_url_root= is being called on Action controller. This method seems to no longer exist in the 3 series of rails. Downgrading to jruby-rack 1.0.10 works for me on rails 3.0.0.

We found this by printing out what options get set in:
actionpack-3.0.0/lib/action_controller/railtie.rb

Traceback from Jetty is here:
https://gist.github.com/db98d6cf59a82fed2e36

Issue with JRuby-Rack and OmniAuth

I have a rails application that I am developing using JRuby as the ruby implementation. My application is running fine locally when but when I deploy it using warbler I get errors stemming from this part of the OmniAuth code:

require 'omniauth/core'

module OmniAuth
class Builder < ::Rack::Builder
def initialize(app, &block)
@app = app
super(&block)
end
...

This is the relevant stack trace from the Java App server:

Caused by: org.jruby.rack.RackInitializationException: undefined method []' for nil:NilClass from org/jruby/RubyKernel.java:2021:ininstance_eval'
from file:/opt/tomcat7/webapps/ROOT/WEB-INF/lib/jruby-rack-1.0.8.jar!/vendor/rack-1.2.2/rack/builder.rb:46:in initialize' from /opt/tomcat7/webapps/ROOT/WEB-INF/gems/gems/oa-core-0.2.5/lib/omniauth/builder.rb:7:ininitialize'
from /opt/tomcat7/webapps/ROOT/WEB-INF/gems/gems/actionpack-3.0.7/lib/action_dispatch/middleware/stack.rb:33:in build' from /opt/tomcat7/webapps/ROOT/WEB-INF/gems/gems/actionpack-3.0.7/lib/action_dispatch/middleware/stack.rb:79:inbuild'
from org/jruby/RubyArray.java:1602:in each' from org/jruby/RubyEnumerable.java:820:ininject'
from /opt/tomcat7/webapps/ROOT/WEB-INF/gems/gems/actionpack-3.0.7/lib/action_dispatch/middleware/stack.rb:79:in build' from /opt/tomcat7/webapps/ROOT/WEB-INF/gems/gems/railties-3.0.7/lib/rails/application.rb:162:inapp'
from /opt/tomcat7/webapps/ROOT/WEB-INF/gems/gems/railties-3.0.7/lib/rails/application/finisher.rb:35:in `Finisher'

Not sure if this is a warbler/jruby-rack issue or a OmniAuth issue so I am asking both groups. Anybody know why this would be happening?

Rails 3 app - Sweeping not included in AC::Base

The exception:

NoMethodError: undefined method `cache_sweeper' for ActionController::Base:Class
            (root) at /var/cache/jetty/data/Jetty__8080_ROOT.war___d1a0el/webapp/WEB-INF/gems/gems/acts_as_audited-2.0.0.rc7/lib/acts_as_audited.rb:45
       module_eval at org/jruby/RubyModule.java:2221
            (root) at /var/cache/jetty/data/Jetty__8080_ROOT.war___d1a0el/webapp/WEB-INF/gems/gems/acts_as_audited-2.0.0.rc7/lib/acts_as_audited.rb:44
           require at org/jruby/RubyKernel.java:1038
           require at /var/cache/jetty/data/Jetty__8080_ROOT.war___d1a0el/webapp/WEB-INF/gems/gems/acts_as_audited-2.0.0.rc7/lib/acts_as_audited.rb:68
              each at org/jruby/RubyArray.java:1602
           require at /var/cache/jetty/data/Jetty__8080_ROOT.war___d1a0el/webapp/WEB-INF/gems/gems/bundler-1.0.15/lib/bundler/runtime.rb:66
              each at org/jruby/RubyArray.java:1602
           require at /var/cache/jetty/data/Jetty__8080_ROOT.war___d1a0el/webapp/WEB-INF/gems/gems/bundler-1.0.15/lib/bundler/runtime.rb:55
           require at /var/cache/jetty/data/Jetty__8080_ROOT.war___d1a0el/webapp/WEB-INF/gems/gems/bundler-1.0.15/lib/bundler.rb:120
            (root) at /var/cache/jetty/data/Jetty__8080_ROOT.war___d1a0el/webapp/WEB-INF/config/application.rb:9
           require at org/jruby/RubyKernel.java:1038
           require at /var/cache/jetty/data/Jetty__8080_ROOT.war___d1a0el/webapp/WEB-INF/gems/gems/activesupport-3.0.8/lib/active_support/dependencies.rb:239
   load_dependency at /var/cache/jetty/data/Jetty__8080_ROOT.war___d1a0el/webapp/WEB-INF/gems/gems/activesupport-3.0.8/lib/active_support/dependencies.rb:225
  new_constants_in at /var/cache/jetty/data/Jetty__8080_ROOT.war___d1a0el/webapp/WEB-INF/gems/gems/activesupport-3.0.8/lib/active_support/dependencies.rb:596
  new_constants_in at /var/cache/jetty/data/Jetty__8080_ROOT.war___d1a0el/webapp/WEB-INF/gems/gems/activesupport-3.0.8/lib/active_support/dependencies.rb:595
   load_dependency at /var/cache/jetty/data/Jetty__8080_ROOT.war___d1a0el/webapp/WEB-INF/gems/gems/activesupport-3.0.8/lib/active_support/dependencies.rb:225
           require at /var/cache/jetty/data/Jetty__8080_ROOT.war___d1a0el/webapp/WEB-INF/gems/gems/activesupport-3.0.8/lib/active_support/dependencies.rb:239
            (root) at /var/cache/jetty/data/Jetty__8080_ROOT.war___d1a0el/webapp/WEB-INF/config/application.rb:2
           require at org/jruby/RubyKernel.java:1038
           require at /var/cache/jetty/data/Jetty__8080_ROOT.war___d1a0el/webapp/WEB-INF/gems/gems/activesupport-3.0.8/lib/active_support/dependencies.rb:239
   load_dependency at /var/cache/jetty/data/Jetty__8080_ROOT.war___d1a0el/webapp/WEB-INF/gems/gems/activesupport-3.0.8/lib/active_support/dependencies.rb:225
  new_constants_in at /var/cache/jetty/data/Jetty__8080_ROOT.war___d1a0el/webapp/WEB-INF/gems/gems/activesupport-3.0.8/lib/active_support/dependencies.rb:596
  new_constants_in at /var/cache/jetty/data/Jetty__8080_ROOT.war___d1a0el/webapp/WEB-INF/gems/gems/activesupport-3.0.8/lib/active_support/dependencies.rb:595
   load_dependency at /var/cache/jetty/data/Jetty__8080_ROOT.war___d1a0el/webapp/WEB-INF/gems/gems/activesupport-3.0.8/lib/active_support/dependencies.rb:225
           require at /var/cache/jetty/data/Jetty__8080_ROOT.war___d1a0el/webapp/WEB-INF/gems/gems/activesupport-3.0.8/lib/active_support/dependencies.rb:239
  load_environment at /var/cache/jetty/data/Jetty__8080_ROOT.war___d1a0el/webapp/WEB-INF/config/environment.rb:169
            to_app at file:/var/cache/jetty/data/Jetty__8080_ROOT.war___d1a0el/webapp/WEB-INF/lib/jruby-rack-1.0.9.jar!/jruby/rack/rails.rb:173
               new at file:/var/cache/jetty/data/Jetty__8080_ROOT.war___d1a0el/webapp/WEB-INF/lib/jruby-rack-1.0.9.jar!/jruby/rack/rails.rb:193
            (root) at <web.xml>:1
     instance_eval at org/jruby/RubyKernel.java:2028
        initialize at file:/var/cache/jetty/data/Jetty__8080_ROOT.war___d1a0el/webapp/WEB-INF/lib/jruby-rack-1.0.9.jar!/vendor/rack-1.2.2/rack/builder.rb:46
            (root) at <web.xml>:1

Seems the cause is Jruby-Rack loading active_controller when active_record is not loaded yet, preventing sweeping from being included into ActionController.

A workaround is to add require 'active_record' if defined? $servlet_context after require 'rubygems' in config/boot.rb or manually including sweeping somwhere in application.rb ActionController::Base.send(:include, ActionController::Caching::Sweeping) if defined? $servlet_context.

A solution would be to use action_controller only when it's loaded by rails/bundler (after environment.rb).

Rails 3 java servlet session store

Trying to use java servlet session store in rails 3.0.5 and jruby-rack 1.0.8 and get the following error:

org.jruby.rack.RackInitializationException: uninitialized constant ActionController::Session::JavaServletStore::AbstractStore

Any thoughts?

load error: ffi_c

Yikes!

First time user of jruby-rack and I get the weird error:

load error: ffi_c -- java.lang.UnsatisfiedLinkError: dlopen(/private/var/folders/WB/WBqFMKf7GcKjLQYEwVEEO++++TI/-Tmp-/winstoneEmbeddedWAR/WEB-INF/gems/gems/ffi-0.6.3/lib/ffi_c.bundle, 9): Symbol not found: _environ

I'm not certain if this is a jruby-rack error or a winstone error, but I suspect it's a jruby-rack one. Any ideas?

SharedRackApplicationFactory substitutes error application for real one

If the rack application fails to initialize properly, SharedRackApplicationFactory creates a new application that delegates to the error application, responding to every request with the initialization exception stack trace.

This behavior can be helpful during development, but it's awful for production, and there's no way to disable it. In production, it would be best for the server not to start listening on the specified port. The desired behavior should be configurable, perhaps via the servlet context.

Sinatra app doesn't start with 1.0.8: Apparently jruby-rack 1.0.8 is incompatible with JRuby 1.5.6

I'm not sure if this counts as a bug, but because of JRUBY-5608 we're having to stick with JRuby 1.5.6 for the time-being. If this isn't a bug as such, perhaps it could be documented that 1.0.8 is no longer compatible with JRuby 1.5.x series.

This is the result of starting a Sinatra/Padrino app using jruby-rack 1.0.8:
https://gist.github.com/0c7b81e96f1bf1746ce6

Looks like its a change introduced as a result of the refactoring 1732b733 to use ScriptingContainer for runtime creation that's caused this. org.jruby.RubyInstanceConfig.requiredLibraries returns a java.util.List in JRuby 1.5.6, whereas in 1.6.0 it returns a java.util.Collection.

JRuby-Rack POST form-urlencoded doesn't work with Jetty

When using Jetty to deploy jruby-rack application, regular form posts do not work. I have dug into it and found that the issue is that Jetty pre-parses the request body to fill in getParameterMap map, so that when rack reads the body, it is blank. Unfortunately jruby-rack doesn't make use of the getParameterMap, so the parameters got lost.
I have trouble deciding which following approach is best to remedy the problem:

  1. Try to extend jruby-rack to make use of parameter map to set rack environment.
  2. have jruby-rack filter/servlet rebuild the body from the getParameterMap
  3. Have a special jetty handler that will kick in before the regular jetty handling goes.

I'd love to do some hacking but #2 feels hacky and I'm not sure what's the best way to provide parameters in #1. Any advice very appreciated!

https detection not working properly

undefined method `call' for nil:NilClass

WEB-INF/lib/jruby-rack-1.0.5.jar!/rack/handler/servlet.rb:19:in call': undefined methodcall' for nil:NilClass (NoMethodError)
from :1
...internal jruby stack elided...
from Rack::Handler::Servlet.call(:1)
from (unknown).(unknown)(:1)

Unable to access engine bindings/ global bindings inside jruby

The bindings either from engine_scope or global_scope show no entry set when accessed inside my jruby script. Will there be a default set of bindings? My code is as follows

class RubyTest
puts "Santosh Ruby Test"
driver = HtmlUnitDriver.new

manager = JRubyScriptEngineManager.new
engine_scope = 100
global_scope = 200
engine = manager.getEngineByName('jruby');
context = engine.getContext()

bindings = context.getBindings(engine_scope)

globalBindings = context.getBindings(global_scope)


puts bindings.entrySet
puts globalBindings.entrySet
puts context.methods.sort

end

exception JRuby-Rack startup

Running a warble generated war file in tomcat6 I see this:

INFO: An exception happened during JRuby-Rack startup
no such file to load -- bundler/setup
--- System
jruby 1.6.3 (ruby-1.8.7-p330) (2011-07-07 965162f) (OpenJDK 64-Bit Server VM 1.6.0_20) [linux-amd64-java]
Time: Tue Aug 09 14:07:16 -0700 2011
Server: Apache Tomcat/6.0.28
jruby.home: file:/var/lib/tomcat6/webapps/microscope/WEB-INF/lib/jruby-stdlib-1.6.3.jar!/META-INF/jruby.home

--- Context Init Parameters:
public.root = /
rails.env = production

--- Backtrace
LoadError: no such file to load -- bundler/setup
require at org/jruby/RubyKernel.java:1038
require at file:/var/lib/tomcat6/webapps/microscope/WEB-INF/lib/jruby-stdlib-1.6.3.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29
(root) at /var/lib/tomcat6/webapps/microscope/WEB-INF/config/boot.rb:6
require at org/jruby/RubyKernel.java:1038
load_environment at /var/lib/tomcat6/webapps/microscope/WEB-INF/config/boot.rb:165
to_app at file:/var/lib/tomcat6/webapps/microscope/WEB-INF/lib/jruby-rack-1.0.9.jar!/jruby/rack/rails.rb:173
new at file:/var/lib/tomcat6/webapps/microscope/WEB-INF/lib/jruby-rack-1.0.9.jar!/jruby/rack/rails.rb:193
(root) at <web.xml>:1
instance_eval at org/jruby/RubyKernel.java:2061
initialize at file:/var/lib/tomcat6/webapps/microscope/WEB-INF/lib/jruby-rack-1.0.9.jar!/vendor/rack-1.2.2/rack/builder.rb:46
(root) at <web.xml>:1

--- RubyGems
Gem.dir: /var/lib/tomcat6/webapps/microscope/WEB-INF/gems
Gem.path:
/var/lib/tomcat6/webapps/microscope/WEB-INF/gems
Activated gems:

--- Bundler
undefined method `bundle_path' for Bundler:Module

--- JRuby-Rack Config
background_spooling = false
compat_version =
filter_adds_html = true
filter_verifies_resource = false
ignore_environment = false
initial_runtimes =
jms_connection_factory =
jms_jndi_properties =
logger = org.jruby.rack.logging.ServletContextLogger@465fadce
logger_class_name = servlet_context
logger_name = jruby.rack
maximum_runtimes =
memory_buffer_size = 65536
num_initializer_threads =
rackup =
rackup_path =
rewindable = true
runtime_timeout_seconds =
serial_initialization = false
servlet_context = org.apache.catalina.core.ApplicationContextFacade@40914272

--- $LOAD_PATH:
file:/var/lib/tomcat6/webapps/microscope/WEB-INF/lib/jruby-rack-1.0.9.jar!/vendor/rack-1.2.2
file:/var/lib/tomcat6/webapps/microscope/WEB-INF/lib/jruby-stdlib-1.6.3.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8
file:/var/lib/tomcat6/webapps/microscope/WEB-INF/lib/jruby-stdlib-1.6.3.jar!/META-INF/jruby.home/lib/ruby/site_ruby/shared
file:/var/lib/tomcat6/webapps/microscope/WEB-INF/lib/jruby-stdlib-1.6.3.jar!/META-INF/jruby.home/lib/ruby/1.8
.

Aug 9, 2011 2:07:16 PM org.apache.catalina.core.ApplicationContext log
SEVERE: Application Error
org.jruby.rack.RackInitializationException: no such file to load -- bundler/setup
from file:/var/lib/tomcat6/webapps/microscope/WEB-INF/lib/jruby-stdlib-1.6.3.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in require' from /var/lib/tomcat6/webapps/microscope/WEB-INF/config/boot.rb:6:in(root)'
from org/jruby/RubyKernel.java:1038:in require' from /var/lib/tomcat6/webapps/microscope/WEB-INF/config/boot.rb:165:inload_environment'
from file:/var/lib/tomcat6/webapps/microscope/WEB-INF/lib/jruby-rack-1.0.9.jar!/jruby/rack/rails.rb:173:in to_app' from file:/var/lib/tomcat6/webapps/microscope/WEB-INF/lib/jruby-rack-1.0.9.jar!/jruby/rack/rails.rb:193:innew'
from <web.xml>:1:in (root)' from org/jruby/RubyKernel.java:2061:ininstance_eval'
from file:/var/lib/tomcat6/webapps/microscope/WEB-INF/lib/jruby-rack-1.0.9.jar!/vendor/rack-1.2.2/rack/builder.rb:46:in initialize' from <web.xml>:1:in(root)'

at org.jruby.rack.DefaultRackApplicationFactory$4.init(DefaultRackApplicationFactory.java:204)
at org.jruby.rack.DefaultRackApplicationFactory.getApplication(DefaultRackApplicationFactory.java:54)
at org.jruby.rack.PoolingRackApplicationFactory.getApplication(PoolingRackApplicationFactory.java:95)
at org.jruby.rack.DefaultRackDispatcher.process(DefaultRackDispatcher.java:28)
at org.jruby.rack.RackFilter.doFilter(RackFilter.java:58)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:636)

Caused by: org.jruby.exceptions.RaiseException: (LoadError) no such file to load -- bundler/setup

Streaming a file > 2G in size through ActionController::Streaming#send_file causes an error (rails 2.3.8, jruby-rack 1.0.8, jruby 1.6.1, tomcat 6).

Since the 'Content-Length' HTTP header parameter is represented as a primitive Java int in the servlet API, an error occurs when 'Content-Length' is assigned a value that exceeds the max size for a Java int (2,147,483,647 or 2^31 - 1 bytes).

To fix the bug in our app, I've monkey-patched ActionController::Streaming#send_file such that the 'Content-Length' parameter is deleted from the headers hash if the download file size > 2G. However, I suspect that JRuby::Rack::Response#write_headers(response) would be a more appropriate place to address the limitation.

Here is a typical stack trace:

org.jruby.exceptions.RaiseException: (RangeError) too big for int: 3626545832
        at JRuby::Rack::Response.write_headers(file:/international-action/WEB-INF/lib/jruby-rack-1.0.8.jar!/jruby/rack/response.rb:64)
        at Rack::Utils::HeaderHash.each(file:/international-action/WEB-INF/lib/jruby-rack-1.0.8.jar!/vendor/rack-1.2.2/rack/utils.rb:305)
        at org.jruby.RubyHash.each(org/jruby/RubyHash.java:1169)
        at Rack::Utils::HeaderHash.each(file:/international-action/WEB-INF/lib/jruby-rack-1.0.8.jar!/vendor/rack-1.2.2/rack/utils.rb:304)
        at JRuby::Rack::Response.write_headers(file:/international-action/WEB-INF/lib/jruby-rack-1.0.8.jar!/jruby/rack/response.rb:59)
        at JRuby::Rack::Response.respond(file:/international-action/WEB-INF/lib/jruby-rack-1.0.8.jar!/jruby/rack/response.rb:49) 

and here's the relevant gem set:

actionmailer (2.3.14, 2.3.8, 2.3.4)
actionpack (2.3.14, 2.3.8, 2.3.4)
activerecord (2.3.14, 2.3.8, 2.3.4)
activerecord-jdbc-adapter (1.1.1)
activerecord-jdbcmysql-adapter (1.1.1)
activeresource (2.3.14, 2.3.8, 2.3.4)
activesupport (2.3.14, 2.3.8, 2.3.4)
ar-extensions (0.9.5)
bouncy-castle-java (1.5.0145.2)
ffi (1.0.9 java)
ffi-ncurses (0.3.3)
highline (1.6.2)
hpricot (0.8.4 java)
jdbc-mysql (5.1.13)
jruby-jars (1.6.1)
jruby-openssl (0.7.3)
jruby-rack (1.0.8)
json_pure (1.5.1)
mislav-will_paginate (2.3.11)
net-scp (1.0.4)
net-sftp (2.0.5)
net-ssh (2.1.4)
net-ssh-gateway (1.1.0)
rack (1.1.2, 1.0.1)
rails (2.3.14, 2.3.8, 2.3.4)
rake (0.8.7)
rcov (0.9.9 java)
renum (1.3.1)
rubygems-update (1.4.2)
rubyzip (0.9.4)
sources (0.0.1)
stomp (1.1.6)
thoughtbot-shoulda (2.10.2)
trinidad (1.1.1)
trinidad_jars (1.0.1)
warbler (1.3.0)

Rails and HTTP_X_FORWARDED_FOR

Seems jruby-rack doesn't set HTTP_X_FORWARDED_FOR which combined with:

  • a rails app (war) deployed behind a proxy (e.g. jboss behind apache)
  • users being in the same local network as the proxy
  • an exception being thrown and handled by action_dispatch

causes a trace and env info (as would be in a dev env) to be displayed.

Rails shows a trace and env info for exceptions if it considers the request to be local. To determine if the request is local, Rails also checks the HTTP_X_FORWARDED_FOR header.

A workaround is to patch ActionDispatch::Request.local? to always return false in a production env.

adjust_load_path in booter.rb should check jruby.compact.version

In IBM WebSphere, jruby.home is set to /tmp. In this case, adjust_load_path just defaults to 1.8 load path. So when 1.9 ruby is set, the app fails to boot. This method should check jruby.compact.version, if it is 1.9, then it should set 1.9 load path.

Thank very much anyway for providing a great jruby-rack!
hj

JRubyRack and tomcat hung out

Our app is using jruby-rack-1.0.10.jar and jruby-core-1.6.4.jar throw warbler, its working quite find but sometimes we get stuck and our application is never more answering any new request until we restart tomcat.

Also we had some errors into our log that make be believe the problem is related with rack, but have no more data on that.

Please if this is not the correct place for that query/report feel free to drive me to the correct one, or If you need more info in order to debug it, please ask me!.

Thanks

-----------
INFO: Illegal access: this web application instance has been stopped already.  Could not load org.jruby.RubyFixnum.     The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
java.lang.IllegalStateException
-----------
-----------
:1 warning: already initialized constant RackBaseInput
:1 warning: already initialized constant RackBaseInput
:1 warning: already initialized constant RackBaseInput
:1 warning: already initialized constant RackBaseInput
:1 warning: already initialized constant RackBaseInput
WARNING: while creating new bindings for class org.jruby.rack.input.RackBaseInput,
found an existing binding; you may want to run a clean build.
WARNING: while creating new bindings for class org.jruby.rack.input.RackBaseInput,
found an existing binding; you may want to run a clean build.
WARNING: while creating new bindings for class org.jruby.rack.input.RackBaseInput,
found an existing binding; you may want to run a clean build.
-----------

Runtime is not properly configured when we get it from the servlet context

The JRuby runtime from the ServletContext is not properly configured, it doesn't contain the variable $servlet_context nor other hacks to run rails apps, so it fails.

I've been thinking about this feature and I'm not sure if it's completely useful so I've removed these lines in this patch to fix the problem:

https://gist.github.com/889939

Trinidad doesn't work with JRuby-rack 1.0.8 because of this, and I'm also thinking about release a new version of trinidad that won't set the runtime in the servlet context.

JRubyRack and tomcat hung out

Our app is using jruby-rack-1.0.10.jar and jruby-core-1.6.4.jar throw warbler, its working quite find but sometimes we get stuck and our application is never more answering any new request until we restart tomcat.

Also we had some errors into our log that make be believe the problem is related with rack, but have no more data on that.

Please if this is not the correct place for that query/report feel free to drive me to the correct one, or If you need more info in order to debug it, please ask me!.

Thanks


INFO: Illegal access: this web application instance has been stopped already. Could not load org.jruby.RubyFixnum. The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.

java.lang.IllegalStateException


:1 warning: already initialized constant RackBaseInput
:1 warning: already initialized constant RackBaseInput
:1 warning: already initialized constant RackBaseInput
:1 warning: already initialized constant RackBaseInput
:1 warning: already initialized constant RackBaseInput
WARNING: while creating new bindings for class org.jruby.rack.input.RackBaseInput,
found an existing binding; you may want to run a clean build.
WARNING: while creating new bindings for class org.jruby.rack.input.RackBaseInput,
found an existing binding; you may want to run a clean build.
WARNING: while creating new bindings for class org.jruby.rack.input.RackBaseInput,

found an existing binding; you may want to run a clean build.

Rack::Handler friendly features

I've been trying to create a Rack::Handler for Trinidad but I'm missing a couple of features that perhaps can be useful for others:

  1. Ability to use an existent runtime. DefaultRackFactory creates a new runtime which means we initialize two of them. If we could use an existent one we could improve the start up speed.
  2. Ability to use a existent rack application. DefaultRackFactory creates a rack application from a given rackup script. If we could use an existent runtime we also could use an existent rack application and it would fit better the Rack::Handler behavior because it already creates the rack application.

Warbler ignoring rails.env

hey guys, I'm running a rails app inside tomcat 6 using jruby 1.6rc1 and jruby-rack 1.0.6. btw, when I have an error in my app, the error message displayed is the same as the dev mode(with the stacktrace and etc). I already confirmed, in my web.xml the rails.env param is set to production.

3.1 & java_servlet_store ... NameError: uninitialized constant ActionDispatch::Session::AbstractStore::SessionHash

To recreate:

  1. In the jruby-rack/examples/rails3 application, edit "config/initializers/session_store.rb" to use java_servlet_store.
  2. Try to run trinidad in the webapp directory.

Problems:
/Users/beny/.rvm/gems/jruby-1.6.4@rails31/gems/rack-1.3.2/lib/rack.rb:14 warning: already initialized constant VERSION

and more importantly ...

uninitialized constant ActionDispatch::Session::AbstractStore::SessionHash

OUTPUT ...

Sep 6, 2011 7:58:23 PM org.apache.coyote.AbstractProtocolHandler init
INFO: Initializing ProtocolHandler ["http-bio-3000"]
Sep 6, 2011 7:58:23 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Tomcat
Sep 6, 2011 7:58:23 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.11
2011-09-06 19:58:23 INFO: No global web.xml found
2011-09-06 19:58:24 INFO: Info: received max runtimes = 5
2011-09-06 19:58:24 INFO: jruby 1.6.4 (ruby-1.9.2-p136) (2011-08-23 17ea768) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_26) [darwin-x86_64-java]
2011-09-06 19:58:24 INFO: Info: using runtime pool timeout of 30 seconds
2011-09-06 19:58:24 INFO: Info: received min runtimes = 1
2011-09-06 19:58:24 INFO: Info: received max runtimes = 5
/Users/beny/.rvm/gems/jruby-1.6.4@rails31/gems/rack-1.3.2/lib/rack.rb:14 warning: already initialized constant VERSION
2011-09-06 19:58:34 INFO: Info: received min runtimes = 1
2011-09-06 19:58:34 INFO: Info: received max runtimes = 5
2011-09-06 19:58:34 INFO: An exception happened during JRuby-Rack startup
uninitialized constant ActionDispatch::Session::AbstractStore::SessionHash
--- System
jruby 1.6.4 (ruby-1.9.2-p136) (2011-08-23 17ea768) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_26) [darwin-x86_64-java]
Time: 2011-09-06 19:58:34 -0500
Server: Apache Tomcat/7.0.11
jruby.home: /Users/beny/.rvm/rubies/jruby-1.6.4

--- Context Init Parameters:
jruby.compat.version = 1.9.2
jruby.initial.runtimes = 1
jruby.max.runtimes = 5
jruby.min.runtimes = 1
public.root = /public
rails.env = development
rails.root = /

--- Backtrace
NameError: uninitialized constant ActionDispatch::Session::AbstractStore::SessionHash

--- RubyGems
Gem.dir: /Users/beny/.rvm/gems/jruby-1.6.4@rails31
Gem.path:
/Users/beny/example/jruby-rack/examples/rails3/WEB-INF/gems
/Users/beny/.rvm/gems/jruby-1.6.4@rails31
/Users/beny/.rvm/gems/jruby-1.6.4@global
Activated gems:
bundler-1.0.18
rake-0.9.2
multi_json-1.0.3
activesupport-3.1.0
bcrypt-ruby-3.0.0-java
builder-3.0.0
i18n-0.6.0
activemodel-3.1.0
erubis-2.7.0
rack-1.3.2
rack-cache-1.0.3
rack-mount-0.8.3
rack-test-0.6.1
hike-1.2.1
tilt-1.3.3
sprockets-2.0.0
actionpack-3.1.0
mime-types-1.16
polyglot-0.3.2
treetop-1.4.10
mail-2.3.0
actionmailer-3.1.0
arel-2.2.1
tzinfo-0.3.29
activerecord-3.1.0
activeresource-3.1.0
bouncy-castle-java-1.5.0146.1
coffee-script-source-1.1.2
execjs-1.2.4
coffee-script-2.2.0
rack-ssl-1.3.2
rdoc-3.9.4
thor-0.14.6
railties-3.1.0
coffee-rails-3.1.0
jquery-rails-1.0.13
jruby-openssl-0.7.4
json-1.5.4-java
rails-3.1.0
sass-3.1.7
sass-rails-3.1.0
uglifier-1.0.3

--- Bundler
Bundler.bundle_path: /Users/beny/.rvm/gems/jruby-1.6.4@rails31
Bundler.root: /Users/beny/example/jruby-rack/examples/rails3
Gemfile: /Users/beny/example/jruby-rack/examples/rails3/Gemfile
Settings:
gemfile = /Users/beny/example/jruby-rack/examples/rails3/Gemfile
bin_path = /Users/beny/.rvm/gems/jruby-1.6.4@rails31/gems/bundler-1.0.18/bin/bundle

--- JRuby-Rack Config
background_spooling = false
compat_version = RUBY1_9
filter_adds_html = true
filter_verifies_resource = false
ignore_environment = false
initial_runtimes = 1
jms_connection_factory =
jms_jndi_properties =
logger = org.jruby.rack.logging.ServletContextLogger@3853cb28
logger_class_name = servlet_context
logger_name = jruby.rack
maximum_runtimes = 5
memory_buffer_size = 65536
num_initializer_threads =
rackup =
rackup_path =
rewindable = true
runtime_timeout_seconds =
serial_initialization = false
servlet_context = org.apache.catalina.core.ApplicationContextFacade@2b9f5491
2011-09-06 19:58:34 SEVERE: Error: unable to initialize application
2011-09-06 19:58:55 INFO: Starting ProtocolHandler ["http-bio-3000"]

sometime get java.lang.IllegalStateException: getReader() has already been called for this request

Noticed this is our tomcat logs. Unfortunately, no idea what get JRuby-Rack in this state.

Jun 16, 2011 6:57:40 PM org.apache.catalina.core.ApplicationContext log
SEVERE: Error: Couldn't handle error
java.lang.IllegalStateException: getReader() has already been called for this request
at org.apache.catalina.connector.Request.getInputStream(Request.java:1024)
at org.apache.catalina.connector.RequestFacade.getInputStream(RequestFacade.java:340)
at javax.servlet.ServletRequestWrapper.getInputStream(ServletRequestWrapper.java:146)
at javax.servlet.ServletRequestWrapper.getInputStream(ServletRequestWrapper.java:146)
at org.jruby.rack.servlet.ServletRackEnvironment.getInput(ServletRackEnvironment.java:41)
at org.jruby.rack.input.RackBaseInput.(RackBaseInput.java:60)
at org.jruby.rack.input.RackRewindableInput.(RackRewindableInput.java:83)
at org.jruby.rack.DefaultRackApplication.createRackInput(DefaultRackApplication.java:70)
at org.jruby.rack.DefaultRackApplication.call(DefaultRackApplication.java:35)
at org.jruby.rack.DefaultRackDispatcher.handleException(DefaultRackDispatcher.java:52)
at org.jruby.rack.DefaultRackDispatcher.process(DefaultRackDispatcher.java:31)
at org.jruby.rack.RackServlet.service(RackServlet.java:50)
at org.jruby.rack.RackServlet.service(RackServlet.java:56)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:438)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:421)
at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:342)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Unknown Source)

Jruby rack + warbler - deployment in tomcat

Deploying a Jruby on rails app ( Jruby version 1.60 , rails 3.0 , ruby 1.8.7) on tomcat through warbler version 1.2.0 , i get the following error :
SEVERE: unable to create shared application instance
org.jruby.rack.RackInitializationException: No such file to load -- java.lang.NullPointerException: null
from C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:216:in require_dependency' from C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/railties-3.0.0/lib/rails/engine.rb:138:ineager_load!'
from C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/railties-3.0.0/lib/rails/engine.rb:137:in each' from C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/railties-3.0.0/lib/rails/engine.rb:137:ineager_load!'
from C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/railties-3.0.0/lib/rails/engine.rb:135:in each' from C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/railties-3.0.0/lib/rails/engine.rb:135:ineager_load!'
from C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/railties-3.0.0/lib/rails/application.rb:108:in eager_load!' from C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/railties-3.0.0/lib/rails/application/finisher.rb:41 ... 19 levels... from file:/C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/lib/jruby-rack-1.0.0.jar!/vendor/rack-1.1.0/rack/builder.rb:46:ininitialize'
from <script>:2:in `new'
from <script>:2
at org.jruby.rack.DefaultRackApplicationFactory$4.init(DefaultRackApplicationFactory.java:184)
at org.jruby.rack.DefaultRackApplicationFactory.getApplication(DefaultRackApplicationFactory.java:59)
at org.jruby.rack.SharedRackApplicationFactory.init(SharedRackApplicationFactory.java:27)
at org.jruby.rack.RackServletContextListener.contextInitialized(RackServletContextListener.java:40)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3972)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4467)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:905)
at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:740)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:500)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:519)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: org.jruby.exceptions.RaiseException: No such file to load -- java.lang.NullPointerException: null
at Kernel.raise(C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:306)
at ActiveSupport::Dependencies.depend_on(C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:216)
at ActiveSupport::Dependencies::Loadable.require_dependency(C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/railties-3.0.0/lib/rails/engine.rb:138)
at Rails::Engine.eager_load!(C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/railties-3.0.0/lib/rails/engine.rb:137)
at Array.each(C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/railties-3.0.0/lib/rails/engine.rb:137)
at Rails::Engine.eager_load!(C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/railties-3.0.0/lib/rails/engine.rb:135)
at Array.each(C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/railties-3.0.0/lib/rails/engine.rb:135)
at Rails::Engine.eager_load!(C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/railties-3.0.0/lib/rails/application.rb:108)
at Rails::Application.eager_load!(C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/railties-3.0.0/lib/rails/application/finisher.rb:41)
at (unknown).(unknown)(C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/railties-3.0.0/lib/rails/initializable.rb:25)
at Kernel.instance_exec(C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/railties-3.0.0/lib/rails/initializable.rb:25)
at Kernel.instance_exec(C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/railties-3.0.0/lib/rails/initializable.rb:25)
at Rails::Initializable::Initializer.run(C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/railties-3.0.0/lib/rails/initializable.rb:50)
at Rails::Initializable.run_initializers(C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/railties-3.0.0/lib/rails/initializable.rb:49)
at Array.each(C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/railties-3.0.0/lib/rails/initializable.rb:49)
at Rails::Initializable.run_initializers(C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/railties-3.0.0/lib/rails/application.rb:134)
at Rails::Application.initialize!(C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/railties-3.0.0/lib/rails/application.rb:77)
at #Class:01x67211b.method_missing(C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/config/environment.rb:5)
at (unknown).(unknown)(C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/config/environment.rb:239)
at Kernel.require(C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239)
at ActiveSupport::Dependencies::Loadable.require(C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:225)
at ActiveSupport::Dependencies::Loadable.load_dependency(C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:593)
at ActiveSupport::Dependencies.new_constants_in(C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:225)
at ActiveSupport::Dependencies::Loadable.load_dependency(C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/gems/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239)
at ActiveSupport::Dependencies::Loadable.require(file:/C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/lib/jruby-rack-1.0.0.jar!/jruby/rack/rails.rb:161)
at JRuby::Rack::RailsBooter::Rails3Environment.load_environment(file:/C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/lib/jruby-rack-1.0.0.jar!/jruby/rack/rails.rb:165)
at JRuby::Rack::RailsBooter::Rails3Environment.to_app(file:/C:/apache-tomcat-6.0.26/webapps/ROOT/WEB-INF/lib/jruby-rack-1.0.0.jar!/jruby/rack/rails.rb:186)
at #Class:01x1371566.new(<script>:2)

This occurs during server startup itself.

I am not sure what could be the error but looks like rack is trying to initialize something that it cannot find. These jars get bundled in lib of application through the warbler.

Jruby 1.6 has inbuilt rack version of 1.0.0

Error trying to start Rails app on Weblogic Server 10.3.4

Hi, I've used Warbler to bundle my rails application into a war file and I've deployed the war to a Weblogic 10.3.4 development server. When I try to access my application I get the following error:

Application Error
org.jruby.rack.RackInitializationException: load error: active_support/core_ext/time/marshal -- java.lang.NoSuchMethodError: org.joda.time.DateTime.withYear(I)Lorg/joda/time/DateTime;

I have ugraded to the latest 1.0.8 JRuby Rack Gem. I also tried copying the latest Joda Date jar file to my rails apps lib directory.

Full stack trace below:

enable jruby 1.9 support

How will jruby 1.9 support be enabled when deploying rack applications with warbler on some application server such as tomcat?

Websphere 7 Deployment issue

Here the summary of the findings up to now:

We're in the process of updating to rails 3 so we created a minimal Rails 3 App with 1 controller, using a Postgres Database through JNDI and a Datasource, configured in Websphere.

This new Rails 3 App (with direct JDBC-access) runs fine locally (webrick) on my machine. If I Warble (warbler 1.3.0) the App and deploy it to:

  • Apache Tomcat 6.0.26 on my Mac: Everything OK.
  • Apache Tomcat 7 on a Win XP 64 Box: Check. Everything OK.
  • to a mighty Websphere ( 7.0.0.0 on Windows XP), it first seems everything is OK...at startup:

[13.05.11 11:09:30:390 CEST] 00000022 ApplicationMg A WSVR0221I: Application started: apollo_war
[13.05.11 11:09:30:437 CEST] 00000022 CompositionUn A WSVR0191I: Composition unit WebSphere:cuname=apollo_war in BLA WebSphere:blaname=apollo_war started.

If I issue the first request, I get the error attached below, the main error being an: ArgumentError: wrong number of arguments (2 for 1)

It seems like line 7 in our config/application.rb is causing that problem:

Bundler.require(:default, Rails.env) if defined?(Bundler)

Maybe some signature changed there..but than: Why does it work locally?

[13.05.11 11:15:40:515 CEST] 00000020 servlet I com.ibm.ws.webcontainer.servlet.ServletWrapper init SRVE0242I: [apollo_war] [/apollo] [Rails]: Initialisierung erfolgreich.
[13.05.11 11:15:52:375 CEST] 00000020 webapp I com.ibm.ws.webcontainer.webapp.WebApp log SRVE0292I: Servlet-Nachricht - [apollo_war#apollo.war]:.Warning: no min runtimes specified.
[13.05.11 11:15:52:390 CEST] 00000020 webapp I com.ibm.ws.webcontainer.webapp.WebApp log SRVE0292I: Servlet-Nachricht - [apollo_war#apollo.war]:.Warning: no max runtimes specified.
[13.05.11 11:15:52:406 CEST] 00000020 webapp I com.ibm.ws.webcontainer.webapp.WebApp log SRVE0292I: Servlet-Nachricht - [apollo_war#apollo.war]:.An exception happened during JRuby-Rack startup
wrong number of arguments (2 for 1)
--- System
jruby 1.6.1 (ruby-1.8.7-p330) (2011-04-12 85838f6) (IBM J9 VM 1.6.0) [Windows XP-x86-java]
Time: Fri May 13 11:15:52 +0200 2011
Server: IBM WebSphere Application Server/7.0
jruby.home: C:ProgrammeIBMWebSphereAppServerprofilesAppSrv01logs

--- Context Init Parameters:
public.root = /
rails.env = production

--- Backtrace
ArgumentError: wrong number of arguments (2 for 1)
require at C:/Programme/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/YL6R011184Node01Cell/apollo_war.ear/apollo.war/WEB-INF/gems/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239
load_dependency at C:/Programme/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/YL6R011184Node01Cell/apollo_war.ear/apollo.war/WEB-INF/gems/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:225
new_constants_in at C:/Programme/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/YL6R011184Node01Cell/apollo_war.ear/apollo.war/WEB-INF/gems/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:596
load_dependency at C:/Programme/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/YL6R011184Node01Cell/apollo_war.ear/apollo.war/WEB-INF/gems/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:225
require at C:/Programme/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/YL6R011184Node01Cell/apollo_war.ear/apollo.war/WEB-INF/gems/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239
(root) at C:/Programme/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/YL6R011184Node01Cell/apollo_war.ear/apollo.war/WEB-INF/config/application.rb:7
require at org/jruby/RubyKernel.java:1038
require at C:/Programme/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/YL6R011184Node01Cell/apollo_war.ear/apollo.war/WEB-INF/config/application.rb:29
require at C:/Programme/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/YL6R011184Node01Cell/apollo_war.ear/apollo.war/WEB-INF/gems/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239
load_dependency at C:/Programme/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/YL6R011184Node01Cell/apollo_war.ear/apollo.war/WEB-INF/gems/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:225
new_constants_in at C:/Programme/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/YL6R011184Node01Cell/apollo_war.ear/apollo.war/WEB-INF/gems/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:596
load_dependency at C:/Programme/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/YL6R011184Node01Cell/apollo_war.ear/apollo.war/WEB-INF/gems/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:225
require at C:/Programme/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/YL6R011184Node01Cell/apollo_war.ear/apollo.war/WEB-INF/gems/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239
(root) at C:/Programme/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/YL6R011184Node01Cell/apollo_war.ear/apollo.war/WEB-INF/config/environment.rb:2
require at org/jruby/RubyKernel.java:1038
require at C:/Programme/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/YL6R011184Node01Cell/apollo_war.ear/apollo.war/WEB-INF/config/environment.rb:29
require at C:/Programme/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/YL6R011184Node01Cell/apollo_war.ear/apollo.war/WEB-INF/gems/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239
load_dependency at C:/Programme/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/YL6R011184Node01Cell/apollo_war.ear/apollo.war/WEB-INF/gems/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:225
new_constants_in at C:/Programme/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/YL6R011184Node01Cell/apollo_war.ear/apollo.war/WEB-INF/gems/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:596
load_dependency at C:/Programme/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/YL6R011184Node01Cell/apollo_war.ear/apollo.war/WEB-INF/gems/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:225
require at C:/Programme/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/YL6R011184Node01Cell/apollo_war.ear/apollo.war/WEB-INF/gems/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239
load_environment at classpath:/jruby/rack/rails.rb:169
to_app at classpath:/jruby/rack/rails.rb:173
new at classpath:/jruby/rack/rails.rb:193
(root) at :1
instance_eval at org/jruby/RubyKernel.java:2021
initialize at classpath:/vendor/rack-1.2.2/rack/builder.rb:46
(root) at :1

--- RubyGems
Gem.dir: C:/Programme/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/YL6R011184Node01Cell/apollo_war.ear/apollo.war/WEB-INF/gems
Gem.path:
C:/Programme/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/YL6R011184Node01Cell/apollo_war.ear/apollo.war/WEB-INF/gems
Activated gems:
railties-3.0.7
rake-0.8.7
thor-0.14.6
activesupport-3.0.7
actionpack-3.0.7
activemodel-3.0.7
builder-2.1.2
i18n-0.5.0
rack-1.2.2
rack-test-0.5.7
rack-mount-0.6.14
tzinfo-0.3.27
erubis-2.6.6
abstract-1.0.0
activerecord-3.0.7
arel-2.0.9
actionmailer-3.0.7
mail-2.2.19
mime-types-1.16
treetop-1.4.9
polyglot-0.3.1
activeresource-3.0.7

--- Bundler
undefined method `bundle_path' for Bundler:Module

--- JRuby-Rack Config
background_spooling = false
compat_version =
filter_adds_html = true
filter_verifies_resource = false
ignore_environment = false
initial_runtimes =
jms_connection_factory =
jms_jndi_properties =
logger = org.jruby.rack.logging.ServletContextLogger@5f805f8
logger_class_name = servlet_context
logger_name = jruby.rack
maximum_runtimes =
memory_buffer_size = 65536
num_initializer_threads =
rackup =
rackup_path =
rewindable = true
runtime_timeout_seconds =
serial_initialization = false
servlet_context = com.ibm.wsspi.webcontainer.facade.ServletContextFacade@479c479c

[13.05.11 11:15:52:421 CEST] 00000020 webapp I com.ibm.ws.webcontainer.webapp.WebApp log SRVE0296E: [apollo_war#apollo.war][/apollo][Servlet.LOG]:.Application Error:.org.jruby.rack.RackInitializationException: wrong number of arguments (2 for 1)
from C:/Programme/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/YL6R011184Node01Cell/apollo_war.ear/apollo.war/WEB-INF/gems/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:225:in load_dependency'
from C:/Programme/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/YL6R011184Node01Cell/apollo_war.ear/apollo.war/WEB-INF/gems/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:596:innew_constants_in'
from C:/Programme/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/YL6R011184Node01Cell/apollo_war.ear/apollo.war/WEB-INF/gems/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:225:in load_dependency'
from C:/Programme/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/YL6R011184Node01Cell/apollo_war.ear/apollo.war/WEB-INF/gems/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239:inrequire'
from C:/Programme/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/YL6R011184Node01Cell/apollo_war.ear/apollo.war/WEB-INF/config/application.rb:7:in (root)'
from org/jruby/RubyKernel.java:1038:inrequire'
from C:/Programme/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/YL6R011184Node01Cell/apollo_war.ear/apollo.war/WEB-INF/config/application.rb:29:in require'
from C:/Programme/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/YL6R011184Node01Cell/apollo_war.ear/apollo.war/WEB-INF/gems/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239:inrequire'
from C:/Programme/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/YL6R011184Node01Cell/apollo_war.ear/apollo.war/WEB-INF/gems/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:225:in load_dependency'
from C:/Programme/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/YL6R011184Node01Cell/apollo_war.ear/apollo.war/WEB-INF/gems/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:596:innew_constants_in'
from C:/Programme/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/YL6R011184Node01Cell/apollo_war.ear/apollo.war/WEB-INF/gems/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:225:in load_dependency'
from C:/Programme/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/YL6R011184Node01Cell/apollo_war.ear/apollo.war/WEB-INF/gems/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239:inrequire'
from C:/Programme/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/YL6R011184Node01Cell/apollo_war.ear/apollo.war/WEB-INF/config/environment.rb:2:in (root)'
from org/jruby/RubyKernel.java:1038:inrequire'
from C:/Programme/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/YL6R011184Node01Cell/apollo_war.ear/apollo.war/WEB-INF/config/environment.rb:29:in require'
from C:/Programme/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/YL6R011184Node01Cell/apollo_war.ear/apollo.war/WEB-INF/gems/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239:inrequire'
from C:/Programme/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/YL6R011184Node01Cell/apollo_war.ear/apollo.war/WEB-INF/gems/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:225:in load_dependency'
from C:/Programme/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/YL6R011184Node01Cell/apollo_war.ear/apollo.war/WEB-INF/gems/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:596:innew_constants_in'
from C:/Programme/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/YL6R011184Node01Cell/apollo_war.ear/apollo.war/WEB-INF/gems/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:225:in load_dependency'
from C:/Programme/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/YL6R011184Node01Cell/apollo_war.ear/apollo.war/WEB-INF/gems/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239:inrequire'
from classpath:/jruby/rack/rails.rb:169:in load_environment'
from classpath:/jruby/rack/rails.rb:173:into_app'
from classpath:/jruby/rack/rails.rb:193:in new'
from <web.xml>:1:in(root)'
from org/jruby/RubyKernel.java:2021:in instance_eval'
from classpath:/vendor/rack-1.2.2/rack/builder.rb:46:ininitialize'
from :1:in `(root)'

at org.jruby.rack.DefaultRackApplicationFactory$4.init(DefaultRackApplicationFactory.java:224)
at org.jruby.rack.DefaultRackApplicationFactory.getApplication(DefaultRackApplicationFactory.java:57)
at org.jruby.rack.PoolingRackApplicationFactory.getApplication(PoolingRackApplicationFactory.java:95)
at org.jruby.rack.DefaultRackDispatcher.process(DefaultRackDispatcher.java:28)
at org.jruby.rack.RackServlet.service(RackServlet.java:50)
at org.jruby.rack.RackServlet.service(RackServlet.java:56)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1443)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:790)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:443)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:175)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3610)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:274)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:926)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1557)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:173)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:455)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:384)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:272)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:202)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:766)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:896)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1527)

Caused by: org.jruby.exceptions.RaiseException: (ArgumentError) wrong number of arguments (2 for 1)

D:apollo>gem list

*** LOCAL GEMS ***

abstract (1.0.0)
actionmailer (3.0.7)
actionpack (3.0.7)
activemodel (3.0.7)
activerecord (3.0.7)
activerecord-jdbc-adapter (1.1.1)
activeresource (3.0.7)
activesupport (3.0.7)
arel (2.0.9)
builder (2.1.2)
bundler (1.0.13)
erubis (2.6.6)
i18n (0.5.0)
jruby-jars (1.6.1)
jruby-rack (1.0.8)
mail (2.2.19)
mime-types (1.16)
polyglot (0.3.1)
rack (1.2.2)
rack-mount (0.6.14)
rack-test (0.5.7)
rails (3.0.7)
railties (3.0.7)
rake (0.8.7)
rubyzip (0.9.4)
sources (0.0.1)
thor (0.14.6)
treetop (1.4.9)
tzinfo (0.3.27)
warbler (1.3.0)

Thanks for your help in advance.

Rubén

java servlet session store issue

The main issue that I’m having is this:

      undefined method `exists?' for #<ActionController::Session::JavaServletStore:0x38881bd3>

    /Users/ablohowiak/tomcat/webapps/ROOT/WEB-INF/vendor/rails/actionpack/lib/action_controller/session/abstract_store.rb:111:in `exists?'
   /Users/ablohowiak/tomcat/webapps/ROOT/WEB-INF/vendor/rails/actionpack/lib/action_controller/session/abstract_store.rb:128:in `load_for_read!'
   /Users/ablohowiak/tomcat/webapps/ROOT/WEB-INF/vendor/rails/actionpack/lib/action_controller/session/abstract_store.rb:57:in `[]'

(using actionpack 2.3.10)

So it looks like @by.send(:exists?, ... Is throwing the error. However, when I output @by.class I get:

ActionController::Session::JavaServletStore

And reflecting on its methods, I have:

        ["==", "===", "=~", "__id__", "__method__", "__send__", "`", "acts_like?", "as_json", "b64encode", "blank?", "breakpoint", "call", "class", "class_eval", "clone", "close_session", "com", "copy_instance_variables_from", "daemonize", "dclone", "debugger", "decode64", "decode_b", "display", "dup", "duplicable?", "enable_warnings", "encode64", "enum_for", "eql?", "equal?", "expirable_memoize", "extend", "extend_with_included_modules_from", "extended_by", "freeze", "frozen?", "gem", "get_servlet_session", "handle_different_imports", "hash", "html_safe?", "id", "include_class", "inspect",  "instance_eval", "instance_eval_with_params", "instance_exec", "instance_of?", "instance_values", "instance_variable_defined?", "instance_variable_get", "instance_variable_names", "instance_variable_set", "instance_variables", "is_a?", "is_haml?", "java", "java_annotation", "java_implements", "java_kind_of?", "java_name", "java_package", "java_require", "java_signature", "javax", "kind_of?", "load_session", "load_with_new_constant_marking", "metaclass", "metaclass_with_deprecation", "metaclass_without_deprecation", "method", "methods", "nil?", "object_id", "org", "presence", "present?", "pretty_inspect", "pretty_print", "pretty_print_cycle", "pretty_print_inspect", "pretty_print_instance_variables", "private_methods", "protected_methods", "public_methods", "remove_subclasses_of", "require", "require_association", "require_dependency", "require_library_or_gem", "require_or_load", "respond_to?", "returning", "save_session", "send", "silence_stderr", "silence_stream", "silence_warnings", "singleton_class", "singleton_methods", "subclasses_of", "suppress", "taguri", "taguri=", "taint", "tainted?", "tap", "timeout", "to_a", "to_enum", "to_java", "to_json", "to_param", "to_query", "to_s", "to_yaml", "to_yaml_properties", "to_yaml_style", "try", "type", "unloadable", "untaint", "with_options"]

Unfortunately for me, creating a brand-new app and trying out the servlet session store "just works". So, it looks like i am going to have to try and figure out what makes our app special. have you seen this before or do you have an inkling of what the issue could be?

Thanks!
Aaron

Application being reloaded multiple times

I am deployig a Rails 3.0.5 app using JRuby 1.6.1 into Tomcat 7.0.8. When the application is deployed to Tomcat (as a WAR, in 'production' mode) I am running into a strange issue where the rails application appears to get reloaded (i.e. my initializers are being re-ran).

When the application first starts up, things look good and I can hit the root URL: https://myserver.com/

However, once I click a button in the UI (which performs 5 ajax requests at the same time) I notice in my log file that some of the log statements in my <rails_app>/config/initializers/app_constants.rb file are showing up 5 times. Subsequent clicks of the button in the UI do not reproduce this issue, it only occurs the first time those 5 ajax requests get POSTed to the server after the server has been started.

I've tried digging into jruby-rack (version 1.0.5) to identify the cause, figured maybe it was threading related, but I haven't found out where the problem is coming from.

So far, by way of monkey patching the Booter class I've determine that at least the Booter.layout is getting invoked several times. That is, in my application.rb I have:

module JRuby
  module Rack
    class Booter
        def layout
            puts "CUSTOM BOOTER, getting 'layout'"
           @layout ||= layout_class.new(@rack_context)
        end
    end
  end
end

Any thoughts on why this might be happening? or something else I should try?

JRuby-Rack Streaming broken

Sinatra streaming support is broken with the latest jruby-rack-1.1.1 release, any stream that gets initiated results in an EOF exception. The last known version of jruby-rack that worked correctly was 1.0.

See - http://sinatra.rubyforge.org/api/classes/Sinatra/Streaming.html

Platform: JDK 1.7.1 / Solaris / JRuby-1.6.5 / JRuby-Rack 1.1.1

Stacktrace:

89758 [29671378@qtp-24526347-46] ERROR / - Application Error
org.jruby.exceptions.RaiseException: (IOError) closed stream
at org.jruby.java.addons.IOJavaAddons.to_channel(org/jruby/java/addons/IOJavaAddons.java:63)
at JRuby::Rack::Response.write_body(file:/opt/jetty-6.1.26/lib/ext/extra/lang/jruby-rack.jar!/jruby/rack/response.rb:92)
at JRuby::Rack::Response.respond(file:/opt/jetty-6.1.26/lib/ext/extra/lang/jruby-rack.jar!/jruby/rack/response.rb:50)

Example Code:

require 'rubygems'
require 'sinatra'

class NetFile < ::File #:nodoc:
  def initialize(uri,opts = {})
    @opts = {:method=>'GET',:params=>{},:headers=>{}}.merge!opts
    @uri = URI.parse(uri)
  end
  def close
    true
  end
  def to_path
    __FILE__
  end
  def each
      Net::HTTP.start(@uri.host, @uri.port) do |http|
        http.request_get(@uri.path,@opts[:headers]) do |resp|
          resp.read_body do |data|
            yield data
          end
        end
      end
  end
end

class Test < Sinatra::Base
  get '/' do
    halt NetFile.new("http://google.com/")
  end
end

-Victor

railtie broken for rails HEAD


NoMethodError: undefined method `public' for #<Rails::Paths::Root:0x197f391>
           Railtie at file:/Users/dlee/.rvm/gems/jruby-1.6.2/gems/jruby-rack-1.0.9/lib/jruby-rack-1.0.9.jar!/jruby/rack/rails/railtie.rb:14
     instance_exec at org/jruby/RubyKernel.java:2045
               run at /Users/dlee/code/rails/railties/lib/rails/initializable.rb:25
  run_initializers at /Users/dlee/code/rails/railties/lib/rails/initializable.rb:50
              each at org/jruby/RubyArray.java:1602
  run_initializers at /Users/dlee/code/rails/railties/lib/rails/initializable.rb:49
       initialize! at /Users/dlee/code/rails/railties/lib/rails/application.rb:92
              send at org/jruby/RubyKernel.java:2059
    method_missing at /Users/dlee/code/rails/railties/lib/rails/railtie/configurable.rb:30
            (root) at /Users/dlee/code/app/config/environment.rb:5
           require at org/jruby/RubyKernel.java:1038
           require at /Users/dlee/code/rails/activesupport/lib/active_support/dependencies.rb:236
   load_dependency at /Users/dlee/code/rails/activesupport/lib/active_support/dependencies.rb:222
  new_constants_in at /Users/dlee/code/rails/activesupport/lib/active_support/dependencies.rb:613
  new_constants_in at /Users/dlee/code/rails/activesupport/lib/active_support/dependencies.rb:612
   load_dependency at /Users/dlee/code/rails/activesupport/lib/active_support/dependencies.rb:222
           require at /Users/dlee/code/rails/activesupport/lib/active_support/dependencies.rb:236
  load_environment at /Users/dlee/code/app/config/environment.rb:169
            to_app at file:/Users/dlee/.rvm/gems/jruby-1.6.2/gems/jruby-rack-1.0.9/lib/jruby-rack-1.0.9.jar!/jruby/rack/rails.rb:173
               new at file:/Users/dlee/.rvm/gems/jruby-1.6.2/gems/jruby-rack-1.0.9/lib/jruby-rack-1.0.9.jar!/jruby/rack/rails.rb:193
            (root) at /Users/dlee/code/app/config.ru:1
     instance_eval at org/jruby/RubyKernel.java:2028
        initialize at file:/Users/dlee/.rvm/gems/jruby-1.6.2/gems/jruby-rack-1.0.9/lib/jruby-rack-1.0.9.jar!/vendor/rack-1.2.2/rack/builder.rb:46
            (root) at /Users/dlee/code/app/config.ru:1

No such file to load -- Rack

Hi,

I couldn't reproduce the example project which you have on readme page. I'm using Tomcat 7.0 as a container. I get the following message (unrelevant part of paths omitted for brevity):

Application initialization failed: no such file to load -- rack
from /webapps/Defekt/WEB-INF/lib/jruby-rack-1.0.4.jar!/vendor/rack.rb:7
from /webapps/Defekt/WEB-INF/lib/jruby-rack-1.0.4.jar!/vendor/rack.rb:28:in `require'
from /webapps/Defekt/WEB-INF/lib/jruby-rack-1.0.4.jar!/jruby/rack/booter.rb:28:in `boot!'
from /webapps/Defekt/WEB-INF/lib/jruby-rack-1.0.4.jar!/jruby/rack/boot/rack.rb:10
from /webapps/Defekt/WEB-INF/lib/jruby-rack-1.0.4.jar!/jruby/rack/boot/rack.rb:1:in `load'
from <script>:1

undefined method `to_io' for ServletRackEnvironment on WebLogic 10.3

Trying to deploy a Rails 3.0.6 webapp in a WebLogic 10.3 servlet container. After getting around the blocker with joda-time (thanks https://github.com/nicksieger/jruby-rack/issues/24), the servlet container starts up, but it can't process requests.

For each request I get following stack trace:

822332 [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] ERROR jruby.rack - Application Error
  org.jruby.exceptions.RaiseException: (NoMethodError) undefined method `to_io' for #<Java::OrgJrubyRackServlet::ServletRackEnvironment:0xb483bf>
  at Rack::Handler::LazyEnv.load_builtin(classpath:/rack/handler/servlet.rb:117)
  at Rack::Handler::LazyEnv.load_env_key(classpath:/rack/handler/servlet.rb:71)
  at Rack::Handler::LazyEnv.initialize(classpath:/rack/handler/servlet.rb:58)
  at org.jruby.RubyProc.call(org/jruby/RubyProc.java:268)
  at org.jruby.RubyProc.call(org/jruby/RubyProc.java:228)
  at org.jruby.RubyHash.default(org/jruby/RubyHash.java:644)
  at org.jruby.RubyHash.[](org/jruby/RubyHash.java:993)
  at Rack::Handler::Env.populate(classpath:/rack/handler/servlet.rb:45)
  at org.jruby.RubyArray.each(org/jruby/RubyArray.java:1572)
  at Rack::Handler::Env.populate(classpath:/rack/handler/servlet.rb:45)
  at Rack::Handler::Env.initialize(classpath:/rack/handler/servlet.rb:40)
  at Rack::Handler::Servlet.create_env(classpath:/rack/handler/servlet.rb:23)
  at Rack::Handler::Servlet.call(classpath:/rack/handler/servlet.rb:19)
822335 [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] ERROR jruby.rack - Error: Couldn't handle error
  java.lang.ClassCastException: JRuby$$Rack$$Response_207866198 cannot be cast to org.jruby.rack.RackResponse
  at org.jruby.rack.DefaultRackApplication.call(DefaultRackApplication.java:40)
  at org.jruby.rack.DefaultRackDispatcher.handleException(DefaultRackDispatcher.java:52)
  at org.jruby.rack.DefaultRackDispatcher.process(DefaultRackDispatcher.java:31)
  at org.jruby.rack.RackFilter.doFilter(RackFilter.java:58)
  at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42)
  at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3496)
  at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
  at weblogic.security.service.SecurityManager.runAs(Unknown Source)
  at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2180)
  at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2086)
  at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1406)
  at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
  at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)

Deploying the same in Jetty works without any issues, any hints or pointers?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.