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 8656105
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T15:11:49+00:00 2026-06-12T15:11:49+00:00

I have several separate instances of the same web application running on different servers

  • 0

I have several separate instances of the same web application running on different servers (all have different public facing IPs). I make use of sessions to store currently logged in user’s information.

HttpSession session = req.getSession(true);     

User user = (User)session.getAttribute("user");
if (user == null) {
  // get my user
  session.setMaxInactiveInterval(....);
  session.setAttribute("user", user);
}

The problem is that when I log in to one instance (call it instance 1) and then log in to another (instance 2) then when I switch to instance 1 it picks up the cookie for instance 2 and obviously creates a problem when the user which such an id doesn’t exist on instance 1 and even worse when it silently just finds the user that matches that id..

I’ve looked at the cookies and only one JSESSIONID cookie is created with domain of “localhost” and it is shared with all instances. Is there a way to set Tomcat to set the domain to be the domain of the machine?

I’m running Tomcat 6.0.35

Any help would be appreciated. Thank you!

  • 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-06-12T15:11:51+00:00Added an answer on June 12, 2026 at 3:11 pm

    You can change defaultHost to the hostname (or network name) of the server.
    Have a look at Tomcat’s conf/server.xml configuration file:

    <Engine ... defaultHost="myserver">
    

    Then you’ll also need to change:

    <Host ... name="myserver">
    

    See:

    http://tomcat.apache.org/tomcat-6.0-doc/config/engine.html
    http://tomcat.apache.org/tomcat-6.0-doc/config/host.html

    As another possible solution you can define jvmRoute as the “unique name” for each instance.

    <Engine ... jvmRoute="instance1">
    

    This will generate a JSESSIONID like:

    C85262796BE5F656BD8EF58A96F03C96.instance1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have several web-servers and need them to use Quartz. The clustering feature of
Does anyone have performance data on running several separate Drupal sites (on a single
So I have a simple C#/WPF 4.0 application that includes several SurfaceTextBox instances. When
I have my main application, which contains several instances of a component that create
Requirements We have several servers (20-50) - Solaris 10 and Linux (SLES) - running
I have several instances of AVAudioPlayer in my app (in separate classes). I have
Say I have a stored procedure consisting of several separate SELECT, INSERT, UPDATE and
I have several xml files with different node structure. I want to extract xml
I have several HTML elements (buttons) that fire the same JQuery AJAX request. When
I have several different numbers in a group that range in sizes and would

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.