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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:34:06+00:00 2026-05-20T10:34:06+00:00

Background Developing a simple web application (Eclipse + JBoss + Apache Tomcat) to generate

  • 0

Background

Developing a simple web application (Eclipse + JBoss + Apache Tomcat) to generate XML files.

Problem

The “Business Area” list queries against the database, and the “Column Cluster” list queries the database using the selected “Business Area” items. Both of these are unique queries that are stored external text files.

The files are currently stored in the following locations:

  • WebContent/META-INF/business-areas.sql
  • WebContent/META-INF/column-clusters.sql

These are then used to seed PreparedStatements.

Source Code

The method to read the SQL code might resemble:

  private String getSQL() {
    String result = "";

    try {
      BufferedReader br = open( "business-areas.sql" );
      String line = null;

      while( (line = br.readLine()) != null ) {
        result += line;
      }

      br.close();
    }
    catch( Exception e ) {
      e.printStackTrace();
    }

    return result;
  }

Questions

I would like to know:

  1. What are the best practices for storing such assets for deployment as part of a web app? (That is, is META-INF a good location, or is META-INF/resources preferred?)
  2. What APIs would you recommend for reading the file content? (That is, how do I write the open method so that it finds the files to open?)

I already have JNDI in place to establish the database connection, but would rather not use JNDI to obtain handles to the files, if possible.

Related Sites

  • http://blogs.oracle.com/alexismp/entry/web_inf_lib_jar_meta
  • http://www.avajava.com/tutorials/lessons/where-do-i-put-resources-in-my-maven-project.html
  • http://docs.jboss.org/jbossweb/3.0.x/config/context.html
  • http://tomcat.apache.org/tomcat-4.0-doc/catalina/docs/api/org/apache/naming/resources/FileDirContext.html

Thank you!

  • 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-20T10:34:07+00:00Added an answer on May 20, 2026 at 10:34 am

    The right location (and also the common practice) is to place them under your source directory, which will then gets compiled into WEB-INF/classes directory. I’m not sure what you meant by “classes directory is volatile” in your response to @Dave, but this is how most (if not all) Java web apps store things. WEB-INF/classes is not just for Java classes. It’s common to see logging properties file (like log4j), Hibernate and Spring XML files stored under source directory and you can safely access the files using something like this:-

    // in this case, the business-areas.sql is located right under "source/sql" directory
    InputStream is = getClass().getClassLoader().getResourceAsStream("sql/business-areas.sql");
    BufferedReader br = new BufferedReader(new InputStreamReader(is));
    

    Some useful information about the use of META-INF: What's the purpose of META-INF?

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

Sidebar

Related Questions

I'm coming from a background developing business applications so am used to MVC/n-Tier development.
Background I am developing a social web app for poets and writers, allowing them
i am developing an application which requires recording a video in the background while
Background I'm developing a django app for a vacation rental site. It will have
I'm developing a Windows gadget. There is a function called addTextObject on the background
Coming from C++ & MFC background, is there any better (maintainability/customization) platform in developing
I am a new to developing for Android and have been reading up and
I have recently been developing a website for a company, with a full administration
Usually I would look at writing a Windows Service to manage tasks that aren't
I am doing a tool in PHP for my personal use. But PHP is

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.