Hi,I'm trying to run latest JRuby in latest embedded Jetty with Java 6 jre/sdk installed on Windows XP. I searched for an example to compile a war file for use with latest Jetty 6.1.2rc4. I found sample files in rails-integration\release-1.1.1\samples\helloworld-1.2.3 and believed them to be the latest available. I went through the following process:
1. I downloaded and extracted jruby-bin-0.9.9.tar.gz to same dir.
2. I set the System Variable JRUBY_HOME to point to that dir and Set
the PATH variable to the bin dir inside that dir.
3. I executed following commands in command prompt
* gem install activerecord-jdbc --no-ri --no-rdoc
* gem install activesupport --no-ri --no-rdoc
* gem install activerecord --no-ri --no-rdoc
* gem install actionpack --no-ri --no-rdoc
* gem install actionmailer --no-ri --no-rdoc
* gem install actionwebservice --no-ri --no-rdoc
* gem install -v=1.2.3 rails --no-ri --no-rdoc
* gem install rake --no-ri --no-rdoc (Note: no batch file to
run rake was created)
4. I ran WEBrick "jruby script/server" and opened
http://localhost:3000 to ensure it works, then I stoped it with
CTRL-C.
5. I changed to helloworld-1.2.3 dir and ran "jruby --command rake
war:standalone:create" to create the war file helloworld-1.2.3.war.
6. I copied the war file to the webapp dir of Jetty:
jetty-6.1.2rc4\webapps
7. I ran Jetty with "java -jar start.jar" and opened the adress
http://localhost:8080/helloworld-1.2.3/ in my browser to confirmed
it works.
8. Now I ran the same war file in embedded Jetty, using the same
version of Jetty.
Unfortunately the war file would not run in embedded Jetty. I got the
following error:
*** NoMethodError private method 'sub!' called for :NilClass|RAILS_ROOT: C:/Profiles/Administrator/Temp/Jetty_0_0_0_0_80_helloworld-1.2.3.war____-xovlgy/webapp/config/..|
Application Trace <#> | Framework Trace <#> | Full Trace <#> |C:/Profiles/ADMINI~1/Temp/jruby-rails-4513.tmp/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/request.rb:171:in `method_missing' C:/Profiles/ADMINI~1/Temp/jruby-rails-4513.tmp/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/request.rb:171:in `path' C:/Profiles/ADMINI~1/Temp/jruby-rails-4513.tmp/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/routing.rb:1282:in `recognize' C:/Profiles/ADMINI~1/Temp/jruby-rails-4513.tmp/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/dispatcher.rb:40:in `dispatch' | ***I can reproduce this error. You can find a copy of this error output at http://jruby.alright.ch/ActionControllerException.htm . Further I noticed that the war file was using Jruby 0.9.8 and rails-integration 1.0 and not Jruby 0.9.9 and rails-integration 1.1.1 how I expected (the \WEB-INF\lib dir contained jruby-complete-0.9.8.jar and rails-integration-1.0.jar and some other jars). So I went to helloworld-1.2.3\vendor\plugins\war\lib and changed the version numbers in war_config.rb:
***
@java_libraries = {}
# default java libraries
add_java_library(maven_library('org.jruby', 'jruby-complete',
'0.9.9'))
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'))
***Then I ran jruby --command rake war:standalone:create again and got a war file containing Jruby 0.9.8, Jruby 0.9.9 rails-integration 1.0 and rails-integration 1.1.1. So I deleted the old versions: jruby-complete-0.9.8.jar and rails-integration-1.0.jar from WEB-INF\lib dir and keeped the new ones: jruby-complete-0.9.9.jar and rails-integration-1.1.1.jar in the WEB-INF\lib dir. Now I copied the resulting war file over the old one in Jetty and ran Jetty again: "java -jar start.jar". This gave me an HTTP 500 Error:
***
HTTP ERROR: 500
Could not load Rails. See the logs for more details.
RequestURI=/helloworld-1.2.3/
Caused by:
javax.servlet.ServletException: Could not load Rails. See the logs for more
details.
at org.jruby.webapp.RailsFactory.makeObject(RailsFactory.java:131)
at
org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:840)
at
org.jruby.webapp.AbstractRailsServlet.serviceRequest(AbstractRailsServlet.java:144)
at
org.jruby.webapp.AbstractRailsServlet.service(AbstractRailsServlet.java:131)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at
org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:467)
at
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:367)
at
org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at
org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
at
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:715)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
at
org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:211)
at
org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
at
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
at org.mortbay.jetty.Server.handle(Server.java:285)
at
org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:470)
at
org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:806)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:638)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:208)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:359)
at
org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:362)
at
org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:442)
/Powered by Jetty:// <http://jetty.mortbay.org/>/
***
The same happened in embedded Jetty.
Does anyone know how to get latest JRuby 0.9.9 working in latest
embedded Jetty and would like to provide example files to compile the
war file? Or could anyone provide me with detailed instructions how to
update the helloworld-1.2.3 example from SVN to properly use Jruby 0.9.9
and rails-integration 1.1.1? Or could anyone update the example on the
SVN or tell me where I can get an updated example?
I would really like to get JRuby working in embedded Jetty.
Greetings from Switzerland
Marco Oechslin
--
_
_.-/ \-.
| /_ Marco Oechslin
/ |/| PGP: 0x8204D39A
/_ . ,_ _| [EMAIL PROTECTED]
./ \ __/| / v
v v
smime.p7s
Description: S/MIME Cryptographic Signature
_______________________________________________ Jruby-extras-devel mailing list [email protected] http://rubyforge.org/mailman/listinfo/jruby-extras-devel
