Deploying JRuby/Rails to Glassfish: undefined method `bundle_path' for Bundler:Module - ruby-on-rails

The following error shows up in my Glassfish log when attempting to access my app:
Caused by: org.jruby.exceptions.RaiseException: (NameError) method 'to_yaml' not defined in Object
Looking through the log I see this:
undefined method `bundle_path' for Bundler:Module
I confirmed that warble is definitely putting the Bundler gem in my .war file.
(using ruby 1.9, rails 3.1, glassfish 3.0 and 3.1)
This also appears in the glassfish log:
Policy Provider:Failed Permission Check: context (" myapp/myapp ") , permission (" (java.lang.reflect.ReflectPermission suppressAccessChecks) ") |#]
However I've verified that the permission is granted in server.policy.
EDIT: I fixed the permission problem and the first two errors persist. (That said, the premission problem required me to edit a file it specifically says not to edit. Attempting to grant this permission in server.policy in Glassfish did not work).
Here is the relevant environment info from the Glassfish log file: https://gist.github.com/1245825

You can host it outside Glassfish, on a, nginx+passenger or apache2+passenger configuration, and have it proxying Glassfish. It's a win-win solution, if you don't have to integrate with any other java resource/app.

This affects some application servers but not others.
See this thread for further information and a quick fix.
https://github.com/jruby/warbler/issues/44#issuecomment-2809940

Related

Instance deployment failed to install dependency gems that you defined in 'Gemfile'. For details, see 'eb-engine.log'. The deployment failed

I'm facing this issue while trying to deploy rails app via AWS Elastic-beanstalk cli.
Even I tried this solution Installing gems fails in deployment - AWS Elastic Beanstalk but NO LUCK.
I don't really know where you are in your deployment without specific error or log information. Please post more log info so we can better help you! If you don't have detailed logging, try setting it up using these steps
Assuming your error is in the eb-engine.log file, you can try the following steps to troubleshoot the issue:
Check the error message in the log file to see if it provides any clues about the cause of the error.
Check the Elastic Beanstalk environment settings to ensure that all required settings are properly configured.
Check the Ruby on Rails application code for any errors or issues that may be causing the error.
If necessary, try redeploying the application using the eb deploy command.

How can I debug my Rails application which encountered an internal server error?

I am using Rails 4.1 and Ruby 2.1.1 on Ubuntu.
My application is running just fine on the local development environment. When I moved everything to the production environment server, and tried the application URL, I got the following:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
The log file (production.log) has in it something about the migrations, but nothing else.
Where do I get started trying to figure out what this is about?
From original poster:
I followed the instructions and set up an environment variable for the secret_key. It turns out Rails 4.1 cannot read it and this seems to be a known issue. So, I had to put the key directly into secrets.yml and this solved the problem

Context not being set properly with warbler and tomcat

I'm trying to deploy a Rails app to Tomcat with a war file generated by Warbler. The war file deploys to /myproject-rails-gui without any problems but, when I try to access a page on the app, I'm getting:
ArgumentError: wrong number of arguments (1 for 0)
send at org/jruby/RubyKernel.java:2097
Railtie at /home/myproject/apache-tomcat-7.0.22/webapps/myproject-rails-gui/WEB-INF/gems/gems/actionpack-3.0.10/lib/action_controller/railtie.rb:54
It's failing when it tries to set relative_url_root. There are other Stack Overflow articles that (correctly) point out that relative_url_root is deprecated and you should set the RAILS_RELATIVE_URL_ROOT environment variable instead.
From the Rails project on GitHub
module ActionController
class Base
# Deprecated methods. Wrap them in a module so they can be overwritten by plugins
# (like the verify method.)
module DeprecatedBehavior #:nodoc:
def relative_url_root
ActiveSupport::Deprecation.warn "ActionController::Base.relative_url_root is ineffective. " <<
"Please stop using it.", caller
end
def relative_url_root=
ActiveSupport::Deprecation.warn "ActionController::Base.relative_url_root= is ineffective. " <<
"Please stop using it.", caller
end
I haven't had any luck figuring out how to do that using Warbler and Tomcat, though. Any suggestions? For what it's worth, the app works fine when I run it in the root context.
My environment:
Warbler 1.3.2
Tomcat 7.0.22
JRuby 1.6.5
Rails 3.0.10
After a lot of digging, it looks like this particular exception was being caused by a missing parameter in ActionController::DeprecatedBehavior.relative_url_root= in Rails v3.0.10. Miguel, your issue might be related but, if you're seeing it in Rails v3.1.1, then it's slightly different. The file that I had to modify to fix it doesn't exist in v3.1.1.
I filed issue 3645 in the Rails project on Github, fixed it in a fork, and issued a pull request to them. Hopefully this will be fixed in a new release of Rails 3.0.
In the meantime, if you want to use my fixed version, it's available at https://github.com/mhuffnagle/rails/tree/3-0-stable.

Google Visualizations for Rails 3 - uninitialized constant ApplicationHelper::GoogleVisualization

I am using the following gem for Google Visualizations https://github.com/jeremyolliver/gvis
I have followed the instructions for installation and usage on the page but I get the following error:
uninitialized constant ApplicationHelper::GoogleVisualization
How can I correct this error? I think it may be to do with restarting the server or rails but I'm not sure how to do this
Also what is the common plugin/gem or approach to using Google Visualizations with rails 3?
EDIT: I have now restarted my server and get the same error. One thing I noticed in the installation instructions is renaming the directory:
mv vendor/plugins/rails/rails-google-visualization-plugin vendor/plugins/google_visualization
The first line has a sub directory called rails within vendor/plugins, however this is not actually created when the plugin is installed. I am not sure if this is a typo error or not in the installation instructions
It's possible that you just need to restart your server. Open the console with your Mongrel or WEBrick running, and type Ctrl+C, and when it's done exiting, type rails s.

Where are the logs for a Rails app packed using Warbler?

I'm using Warbler to pack a Rails application into a WAR. I've deployed it to a JBoss server and it seems to works.
However, I'm getting the classic 500 error on Rails saying "We're sorry, but something went wrong.".
Usually, I'd take a look at logs/production.log to find out what's wrong, but since the project is WARed, I can't access it. The question is, where are the logs written when the Rails app gets warbled?
JRuby-Rack, the servlet container adapter that Warbler bundles, is set up by default to redirect Rails logs to the servlet container using the javax.servlet.ServletContext#log method. So exactly where the logs appear is server-specific. For Tomcat, they should be in catalina.out, for GlassFish, server.log.
If you still don't see error messages in the log files, there could be a bug somewhere along the way that is swallowing the error. Feel free to open a problem report for JRuby-Rack at http://kenai.com/jira/browse/JRUBY_RACK.
Although this question is pretty old and has been answered already, but I had been facing similar issue with Sinatra application which was warbled and deployed in Tomcat. The catalina.out (or tomcat logs folder) was not spitting out the logs at all. I finally found that the logs reside in the deployed application's WEB-INF folder itself.
For example
{TOMCAT_BASE}/webapps/{WEB_APPLICATION_PATH/WEB-INF/log/production.log
This had been a mystery to me for quite sometime.

Resources