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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T06:29:46+00:00 2026-06-01T06:29:46+00:00

I am using JNDI to read database configuration from my application’s context.xml. The way

  • 0

I am using JNDI to read database configuration from my application’s context.xml. The way I currently have this setup is to have [appname].xml in conf/Catalina/localhost. However, when I redeploy the app, this file gets overridden with an empty context file, and I have to copy the custom one back to the conf/Catalina/localhost directory. I have different database settings, etc. for my test and production servers, and so don’t want to put the context file in META-INF in the WAR file, but would like to just keep it in the conf/Catalina/localhost directory. Is this possible?

Is there somewhere better to put the database configuration?

I’d also like to avoid putting the configuration in the server.xml file, although I know this is possible.

Thanks!

  • 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-01T06:29:47+00:00Added an answer on June 1, 2026 at 6:29 am

    I would say look into using maven profiles (one for prod, one for test), and having different resource definitions for each profile. You can keep your common files in src/main/resources and then have a folder for each profile type to keep specific config files in:

    • src/test/resources
    • src/prod/resources

    Then you can amend your pom to define each profile and its associated resources:

    <project>
      <profiles>
        <profile>
          <id>prod</id>
          <build>
            <resources>
              <resource>
                <directory>src/main/resources</directory>
                <targetPath>${project.build.outputDirectory}</targetPath>
              </resource>
              <resource>
                <directory>src/prod/resources</directory>
                <targetPath>${project.build.outputDirectory}</targetPath>
              </resource>
            </resources>
          </build>
        </profile>
    
        <profile>
          <id>test</id>
          <build>
            <resources>
              <resource>
                <directory>src/main/resources</directory>
                <targetPath>${project.build.outputDirectory}</targetPath>
              </resource>
              <resource>
                <directory>src/test/resources</directory>
                <targetPath>${project.build.outputDirectory}</targetPath>
              </resource>
            </resources>
          </build>
        </profile>
      </profiles>
    </project>
    

    finally you can build the war using the -Pprod or -Ptest profile argument to mvn

    mvn -Pprod package
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create simply connect with ActiveMQ using JNDI. I have: Queue named
The Weblogic servers we are using have been configured to allow JNDI datasource names
Using online interfaces to a version control system is a nice way to have
From the examples that I have read and from the documentation on MysqlConnectionPoolDataSource at
My application runs under tomcat. It is using GSS API (JNDI) to connect to
I am using JNDI with Tomcat6 to manage Mysql connections, my Catalina/domain.com/ROOT.xml has: <Resource
I'm trying to implement an ejb-call by using JNDI-naming. Setup: JBoss-6.1.0.Final ear-deploy: gwt.war ejb.jar
I have a RESTful service which injects an EJB(3.0) using the @EJB annotation. This
I have created an Active Directory client using JNDI, that has the ability to
I'm trying to configure a Spring+Hibernate web application using JNDI instead of a properties

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.