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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T07:29:44+00:00 2026-06-03T07:29:44+00:00

I have 2 contexts in my application, one is spring (Web+MVC), second is rpc

  • 0

I have 2 contexts in my application, one is “spring” (Web+MVC), second is “rpc” (just RPC service). Both of them inherits configs from the “spring” directory (there are 4 files: app-config.xml, infrastructure-config.xml, integration-config.xml and security-config.xml).

The app-config.xml contains initialization of the Quartz Scheduler.

So, if I starts my application, there are two Quartz Scheduler threads and all scheduled services are invoked twice. Is that because I inheriting settings from app-confix.xml into both contexts ?

I thought that beans deffined in parent config are initialized only once and shared between context which inheriting that parent config.

Thanks for any advice :).

Example from my web.xml.

<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>
        /WEB-INF/spring/*-config.xml
    </param-value>
</context-param>

<servlet>
    <servlet-name>rpc</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <load-on-startup>0</load-on-startup>
</servlet>

<servlet-mapping>
    <servlet-name>rpc</servlet-name>
    <url-pattern>/rpc/*</url-pattern>
</servlet-mapping>

<servlet>
    <servlet-name>spring</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
    <servlet-name>spring</servlet-name>
    <url-pattern>/web/*</url-pattern>
</servlet-mapping>
  • 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-03T07:29:45+00:00Added an answer on June 3, 2026 at 7:29 am

    In your configuration two independent contexts are getting created. Just the fact that they use the same files doesn’t cause spring to create a common parent context.

    What you need to do is setup a contextLoaderListener in the web.xml – give it the common config file and then exclude it from the servlets config. The Listener will create the root context and bind it to the servlet context – both the servlets will then link to that as the parent context.

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

Sidebar

Related Questions

I have two Spring contexts declared in my application - one for Spring-MVC requests,
I have a pretty simple JSP/Servlet 3.0/Spring MVC 3.1 application. On one of my
I have a web application that's based on Spring and the application contexts, applicationContext.xml
I have web application on spring mvc and maven. When I execute mvn clean
I have web application running with a default impl of a backend service. One
A standard spring web application (created by Roo or Spring MVC Project Template) create
I have a spring web application (currently packaged as a war file) which I
I have a Java web application using spring web flow. How do I pass
I am using jsf and spring together in web application. I have configured datasource
I have a one red5 application using flex. Now I just want to develop

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.