Problems Deploying with RubyGems on JBOSS; works on Tomcat

I have a WAR file that uses jruby-complete.1.5.2.jar to provide JRuby as
a ScriptEngine. My JRuby script relies on some Ruby gems that I packaged
in a jar file. This works fine when I run the WAR file under Tomcat, but
it does NOT work when I use JBoss 5.1.0.

To trouble shoot, I even tried running a simple script that required the
“rake” rubygem that comes packaged in the jruby-complete-1.5.2.jar file.
Even this does NOT work under JBoss. It seems that no rubygems can be
found when running under JBoss. There must be some setting I’m not
getting correct for JBoss. Should I set the Ruby loadpath to some
classpath in my WAR? Some one must have done this for JBoss. It works
fine with stand alone Tomcat, so there must be something I’m not doing
for JBoss and its embedded Tomcat server.

Sorry for the newbie question, but your help would be truly appreciated.
To work around this, I customized the jrub-complete-1.5.2.jar file and
placed the RubyGems into the JRuby loadpath of the jar file (i.e.
classpath:$/META-INF/jruby.home/lib/ruby/site_ruby/1.8). That works on
JBoss, but I would rather NOT do this and have the RubyGems mechanism
work on both stand alone Tomcat and JBoss. Thanks for your help.

what version of jruby-rack are you using?

Are you getting errors in the JBoss log?

I had a similar problem with a pre 1.0 version of jruby rack and it
got fixed in that.

if you are using the latest jruby-rack… there is a property you can
set in your web.xml file that turns on some more verbose logging that
might help pinpoint the problem (jruby.rack.debug.load=true)

that should get some more information.

Jay

On Sat, Sep 11, 2010 at 12:57 AM, Jj Frank [email protected] wrote:

classpath in my WAR? Some one must have done this for JBoss. It works
Posted via http://www.ruby-forum.com/.


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

I GOT the same problem. It must be some sort of file access security
feature that is enabled for JBoss, but not used by Tomcat.

  1. To confirm the problem, I wanted to do a simple test with the
    RubyGems that come packaged in the jruby-complete-1.5.2.jar file. I
    listed them with the following command to get the output show below. I
    could have packaged additional RubyGems in a separate JAR file, but I
    wanted to make the test as simple as possible.

$ java -jar jruby-complete-1.5.2.jar -S gem list

*** LOCAL GEMS ***

columnize (0.3.1)
rake (0.8.7)
rspec (1.3.0)
ruby-debug (0.10.3)
ruby-debug-base (0.10.3.2)
sources (0.0.1)

  1. Since “rake” was one of the prepackaged RubyGems according to the
    output above, I wrote the simplest script that required it.

----- begin simple script -------------

require ‘rubygems’
require ‘rake’

puts ‘Success! RubyGem “rake” was loaded successfully.’

------ end simple script ---------------

  1. If I create a simple WAR file, and deploy it on Tomcat, I can the
    script running successfully.

// log output excerpt

Success! RubyGem “rake” was loaded successfully.
[editor-persistence] WARN [http-8080-3] PhaseInterceptorChm

  1. If I try to deploy the same exact WAR on JBoss, I get the exception
    below stating that the RubyGem cannot be found.

