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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:24:56+00:00 2026-05-23T20:24:56+00:00

If I have a Servlet class, and this class is used in two applications

  • 0

If I have a Servlet class, and this class is used in two applications – are static members of shared across both applications?
Is this behaviour specified by Java EE or container specific?

  • 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-23T20:24:57+00:00Added an answer on May 23, 2026 at 8:24 pm

    If I have a Servlet class, and this class is used in two applications – are static members of shared across both applications?

    No, the static members will not be shared across applications. Typically, each application would be associated with its own classloader, and hence, the Servlet class would be loaded twice in the container. By inference, static members would not be shared across the applications.

    If you need to share data across applications, it is recommended to use files, JMS queues or a database, depending on your needs.

    Is this behaviour specified by Java EE or container specific?

    The Java EE 6 Platform specification does not define class loading behavior. The specification states the following in this regard:

    EE.8.3 Class Loading Requirements

    The Java EE specification purposely does not define the exact types
    and arrangements of class loaders that must be used by a Java EE
    product. Instead, the specification defines requirements in terms of
    what classes must or must not be visible to components.

    Classes and resources that are visible to components, do not include classes from other web modules in other applications. They might include classes and resources in other web modules of the same application:

    EE.8.3.1 Web Container Class Loading Requirements

    …

    Components in the web container may have access to the following
    classes and resources. Portable applications must not depend on having
    or not having access to these classes or resources.

    •The classes and resources accessible to any other web modules included in the same ear
    file, as described above.

    …

    By inference, the Servlet class, if deployed in two different applications, will not be able to access the other class in the other application.

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

Sidebar

Related Questions

I have a piece of Java code in a simple blogging servlet being used
I have Servlet that looks something like this: public class MyServlet extends Servlet {
I'm working on an application. I have a servlet (writeDataBase.class) that writes some information
I have a servlet that is used for many different actions, used in the
I have a servlet which takes us to an existing jsp, say home.jsp. This
I have a Java servlet, where I want to use the Jackson JSON parser
I have a controller that inherits from the org.springframework.web.servlet.mvc.AbstractController class I have configurated it
I do have a communication problem here between my Java servlet and an Ajax
My java class (servlet) has been running fine, but recently, I noticed a problem.
Let's say I have a structure -bin/com/abc/A.class -src/com/abc/A.java -config/info.txt How to address the file

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.