Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6772139
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:30:51+00:00 2026-05-26T15:30:51+00:00

I’m deploying a JRuby/Rails app packed up into abc.war, and it is deployed with

  • 0

I’m deploying a JRuby/Rails app packed up into “abc.war”, and it is deployed with a Java app packed up into “def.war” in the same Tomcat instance.

I have a resource in my Rails application called “Blogs”, with the following entry in routes.rb

resources  :blogs

With this entry in routes.rb, I have helpers such as blogs_path() so I can use statements such as:

<%= link_to "Blogs", blogs_path %>

in my application view file, and hitting the generated link displays a list of blogs.

When this application runs standalone with the Webrick web server (JRuby 1.6.4, configured with Ruby 1.9, and Rails 3.0.10), it works fine, in that http://localhost:3000/blogs gets me a list of blogs when I hit that link). When I deploy the app to another base server URL such as, say, “http://funky-freddy-101.heroku.com&#8221;, then I don’t have to change the code with “blogs_path”, because Rails automagically figures out the base URL and blogs_path() code takes that into account when building the actual URL generated by “blogs_path”.

When deploying the app to JRuby/Tomcat in the file “abc.war”, the base URL changes from http://localhost:3000” to “http://localhost:8081/abc&#8221;. So typing “http://localhost:8081/abc/blogs&#8221; in the browser will give me a list of blogs, and “http://localhost:8081/blogs&#8221; gives me a 404 error. However, the problem is that although the base URL for the application includes the suffix of the WAR file name (i.e. “abc”) Rails has not picked up on that and therefore still generates “http://localhost:8081/blogs&#8221; as the URL when blogs_path() is called. When I click on the link, it gives me the standard Tomcat 404 page.

Is there any simple way to get Rails to get the base URL suffixed with the reference “abc”, the name of the WAR file, and generate URLs appropriately in a JRuby/Tomcat deployment? And because this application is running alongside def.war, I cannot make it the root app.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T15:30:52+00:00Added an answer on May 26, 2026 at 3:30 pm

    I found a similar question on stackoverflow.com. In the file /config.ru, I did the following:

    map '/abc' do
       run Abc::Application
    end 
    

    I also had to make sure that I blew away the folder created by Tomcat to expand my WAR file before I deployed my new WAR.

    Then my app just worked under the /abc URL scope, and it worked the same whether standalone or in a WAR file with Tomcat.

    EDIT

    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”.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
We're building an app, our first using Rails 3, and we're having to build
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into
I am currently running into a problem where an element is coming back from
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I am writing an app with both english and french support. The app requests
I am using Paperclip to handle profile photo uploads in my app. They upload
That's pretty much it. I'm using Nokogiri to scrape a web page what has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.