15:00:58,319 ERROR [STDERR]
classpath:/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
require' 15:00:58,319 ERROR [STDERR] : no such file to load -- rake 15:00:58,319 ERROR [STDERR] (LoadError) 15:00:58,319 ERROR [STDERR] from classpath:/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:inrequire’
15:00:58,320 ERROR [STDERR] from :2
15:00:58,320 ERROR [STDERR] org.jruby.embed.EvalFailedException: no such
file to load – rake
15:00:58,321 ERROR [STDERR] at
org.jruby.embed.internal.EmbedEvalUnitImpl.run(EmbedEvalUnitImpl.java:127)
15:00:58,321 ERROR [STDERR] at
org.jruby.embed.jsr223.JRubyCompiledScript.eval(JRubyCompiledScript.java:75)
15:00:58,321 ERROR [STDERR] at
com.constantcontact.editor.cssinliner.impl.CssHtmlInliner.evaluateScript(CssHtmlInliner.java:167)
15:00:58,321 ERROR [STDERR] at
com.constantcontact.editor.cssinliner.impl.CssHtmlInliner.retrieveInlineCssThreadSafe(CssHtmlInliner.java:298)
15:00:58,321 ERROR [STDERR] at
com.constantcontact.editor.cssinliner.impl.CssHtmlInliner.inlineCss(CssHtmlInliner.java:212)
15:00:58,321 ERROR [STDERR] at
com.constantcontact.editor.renderer.impl.EditorWebPageRendererImpl.renderDocument(EditorWebPageRendererImpl.java:213)
15:00:58,321 ERROR [STDERR] at
com.constantcontact.editor.service.impl.EmailServiceImpl.renderDocumentAsEmail(EmailServiceImpl.java:48)
15:00:58,322 ERROR [STDERR] at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
15:00:58,322 ERROR [STDERR] at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
15:00:58,322 ERROR [STDERR] at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
15:00:58,322 ERROR [STDERR] at
java.lang.reflect.Method.invoke(Method.java:597)
15:00:58,322 ERROR [STDERR] at
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
15:00:58,322 ERROR [STDERR] at
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
15:00:58,322 ERROR [STDERR] at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
15:00:58,322 ERROR [STDERR] at
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
15:00:58,322 ERROR [STDERR] at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
15:00:58,323 ERROR [STDERR] at
org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
15:00:58,323 ERROR [STDERR] at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
15:00:58,323 ERROR [STDERR] at
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
15:00:58,323 ERROR [STDERR] at
$Proxy231.renderDocumentAsEmail(Unknown Source)
15:00:58,323 ERROR [STDERR] at
com.constantcontact.editor.rs.email.impl.EmailRestServiceImpl.renderDocument(EmailRestServiceImpl.java:36)
15:00:58,323 ERROR [STDERR] at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
15:00:58,323 ERROR [STDERR] at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
15:00:58,323 ERROR [STDERR] at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
15:00:58,324 ERROR [STDERR] at
java.lang.reflect.Method.invoke(Method.java:597)
15:00:58,324 ERROR [STDERR] at
org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:173)
15:00:58,324 ERROR [STDERR] at
org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:89)
15:00:58,324 ERROR [STDERR] at
org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:133)
15:00:58,324 ERROR [STDERR] at
org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:82)
15:00:58,324 ERROR [STDERR] at
org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)
15:00:58,324 ERROR [STDERR] at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
15:00:58,324 ERROR [STDERR] at
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
15:00:58,324 ERROR [STDERR] at
java.util.concurrent.FutureTask.run(FutureTask.java:138)
15:00:58,325 ERROR [STDERR] at
org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
15:00:58,325 ERROR [STDERR] at
org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:106)
15:00:58,325 ERROR [STDERR] at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:243)
15:00:58,325 ERROR [STDERR] at
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:110)
15:00:58,325 ERROR [STDERR] at
org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:98)
15:00:58,325 ERROR [STDERR] at
org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:423)
15:00:58,325 ERROR [STDERR] at
org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:139)
15:00:58,325 ERROR [STDERR] at
org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:142)
15:00:58,326 ERROR [STDERR] at
org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)
15:00:58,326 ERROR [STDERR] at
org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:108)
15:00:58,326 ERROR [STDERR] at
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
15:00:58,326 ERROR [STDERR] at
org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159)
15:00:58,326 ERROR [STDERR] at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
15:00:58,326 ERROR [STDERR] at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
15:00:58,326 ERROR [STDERR] at
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
15:00:58,326 ERROR [STDERR] at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
15:00:58,327 ERROR [STDERR] at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
15:00:58,327 ERROR [STDERR] at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
15:00:58,327 ERROR [STDERR] at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
15:00:58,327 ERROR [STDERR] at
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
15:00:58,327 ERROR [STDERR] at
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
15:00:58,327 ERROR [STDERR] at
org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
15:00:58,327 ERROR [STDERR] at
org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
15:00:58,327 ERROR [STDERR] at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
15:00:58,327 ERROR [STDERR] at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
15:00:58,328 ERROR [STDERR] at
org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
15:00:58,328 ERROR [STDERR] at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
15:00:58,328 ERROR [STDERR] at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
15:00:58,328 ERROR [STDERR] at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
15:00:58,328 ERROR [STDERR] at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:601)
15:00:58,328 ERROR [STDERR] at
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
15:00:58,328 ERROR [STDERR] at java.lang.Thread.run(Thread.java:619)
15:00:58,328 ERROR [STDERR] Caused by:
org.jruby.exceptions.RaiseException: no such file to load – rake
15:00:58,329 ERROR [STDERR] at
(unknown).new(classpath:/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31)
15:00:58,329 ERROR [STDERR] at
Kernel.require(classpath:/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31)
15:00:58,329 ERROR [STDERR] at Kernel.require(:2)
15:00:58,329 ERROR [STDERR] at (unknown).(unknown)(:1)
15:00:59,843 INFO [STDOUT] [editor-persistence] WARN
[http-0.0.0.0-8080-3] PhaseInterceptorChain.unwind(402) | Exception in
handleFault on interceptor
[email protected]3e45f

Does anyone know why the RubyGem mechanism for JRuby does NOT work on
JBoss? Any help would be greatly appreciated.

Jay McGaffigan wrote:

what version of jruby-rack are you using?

Are you getting errors in the JBoss log?

I had a similar problem with a pre 1.0 version of jruby rack and it
got fixed in that.

if you are using the latest jruby-rack… there is a property you can
set in your web.xml file that turns on some more verbose logging that
might help pinpoint the problem (jruby.rack.debug.load=true)

that should get some more information.

Jay

On Sat, Sep 11, 2010 at 12:57 AM, Jj Frank [email protected] wrote:

classpath in my WAR? Some one must have done this for JBoss. It works
Posted via http://www.ruby-forum.com/.


To unsubscribe from this list, please visit:

� �http://xircles.codehaus.org/manage_email


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs