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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T18:24:28+00:00 2026-05-15T18:24:28+00:00

When I start a webapp that has a spring configuration in jetty, I see

  • 0

When I start a webapp that has a spring configuration in jetty, I see two calls to initialization (@PostConstruct methods). web.xml declares a ContextLoaderListener and provides contextConfigLocation.

This seems wrong. (spring 3.0.3). Is there something I’ve done?

EDIT

My web.xml calls out both the DispatcherServlet and the org.springframework.web.context.ContextLoaderListener. If I remove the later, I stop seeing two initializations — but my app fails in the jetty-maven-plugin with

No WebApplicationContext found: no ContextLoaderListener registered?

EDIT 2:

Got it. The dispatch servlet will find some context files by conventional name (*-servlet.xml), and so calling that file out again in the contextConfigLocation led to it being loaded twice.

Stack trace 1:

Segmenter.initialize() line: 63 
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]  
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39  
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25  
Method.invoke(Object, Object...) line: 597  
InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(Object) line: 340    
InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(Object, String) line: 293    
CommonAnnotationBeanPostProcessor(InitDestroyAnnotationBeanPostProcessor).postProcessBeforeInitialization(Object, String) line: 130 
DefaultListableBeanFactory(AbstractAutowireCapableBeanFactory).applyBeanPostProcessorsBeforeInitialization(Object, String) line: 394    
DefaultListableBeanFactory(AbstractAutowireCapableBeanFactory).initializeBean(String, Object, RootBeanDefinition) line: 1405    
DefaultListableBeanFactory(AbstractAutowireCapableBeanFactory).doCreateBean(String, RootBeanDefinition, Object[]) line: 519 
DefaultListableBeanFactory(AbstractAutowireCapableBeanFactory).createBean(String, RootBeanDefinition, Object[]) line: 456   
AbstractBeanFactory$1.getObject() line: 291 
DefaultListableBeanFactory(DefaultSingletonBeanRegistry).getSingleton(String, ObjectFactory) line: 222  
DefaultListableBeanFactory(AbstractBeanFactory).doGetBean(String, Class<T>, Object[], boolean) line: 288    
DefaultListableBeanFactory(AbstractBeanFactory).getBean(String) line: 190   
DefaultListableBeanFactory.preInstantiateSingletons() line: 574 
XmlWebApplicationContext(AbstractApplicationContext).finishBeanFactoryInitialization(ConfigurableListableBeanFactory) line: 895 
XmlWebApplicationContext(AbstractApplicationContext).refresh() line: 425    
ContextLoaderListener(ContextLoader).createWebApplicationContext(ServletContext, ApplicationContext) line: 276  
ContextLoaderListener(ContextLoader).initWebApplicationContext(ServletContext) line: 197    
ContextLoaderListener.contextInitialized(ServletContextEvent) line: 47  
JettyWebAppContext(ContextHandler).startContext() line: 645 
JettyWebAppContext(ServletContextHandler).startContext() line: 200  
JettyWebAppContext(WebAppContext).startContext() line: 995  
JettyWebAppContext(ContextHandler).doStart() line: 588  
JettyWebAppContext(WebAppContext).doStart() line: 381   
JettyWebAppContext.doStart() line: 114  
JettyWebAppContext(AbstractLifeCycle).start() line: 55  
ContextHandlerCollection(HandlerCollection).doStart() line: 165 
ContextHandlerCollection.doStart() line: 162    
ContextHandlerCollection(AbstractLifeCycle).start() line: 55    
HandlerCollection.doStart() line: 165   
HandlerCollection(AbstractLifeCycle).start() line: 55   
JettyServer(HandlerWrapper).doStart() line: 92  
JettyServer(Server).doStart() line: 228 
JettyServer.doStart() line: 67

Stack trace 2:

