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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T10:32:40+00:00 2026-06-03T10:32:40+00:00

We have several JBoss servers sitting behind a hardware load balancer using a round

  • 0

We have several JBoss servers sitting behind a hardware load balancer using a round robin strategy. All our (JBoss) clients used to sporadically connect and these would be correctly load balanced. However, a new client is sending ~100 queries a minute and these are all being directed to the same server.

I imagine what is happening is that the remote client creates its initial context, does the lookup, and maintains the connection to the JNDI server for a period (about 15s) to save on the overhead of recreating the connection. This means the 2nd, and Nth request go to the same server. We proved this with the following code (Jython using JBoss libraries):

def __call__(self):
    p = Properties()
    p[Context.PROVIDER_URL] = "jnp://my.load.balancer:1099"
    p[Context.INITIAL_CONTEXT_FACTORY] = JndiLoginInitialContextFactory.name
    p[Context.SECURITY_PRINCIPAL] = <redacted>
    p[Context.SECURITY_CREDENTIALS] = <redacted>

    ctx = InitialContext(p)
    home = ctx.lookup("ejb/ServerNameService")

    ejbQuery = home.create()


    print "Server name: %s", (ejbQuery.getServerName())

    ctx.close()

Now, if I call that 100 times within the same JVM (multiple threads) then I always get the same server. If I call that 100 times with new JVMs then I get a mixture.

Is there any way, without using clustering technology, to force JNDI to re-negotiate it’s initial connection?

  • 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-03T10:32:43+00:00Added an answer on June 3, 2026 at 10:32 am

    Maybe. JNDI is a kind of cache for objects. So if you ask it for the same name several times within the same VM, you always get the same result. That’s the correct behavior but you don’t like it.

    The solution is to register a factory in JNDI instead of the instance itself. That way, the factory can get the information for creating the connections from JNDI but return you a new instance each time it is called (or return one from an internal pool).

    The same approach is used with JDBC. Instead of adding JDBC connections to the JNDI cache, a DataSource is added – which is a factory for JDBC java.sql.Connection instances.

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

Sidebar

Related Questions

We have a standard j2ee application written using jboss richfaces 3.3.x. we have several
Our application have several EARs deployed to a single JBOSS-AS. Every EAR uses SLF4J
I have several (as in 100s) spreadsheets using an addin (let's call it Addin2003).
We're developing a WebSite that's intended to have several requests per second.- Our current
We have several external DLL files being referenced in our Web Application Project. We
I have several 'admin' controllers, all of which inherit from AdminController, which has a
I've been working on several JBoss applications where I have everything running on my
I have built an application which simulates several clients using the same RMI service.
I have generic question on using JMS provided by JBoss 5.1. I deploy my
I have several doctrine models that have relationships to other models. Let's call those

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.