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.
Related
Every time I spin up my Rails App locally, none of the CSS shows up. The debugger in the browser shows a get request for all of the asset files with fingerprinting, but they all fail since the files can't be found. Here is what one of those requests looks like:
GET http://localhost:3000/assets/announcements.self-e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855.css?body=1
In the Rails Server Console, I get a Rack App Error, as well as a NoMethodError for the undefined method 'Silence'. Here is what one of those errors looks like:
2017-01-08 17:24:49 -0800: Rack app error handling request { GET /assets/normalize.self-cadbbf81015902777c37852b3ea54398335fd421c6c76891c077ec5954211bb4.css }
NoMethodError: undefined method 'silence' for #<Logger:0x007fe1062c1c78
Both Error logs (Browser Console and Localhost Server Console) contain multiple renditions of the same error, all pointing to Assets (*.js, and *.css).
I have searched through countless StackOverflow Posts but to no avail. This also for some reason only affects this one application; all my other Rails applications run fine. Here are my specifications:
Rails Version: 5.0.1
Ruby Version: 2.3.1p112
Things I have tried:
assets:clean, assets:precompile, rm -rf /tmp and /public/assets directpories, all of the previous prepended with the development environment, recloning the repository from github and bundle installing.
I know this is an old question, but stumbled across this while trying to fix the same problem.
I found as well as Ryan Bigg's answer I needed to comment out the following line in development.rb to stop Sprockets from bombing in Rails 5.2.2:
# Suppress logger output for asset requests.
# config.assets.quiet = true
It looks like you're running into this issue: https://github.com/rails/sprockets-rails/issues/376.
Where you've made this configuration change you should be using ActiveSupport::Logger instead. Where you have Logger.new, use ActiveSupport::Logger instead.
check The Sprockets 4 Manifest in rails 5
http://eileencodes.com/posts/the-sprockets-4-manifest/
It might help you.
Up until now I've been using script/runner to forward bouncebacks to eblast-bounceback#mydomain.com and eblast-bounceback#dev.mydomain.com. However it is no longer working in Rails 4.0. I also can't seem to find a good resource online to illustrate how to do it. I usually get directed to the 'whenever' gem - but that's for cron jobs, not for 'piping to programs'.
So this is essentially what I'm currently doing, but is failing:
|/home/user/rails/dev.www/script/rails runner 'EBlast.receive(STDIN.read)' -e development
How do I get this to work? I'm not on Rails 4.1, I'm on 4.0. FWIW I do not have bin/rails. The above command yields "no such file or directory".
There were actually a few things I needed to do.
The email eblast-bounce#dev.mydomain.com was considered 'unroutable'. At first I figured it was because there wasn't any MX records for the subdomain, so I added one. But then I still got the error. I had manually updated the aliases file in /etc/valiases to pipe to the program using a symlinked directory (because I was deploying with Capistrano, and the directory ends up changing after every deploy). Turns out symlinks don't work for some reason when it comes to exim routing (/home/me/rails_deployments/dev.www/current/bin/rails fails). Maybe I'm wrong about the symlinks thing but the problem went away when I used the solution below.
This problem however was solved when I eventually came to another problem (/usr/bin/env: ruby: No such file or directory). I'm using RVM to manage rubies/gems, and apparently the email forwarder didn't know what ruby was. This leads to the final solution:
(when in cPanel, "pipe to program" assumes the user home directory (/home/me/))
.rvm/wrappers/ruby-2.1.0#website/ruby /home/me/rails_deployments/dev.www/current/bin/rails runner 'EBlast.receive(STDIN.read)' -e development
Where ruby-2.1.0 is my current ruby version, and #website is the gemset used by the EBlast.receive code base.
EDIT: Spoke too soon, the command has its own set of problems...(gemfile not present). This is ludicrous.
I'm new to RoR.
I was able to install Rails and host it in Webrick (Sample App with "Welcome" controller) in my windows.
Now i have a Unix Weblogic Server along with a dedicated domian.
After exporting the .WAR file using Warbler, i accessed the Oracle Admin Console from where i deployed the .WAR file in the dedicated domain. I did all this for the Sample app with only the Welcome controller in it.
But even after deploying the WAR file, on accessing the Domain along with the Port Number (:9002) i ended up with 404 file not found error On looking at the server logs,there wasn't any records relating to any error. The Application must have been deployed properly. I assume that i must have missed out on some basic configurations in the routes.rb or similar files before deploying. Can anyone Guess what are all the possibilities and if possible can anyone help me by pointing to any tuts that cover the Steps to be carried out for configuration before deployment. do i need to install both JRuby and Rails inside the server before depolyment?
I can't really guess with Eror 404 only.
You can try mapping your rails app rack config to a different base_uri.
All you need to do is wrap the existing 'run' command in a map block
try doing this in your rails 'config.ru' file:
map '/mydepartment' do
run Myapp::Application
end
Now when you 'rails server' the app should be at localhost:3000/mydepartment .
Not sure if this will give you the desired outcome, but worth a try.
One more thing you also add this to your config/environments/production.rb and config/environments/development.rb (if on production mode):
config.action_controller.asset_path = proc { |path| "/abc#{path}" }
otherwise when you call your helpers such as stylesheet_link_tag in your views, they will generate links without the "/abc".
Also, find some guides you may refer for good support.
JRubyOnRailsOnBEAWeblogic.
Use JRuby with JMX for Oracle WebLogic Server 11g
Let me know if it is not resolved.
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
I've inherited a small Rails project from a new client and unfortunately the previous developer(s) left essentially no information other than the Rails app instance running in production. (No source repository, no documentation, just the login to the production server.)
Inspecting the server shows Rails version 2.3.8 installed (confirmed by the version number in "config/environment.rb") but when I try to run "ruby script/console" (or "server") on my local dev environment I get (essentially fatal) error messages originating from files in "vendor/rails/railties" and searching the internet for "railties" shows a lot of Rails 3 documentation.
I'm guessing that a previous developer/maintainer crossed the Rails 2/3 streams somehow. Should I be ok to just delete the entire "vendor/rails" directory or am I missing something?
What kind of error are you getting? Do you know that your local environment is the same as production? Do other Rails 2.3.8 projects run fine on your machine?
Now, I think it should be fine to remove vendor/rails with the exception being that if the previous developer monkeypatched something in Rails, but directly in the vendor/rails directory. Then, you might have a problem.
This approach might be a bit tedious, but I might go as follows:
Clone 2.3.8 somewhere else on my machine.
Check it in to some form of version control.
Copy your version of 2.3.8 from the project into the newly cloned directory.
Diff it.
This should show you if the previous developer made any changes, both significant and insignificant, to Rails.
Good luck, because this doesn't sound very fun :(