Jruby/Rails 2/Tomcat 5.5

View: New views
7 Messages — Rating Filter:   Alert me  

Jruby/Rails 2/Tomcat 5.5

by Crall, Dennis P :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hello all,

I'm trying to deploy a Rails 2.0.2 app to Jruby. I'm using Warbler .9.2,
Goldspike 1.5 snapshot, and Jruby 1.1RC1 (I've also tried 1.0.3). The war
looks good. All my gems are present. I can view the Rails index.html page.
But I can't see any of the dynamic pages. Tomcat returns:

503 The server is currently overloaded, please try again later

In the log files, I see the following error:

javax.servlet.ServletException: Could not load Rails.
    See the logs for more details.
    at org.jruby.webapp.RailsFactory.makeObject(RailsFactory.java:139)
    at org.jruby.webapp.util.CustomObjectPool.addObjectInternal
        (CustomObjectPool.java:111)
    at org.jruby.webapp.util.CustomObjectPool.access$200
        (CustomObjectPool.java:15)
    at org.jruby.webapp.util.CustomObjectPool$PoolSizeManager.run
        (CustomObjectPool.java:193)

Is this a configuration that generate a working war file? If not, what is
the recommended configuration for Rails 2? I know support of Rails 2 isn't
solid yet, but it seems like some people have been successful.

Is the error meaningful to anyone?

Any help is appreciated. Thanks,

Denny


---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email


Re: Jruby/Rails 2/Tomcat 5.5

by Nick Sieger-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Jan 23, 2008 4:27 PM, Crall, Dennis P <dennis-crall@...> wrote:

>
> Hello all,
>
> I'm trying to deploy a Rails 2.0.2 app to Jruby. I'm using Warbler .9.2,
> Goldspike 1.5 snapshot, and Jruby 1.1RC1 (I've also tried 1.0.3). The war
> looks good. All my gems are present. I can view the Rails index.html page.
> But I can't see any of the dynamic pages. Tomcat returns:
>
> 503 The server is currently overloaded, please try again later
>
> In the log files, I see the following error:
>
> javax.servlet.ServletException: Could not load Rails.
>     See the logs for more details.
>     at org.jruby.webapp.RailsFactory.makeObject(RailsFactory.java:139)
>     at org.jruby.webapp.util.CustomObjectPool.addObjectInternal
>         (CustomObjectPool.java:111)
>     at org.jruby.webapp.util.CustomObjectPool.access$200
>         (CustomObjectPool.java:15)
>     at org.jruby.webapp.util.CustomObjectPool$PoolSizeManager.run
>         (CustomObjectPool.java:193)
>
> Is this a configuration that generate a working war file? If not, what is
> the recommended configuration for Rails 2? I know support of Rails 2 isn't
> solid yet, but it seems like some people have been successful.
>
> Is the error meaningful to anyone?

Can you look a bit further up in the log file to see if there's a Ruby message?

/Nick

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email


Re: Jruby/Rails 2/Tomcat 5.5

by Lenny Marks :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I also ran into this when I was getting started deploying into  
Tomcat. Anytime there was a problem during rails initialization I'd  
see that error looping in the logs. Contrary to the 'See the logs for  
more details' message I couldn't find any additional logging  
information in the server log(catalina.out) or any of the rails log  
files. As a quick fix I wound up applying the patch below to rails-
integration to print the stack trace which did show me the underlying  
problem which was usually obvious once I could see full stack trace
(In one case it was that I was developing on a Mac which was  
shielding some case sensitivity typos in require statements). I could  
swear I tried passing the original exception to the (String msg,  
Throwable rootCause) constructor of ServletException but that didn't  
dump the entire stack trace to the logs.  Anyway, I think there is an  
issue with Goldspike swallowing exceptions. I'm guessing the Rails  
logging isn't usable before the Rails initialization is complete.


Index: src/main/java/org/jruby/webapp/RailsFactory.java
===================================================================
--- src/main/java/org/jruby/webapp/RailsFactory.java    (revision 877)
+++ src/main/java/org/jruby/webapp/RailsFactory.java    (working copy)
@@ -135,6 +135,7 @@
                  log("Rails init time: " + (System.currentTimeMillis
() - startTime) + "ms");^M
              }^M
          } catch (RaiseException e) {^M
+            e.printStackTrace();^M
              logRubyException("Failed to load Rails", e);^M
              throw new ServletException("Could not load Rails. See  
the logs for more details.");^M
          }^M

-lenny

On Jan 23, 2008, at 11:07 PM, Nick Sieger wrote:

> On Jan 23, 2008 4:27 PM, Crall, Dennis P <dennis-crall@...>  
> wrote:
>>
>> Hello all,
>>
>> I'm trying to deploy a Rails 2.0.2 app to Jruby. I'm using  
>> Warbler .9.2,
>> Goldspike 1.5 snapshot, and Jruby 1.1RC1 (I've also tried 1.0.3).  
>> The war
>> looks good. All my gems are present. I can view the Rails  
>> index.html page.
>> But I can't see any of the dynamic pages. Tomcat returns:
>>
>> 503 The server is currently overloaded, please try again later
>>
>> In the log files, I see the following error:
>>
>> javax.servlet.ServletException: Could not load Rails.
>>     See the logs for more details.
>>     at org.jruby.webapp.RailsFactory.makeObject(RailsFactory.java:
>> 139)
>>     at org.jruby.webapp.util.CustomObjectPool.addObjectInternal
>>         (CustomObjectPool.java:111)
>>     at org.jruby.webapp.util.CustomObjectPool.access$200
>>         (CustomObjectPool.java:15)
>>     at org.jruby.webapp.util.CustomObjectPool$PoolSizeManager.run
>>         (CustomObjectPool.java:193)
>>
>> Is this a configuration that generate a working war file? If not,  
>> what is
>> the recommended configuration for Rails 2? I know support of Rails  
>> 2 isn't
>> solid yet, but it seems like some people have been successful.
>>
>> Is the error meaningful to anyone?
>
> Can you look a bit further up in the log file to see if there's a  
> Ruby message?
>
> /Nick
>
> ---------------------------------------------------------------------
> 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


Re: Jruby/Rails 2/Tomcat 5.5

by Crall, Dennis P :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Lenny, Nick,

Thank you for your assistance.

Lenny, you described my situation almost exactly. The error kept looping in the logs, and I wasn't able to find any more details. I'll apply the patch and see if that helps.

Thank you,

Denny


On 1/23/08 11:03 PM, "Lenny Marks" <lenny@...> wrote:

I also ran into this when I was getting started deploying into
Tomcat. Anytime there was a problem during rails initialization I'd
see that error looping in the logs. Contrary to the 'See the logs for
more details' message I couldn't find any additional logging
information in the server log(catalina.out) or any of the rails log
files. As a quick fix I wound up applying the patch below to rails-
integration to print the stack trace which did show me the underlying
problem which was usually obvious once I could see full stack trace
(In one case it was that I was developing on a Mac which was
shielding some case sensitivity typos in require statements). I could
swear I tried passing the original exception to the (String msg,
Throwable rootCause) constructor of ServletException but that didn't
dump the entire stack trace to the logs.  Anyway, I think there is an
issue with Goldspike swallowing exceptions. I'm guessing the Rails
logging isn't usable before the Rails initialization is complete.


Index: src/main/java/org/jruby/webapp/RailsFactory.java
===================================================================
--- src/main/java/org/jruby/webapp/RailsFactory.java    (revision 877)
+++ src/main/java/org/jruby/webapp/RailsFactory.java    (working copy)
@@ -135,6 +135,7 @@
                  log("Rails init time: " + (System.currentTimeMillis
() - startTime) + "ms");^M
              }^M
          } catch (RaiseException e) {^M
+            e.printStackTrace();^M
              logRubyException("Failed to load Rails", e);^M
              throw new ServletException("Could not load Rails. See
the logs for more details.");^M
          }^M

-lenny

On Jan 23, 2008, at 11:07 PM, Nick Sieger wrote:

> On Jan 23, 2008 4:27 PM, Crall, Dennis P <dennis-crall@...>
> wrote:
>>
>> Hello all,
>>
>> I'm trying to deploy a Rails 2.0.2 app to Jruby. I'm using
>> Warbler .9.2,
>> Goldspike 1.5 snapshot, and Jruby 1.1RC1 (I've also tried 1.0.3).
>> The war
>> looks good. All my gems are present. I can view the Rails
>> index.html page.
>> But I can't see any of the dynamic pages. Tomcat returns:
>>
>> 503 The server is currently overloaded, please try again later
>>
>> In the log files, I see the following error:
>>
>> javax.servlet.ServletException: Could not load Rails.
>>     See the logs for more details.
>>     at org.jruby.webapp.RailsFactory.makeObject(RailsFactory.java:
>> 139)
>>     at org.jruby.webapp.util.CustomObjectPool.addObjectInternal
>>         (CustomObjectPool.java:111)
>>     at org.jruby.webapp.util.CustomObjectPool.access$200
>>         (CustomObjectPool.java:15)
>>     at org.jruby.webapp.util.CustomObjectPool$PoolSizeManager.run
>>         (CustomObjectPool.java:193)
>>
>> Is this a configuration that generate a working war file? If not,
>> what is
>> the recommended configuration for Rails 2? I know support of Rails
>> 2 isn't
>> solid yet, but it seems like some people have been successful.
>>
>> Is the error meaningful to anyone?
>
> Can you look a bit further up in the log file to see if there's a
> Ruby message?
>
> /Nick
>
> ---------------------------------------------------------------------
> 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




---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email


Re: Jruby/Rails 2/Tomcat 5.5

by Lenny Marks :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I filed a bug report for this: 


-lenny

On Jan 24, 2008, at 12:03 AM, Lenny Marks wrote:

I also ran into this when I was getting started deploying into Tomcat. Anytime there was a problem during rails initialization I'd see that error looping in the logs. Contrary to the 'See the logs for more details' message I couldn't find any additional logging information in the server log(catalina.out) or any of the rails log files. As a quick fix I wound up applying the patch below to rails-integration to print the stack trace which did show me the underlying problem which was usually obvious once I could see full stack trace(In one case it was that I was developing on a Mac which was shielding some case sensitivity typos in require statements). I could swear I tried passing the original exception to the (String msg, Throwable rootCause) constructor of ServletException but that didn't dump the entire stack trace to the logs.  Anyway, I think there is an issue with Goldspike swallowing exceptions. I'm guessing the Rails logging isn't usable before the Rails initialization is complete.



Index: src/main/java/org/jruby/webapp/RailsFactory.java

===================================================================

--- src/main/java/org/jruby/webapp/RailsFactory.java    (revision 877)

+++ src/main/java/org/jruby/webapp/RailsFactory.java    (working copy)

@@ -135,6 +135,7 @@

                 log("Rails init time: " + (System.currentTimeMillis() - startTime) + "ms");^M

             }^M

         } catch (RaiseException e) {^M

+            e.printStackTrace();^M

             logRubyException("Failed to load Rails", e);^M

             throw new ServletException("Could not load Rails. See the logs for more details.");^M

         }^M


-lenny


On Jan 23, 2008, at 11:07 PM, Nick Sieger wrote:


On Jan 23, 2008 4:27 PM, Crall, Dennis P <dennis-crall@...> wrote:


Hello all,


I'm trying to deploy a Rails 2.0.2 app to Jruby. I'm using Warbler .9.2,

Goldspike 1.5 snapshot, and Jruby 1.1RC1 (I've also tried 1.0.3). The war

looks good. All my gems are present. I can view the Rails index.html page.

But I can't see any of the dynamic pages. Tomcat returns:


503 The server is currently overloaded, please try again later


In the log files, I see the following error:


javax.servlet.ServletException: Could not load Rails.

    See the logs for more details.

    at org.jruby.webapp.RailsFactory.makeObject(RailsFactory.java:139)

    at org.jruby.webapp.util.CustomObjectPool.addObjectInternal

        (CustomObjectPool.java:111)

    at org.jruby.webapp.util.CustomObjectPool.access$200

        (CustomObjectPool.java:15)

    at org.jruby.webapp.util.CustomObjectPool$PoolSizeManager.run

        (CustomObjectPool.java:193)


Is this a configuration that generate a working war file? If not, what is

the recommended configuration for Rails 2? I know support of Rails 2 isn't

solid yet, but it seems like some people have been successful.


Is the error meaningful to anyone?


Can you look a bit further up in the log file to see if there's a Ruby message?


/Nick



Re: Jruby/Rails 2/Tomcat 5.5

by russ olsen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I've been seeing similar kinds of problems with goldspike swallowing rails initialization
exceptions and have traced it down to line 85 of RailsServlet.java:

   runtime.defineReadonlyVariable("$java_servlet_response", JavaEmbedUtils.javaToRuby(runtime, response));

For some reason, when rails fails to initialize, trying to wrap the response blows up.
I have been working around this by catching, reporting and otherwise ignoring the exceptions
thrown by the line above separately. If you apply the patch below, you will get coherent
ruby level error reporting when your rails application fails to initialize:

Index: src/main/java/org/jruby/webapp/RailsServlet.java
===================================================================
--- src/main/java/org/jruby/webapp/RailsServlet.java    (revision 908)
+++ src/main/java/org/jruby/webapp/RailsServlet.java    (working copy)
@@ -82,7 +82,11 @@
                // variables to expose
                runtime.defineReadonlyVariable("$stdin", stdin);
                runtime.defineReadonlyVariable("$java_servlet_request", JavaEmbedUtils.javaToRuby(runtime, request));
-               runtime.defineReadonlyVariable("$java_servlet_response", JavaEmbedUtils.javaToRuby(runtime, response));
+             try {
+                   runtime.defineReadonlyVariable("$java_servlet_response", JavaEmbedUtils.javaToRuby(runtime, response));
+             } catch (Exception e) {
+                   log("Warning: Failed to set Ruby variable $java_servlet_response" + e.getMessage());
+             }
                // $servlet_context is added when the runtime is created

                // setup the default session



Russ Olsen

Re: Jruby/Rails 2/Tomcat 5.5

by Robert Egglestone-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Russ,

Thank you for the report. I've had a look around, and previously any
unchecked exceptions would be wrapped in a ServletException and thrown up to
the container, however if the container doesn't print the trace, the message
would be lost. I've adjusted it so that now they're treated in the same way
as Ruby exceptions - the message and trace will be sent to the servlet
logger, and the message will also be passed up as a servlet exception.

Cheers,
Robert

On 16/02/08 7:51 AM, "russ olsen" <russ@...> wrote:

>
> I've been seeing similar kinds of problems with goldspike swallowing rails
> initialization
> exceptions and have traced it down to line 85 of RailsServlet.java:
>
>    runtime.defineReadonlyVariable("$java_servlet_response",
> JavaEmbedUtils.javaToRuby(runtime, response));
>
> For some reason, when rails fails to initialize, trying to wrap the response
> blows up.
> I have been working around this by catching, reporting and otherwise
> ignoring the exceptions
> thrown by the line above separately. If you apply the patch below, you will
> get coherent
> ruby level error reporting when your rails application fails to initialize:
>
> Index: src/main/java/org/jruby/webapp/RailsServlet.java
> ===================================================================
> --- src/main/java/org/jruby/webapp/RailsServlet.java    (revision 908)
> +++ src/main/java/org/jruby/webapp/RailsServlet.java    (working copy)
> @@ -82,7 +82,11 @@
>                 // variables to expose
>                 runtime.defineReadonlyVariable("$stdin", stdin);
>                 runtime.defineReadonlyVariable("$java_servlet_request",
> JavaEmbedUtils.javaToRuby(runtime, request));
> -               runtime.defineReadonlyVariable("$java_servlet_response",
> JavaEmbedUtils.javaToRuby(runtime, response));
> +             try {
> +                   runtime.defineReadonlyVariable("$java_servlet_response",
> JavaEmbedUtils.javaToRuby(runtime, response));
> +             } catch (Exception e) {
> +                   log("Warning: Failed to set Ruby variable
> $java_servlet_response" + e.getMessage());
> +             }
>                 // $servlet_context is added when the runtime is created
>
>                 // setup the default session
>
>
>
> Russ Olsen



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email