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

  • Home
  • SEARCH
  • 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 8716053
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:59:11+00:00 2026-06-13T05:59:11+00:00

I am writing a web application with Struts 3 using Tomcat 7 with Eclipse.

  • 0

I am writing a web application with Struts 3 using Tomcat 7 with Eclipse. When I launch Tomcat, it seems the context is loaded twice (log file shows that applicationContext.xml is read twice).

I have a context.xml file under src/main/webapp/META-INF for Tomcat :

<?xml version="1.0" encoding="UTF-8"?>
<Context path="/dbname" docBase="dbname" reloadable="true" debug="1">
  <Resource name="jdbc/dbname"
            username="dbusername"
            password="dbpassword"
            auth="Container"
            driverClassName="com.mysql.jdbc.Driver"
            url="jdbc:mysql://localhost:3306/dbname"
            type="javax.sql.DataSource"
            initialSize="5"
            maxActive="120"
            maxIdle="5"
            maxWait="5000"
            poolPreparedStatements="true"
            validationQuery="select 1" />
</Context>

My server.xml declares also (under Host and Engine) :

<Context docBase="dbname" path="/dbname" source="org.eclipse.jst.jee.server:dbname"/>

Without this, Tomcat does not launch the application.

In web.xml, I declare the contextConfigLocation like this :

<context-param>
  <param-name>contextConfigLocation</param-name>
  <param-value>classpath:spring/applicationContext.xml</param-value>
</context-param>

applicationContext.xml is located under src/main/resources/spring

Those are the two lines from the log file showing the reload :

2012-10-14 00:17:08,191 INFO [org.springframework.web.servlet.DispatcherServlet] - FrameworkServlet 'name': initialization completed in 438 ms
2012-10-14 00:17:10,972 INFO [org.springframework.web.context.support.XmlWebApplicationContext] - Closing WebApplicationContext for namespace 'name-servlet': startup date [Sun Oct 14 00:17:07 CEST 2012]; parent: Root WebApplicationContext

Issue is that on the second reload, it fails because Spring can’t find any data source (although one is definitely defined since Spring finds it during the first boot)

  • 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-13T05:59:12+00:00Added an answer on June 13, 2026 at 5:59 am

    I have a context.xml file under src/main/webapp/META-INF for Tomcat:
    […]

    My server.xml declares also (under Host and Engine) :

    So, you’ve deployed your webapp twice. Were you expecting something different?

    Remove the <Context> from server.xml: it doesn’t belong there. Then, your webapp should only load once.

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

Sidebar

Related Questions

I'm writing web application with using Spring, Velocity and Tomcat as container. My problem
I am currently writing an web application where you need to log in, using
I'm writing a web application that connects to a database. I'm currently using a
I am writing a web-application using Play 1.2.3 . One of the feature is
I'm writing a web application using the Catalyst framework . I'm also using a
I am writing a web application which retrieves a lot of data using AJAX
I am developing a Java EE web application using Struts. The problem is with
I am writing web application using ASP.NET MVC + NHibernate + Postres stack. I
I am writing a web application using java on the Google app engine. Everything
I am writing one web application using PHP/CodeIginter. Now, I want to add a

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.