Segmenter.initialize() line: 63 
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]  
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39  
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25  
Method.invoke(Object, Object...) line: 597  
InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(Object) line: 340    
InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(Object, String) line: 293    
CommonAnnotationBeanPostProcessor(InitDestroyAnnotationBeanPostProcessor).postProcessBeforeInitialization(Object, String) line: 130 
DefaultListableBeanFactory(AbstractAutowireCapableBeanFactory).applyBeanPostProcessorsBeforeInitialization(Object, String) line: 394    
DefaultListableBeanFactory(AbstractAutowireCapableBeanFactory).initializeBean(String, Object, RootBeanDefinition) line: 1405    
DefaultListableBeanFactory(AbstractAutowireCapableBeanFactory).doCreateBean(String, RootBeanDefinition, Object[]) line: 519 
DefaultListableBeanFactory(AbstractAutowireCapableBeanFactory).createBean(String, RootBeanDefinition, Object[]) line: 456   
AbstractBeanFactory$1.getObject() line: 291 
DefaultListableBeanFactory(DefaultSingletonBeanRegistry).getSingleton(String, ObjectFactory) line: 222  
DefaultListableBeanFactory(AbstractBeanFactory).doGetBean(String, Class<T>, Object[], boolean) line: 288    
DefaultListableBeanFactory(AbstractBeanFactory).getBean(String) line: 190   
DefaultListableBeanFactory.preInstantiateSingletons() line: 574 
XmlWebApplicationContext(AbstractApplicationContext).finishBeanFactoryInitialization(ConfigurableListableBeanFactory) line: 895 
XmlWebApplicationContext(AbstractApplicationContext).refresh() line: 425    
DispatcherServlet(FrameworkServlet).createWebApplicationContext(ApplicationContext) line: 442   
DispatcherServlet(FrameworkServlet).createWebApplicationContext(WebApplicationContext) line: 458    
DispatcherServlet(FrameworkServlet).initWebApplicationContext() line: 339   
DispatcherServlet(FrameworkServlet).initServletBean() line: 306 
DispatcherServlet(HttpServletBean).init() line: 127 
DispatcherServlet(GenericServlet).init(ServletConfig) line: 241 
ServletHolder.initServlet() line: 421   
ServletHolder.doStart() line: 245   
ServletHolder(AbstractLifeCycle).start() line: 55   
ServletHandler(ServletHandler).initialize() line: 691   
JettyWebAppContext(ServletContextHandler).startContext() line: 204  
JettyWebAppContext(WebAppContext).startContext() line: 995  
JettyWebAppContext(ContextHandler).doStart() line: 588  
JettyWebAppContext(WebAppContext).doStart() line: 381   
JettyWebAppContext.doStart() line: 114  
JettyWebAppContext(AbstractLifeCycle).start() line: 55  
ContextHandlerCollection(HandlerCollection).doStart() line: 165 
ContextHandlerCollection.doStart() line: 162    
ContextHandlerCollection(AbstractLifeCycle).start() line: 55    
HandlerCollection.doStart() line: 165   
HandlerCollection(AbstractLifeCycle).start() line: 55   
JettyServer(HandlerWrapper).doStart() line: 92  
JettyServer(Server).doStart() line: 228 
JettyServer.doStart() line: 67
  • 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-15T18:24:29+00:00Added an answer on May 15, 2026 at 6:24 pm

    Actally, you have two Spring application contexts:

    • Context loaded by ContextLoaderListener from the XML files specified by context-param named contextConfigLocation (or applicationContext.xml by default).
    • Context loaded by DispatcherServlet from the XML files specified by the dispatcher servlet’s init-param named contextConfigLocation (or <servletname>-servlet.xml by default).

    The former is a parent context of the latter.

    So, you somehow got a definitions of the same bean in both contexts (perhaps, both contextConfigLocations point to the same XML files).

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

Sidebar

Related Questions

I want to create a bean that has start() and stop() methods. When the
All, I am having some trouble running a java web start application that has
I have a Java/Spring MVC/JSP/JSTL webapp. We have a designer that gave us some
I have made a Azure web app that has a ASP.NET web that also
I have an ASP.NET WebApi application that has some controller methods that expect certain
I am currently attempting to create a fairly basic web app that has the
I have a Java web application that has a 'disconnected' Java Swing desktop app.
My web app has 3 main node.js components: website, feeds and jobs. To start
I'm very new to web app development and I thought I would start with
After a button is clicked to start a process on my web app, I

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.