Hi,
short summary of what I did to try out the last Goldspike on JRuby
head and discovered that the memory leak was gone:
get the Goldspike Rails plugin from head using SVN:
script/plugin install
svn://rubyforge.org/var/svn/jruby-extras/trunk/rails-integration/plugins/goldspike
get the Rails-integration from SVN head from JRuby-extras
get JRuby from head using SVN
build JRuby with jar-complete task
you have to patch Goldspike so it can run with last JRuby (rev 4047 for me):
- in RailsServlet: change runtime.evalScript into runtime.evalScriptlet.
- also drop the ASTSerializerMain class as it's not compilling and not
used anymore
now you won't be able to compile Goldspike cause it's changed to
compile with JRuby head, not the Jruby 1.0 Maven will grab from the
mysterious repository.
So, if you are a Maven zealot, be my guest and go for it. Else, what I
did is building Goldspike with Eclipse (or Netbeans, whatever).
Set the sourcepath to only the rails-integration plugin.
Now you need to add some libraries to compile (put them in a new lib
directoy your create if you want), especially, you need:
jruby-complete (that one you built yourself from SVN), common-pools
from jakarta (you could find it in the last WEB-INF/lib directoty you
built with the previous Goldspike version) and also servlet-api.jar
you can grab from a Tomcat_home/common/lib for instance.
When Eclipse says no errors you can take the classes from the output
and put them in place of in the rails-intergartion-1.1 you can
download (unzip it and rezip + rename it into a jar). Also don't
forget the ruby file inside! (you should have org, builtin and
META-INF directories inside that jar). Call that jar
rails-integration-1.4 for instance.
Now put that jar into /lib/java you create at the root of your Rails app.
Also put the jruby-complete jar you built in /lib/java
OK, nearly done, now let's hack a bit the Goldspike ruby files. You
need to prevent Goldspike from loading jruby1.0 and the last
rails-integration public release.
So first add the correct libs into config/war.rb
Mine looks like:
maven_library 'mysql', 'mysql-connector-java', '5.0.4'
maven_library 'bouncycastle', 'bcprov-jdk16', '137'
maven_library 'rails-integration', 'rails-integration', '1.4'
maven_library 'jruby-complete', 'jruby-complete', ''
add_gem 'jruby-openssl'
Now, go into vendor/plugins/goldspile/lib/war_config.rb and comment
out instructions to load the legacy libs, mine looks like this:
# default java libraries
#add_java_library(maven_library('org.jruby', 'jruby-complete', '1.0'))
#add_java_library(maven_library('org.jruby.extras',
'rails-integration', '1.1.1'))
add_java_library(maven_library('javax.activation', 'activation', '1.1'))
add_java_library(maven_library('commons-pool', 'commons-pool', '1.3'))
#add_java_library(maven_library('bouncycastle', 'bcprov-jdk14', '124'))
Finally, we need to correct the web.xml in
vendor/plugins/goldspile/lib/create_war.rb in order to deal with the
new RailsSerlvetListener and its runtime pool params. The relevant
part of my web.xml is:
<listener>
<listener-class>org.jruby.webapp.RailsContextListener</listener-class>
<init-param>
<param-name>jruby.pool.maxActive</param-name>
<param-value>4</param-value>
</init-param>
<init-param>
<param-name>jruby.pool.maxIdle</param-name>
<param-value>4</param-value>
</init-param>
<init-param>
<param-name>jruby.pool.minIdle</param-name>
<param-value>2</param-value>
</init-param>
<init-param>
<param-name>jruby.pool.timeBetweenEvictionRunsMillis
</param-name>
<param-value>10000</param-value>
</init-param>
</listener>
ok, now business as usual:
rake tmp:war:clear
rake war:standalone:create
rake war:standalone:run
that should work. You might also want to use the root context for your
app if you have CSS trouble. If so, I don't know why, but setting the
context to "/" in tmp/jetty/jetty.xml and doing rake
war:standalone:run won't account for the change.
I personnaly did a ps -aux | grep java ncopied the java command and
relaunched it after having modified that jetty.xml.
Hope this helps!
Raphaël Valyi.
PS: JRuby on Rails will only succed if it keeps things simple and can
scale down just like Rails and Webrick...
you can't build Goldspike head cause it's code won't compile with
_______________________________________________
Jruby-extras-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/jruby-extras-devel