Where do I put config files for a webapp (war file)?

To my understanding a war file is supposed to be dropped in. It's isn't intended to be unzipped by the person installing the webapp. Inside my web app I have some xml files I access to get configuration information for how the servlet works. This xml file is intended to be edited by the sysadmin using the webapp. So, it's obvious I can't put my xml file inside my war file otherwise they'd have to unzip it to edit it. So my question is, where do I put it? What is the normal place to put stuff like this for a webapp?
Example:
I make a servlet (or jsp/custom tags) that generates an explorer-like directory tree. It reads the tree folders and files from an xml file. So one sysadmin might make a tree that looks like this:
Fruit
|-apples
| |-Gala
|-oranges
|-pears
another sysadmin might make a tree that looks like this:
Bookstore
|-Technical Books
| |- JSP to go
|-Children's Books
|-Dr Seuss
And these are defined in the xml file.
It's driving me crazy because I want to make my webapp deployable in a war file. Since I have to unzip it right now, the war file is useless.
Thanks,
David

I don't have the answer, but I understand your pain. I was trying to figure this out last year before my company went out of business and made this problem go away.
The issue is that you want to have a user install your webapp by deploying the war file and configure the app without unzipping the war file. If you can start the webapp first, why not just put the default or empty configuration file somewhere in your webapp director structure and write an administration servlet or JSP to configure it.
If you must configure the application before it can start up, the following might apply.
The obvious approach would be to install a properties or xml file separately from the war file and let the user edit that file. The problem is that your servlets and jsps need to be able to find it at run time. This is problematic because the current directory for relative paths seems to vary from one server to another. If I remember correctly, on Windows NT running Tomcat, current directory points to C:\jakarta-tomcat-x.x.x\bin. When running Websphere, it points to C:\WINNT. You can figure this out for the server your user is going to be running and have them put the file in one of those places. But I don't like putting my application files in places like that.
I can't remember at the moment how it works in other servers, but at least in Tomcat you might put the configuration file in the webapps directory with your war file. Then you could have your servlet do a getServletContext().getRealPath() or something like that and back up the path one level to get to the file.
At one point I thought it would be nice to put the path to the configuration file in the system environment, but we couldn't find any way in Java to get access to it.
Will.

Similar Messages

  • Where to put config files in webdynpro ?

    Hi all:
    I have some config files needed to be put in classpath. However, which directory in webdynpro can be used for classpath loader ?
    Is META-INF will be loaded by classloader ?

    hi,
    put the config files in WEB-INF folder.
    If needed make an entry for the location of file in web.xml.
    <b>for eg:</b>
    <taglib>
    <taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
    <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
    </taglib>
    Regards,
    KK

  • Where should I put JDBC driver for MySQL

    I am trying to connect MySQL with JDBC 2.0 API. I have downloaded the driver file mm.mysql-2.0.4-bin. Where should I put this driver to make it run ?
    According to mysql.org, it says "Put mysql.jar in your classpath". I am confuse by classpath. Is it same as the path ? or is another system variable.
    thanks for clear my doubt. ^_^

    it is a different variable, but also in the same file (autoexec.bat) as path;
    set CLASSPATH=%classpath%;C:\JDK1.3.0_02\bin;c:\path\mm.mysql-2.0.4-bin
    Jamie

  • Where is SSIS Package Config File At?

    I found a solution to execute SSIS package from button on Winform. The solution will work once I find the path to the SSIS package config file (in my opinion).  Where do I find this?

    @Vaibhav
    I found the following solution that I want to use for a user to execute an SSIS package at the click of the button:
    stringsPackage =
    @"C:\Path";
    stringsConfig =
    @"C:\Path"; 
    //thought this was used for ssis config file
    OpenFileDialogfDialog =
    newOpenFileDialog();
                fDialog.Title =
    "Open Package";
                fDialog.Filter =
    "SSIS Package (*.dts, *.dtsx)|*.dts;*.dtsx";
                fDialog.InitialDirectory =
    @"C:\";
                sPackage = fDialog.FileName.ToString();
    OpenFileDialogf2Dialog =
    newOpenFileDialog();
                fDialog.Title =
    "Open Package";
                fDialog.Filter =
    "SSIS Package (*.dts, *.dtsx)|*.dts;*.dtsx";
                fDialog.InitialDirectory =
    @"C:\";
                sConfig = fDialog.FileName.ToString();
    MyEventListenereventListener =
    newMyEventListener();   
                Microsoft.SqlServer.Dts.Runtime.
    Applicationapp =
    newMicrosoft.SqlServer.Dts.Runtime.Application();
                Microsoft.SqlServer.Dts.Runtime.
    Packagepkg = app.LoadPackage(sPackage,
    eventListener, false);
                Microsoft.SqlServer.Dts.Runtime.
    DTSExecResultpkgResults = pkg.Execute(null,
    null, eventListener ,
    null,
    null);
    MessageBox.Show(pkgResults.ToString());
    class
    MyEventListener:
    DefaultEvents
    publicoverrideboolOnError(DtsObjectsource,
    interrorCode,
    stringsubComponent,
    stringdescription,
    stringhelpFile,
    inthelpContext,
    stringidofInterfaceWithError)
    // Add application-specific diagnostics here.
    MessageBox.Show("Error
    in "+
    "/t"+ source
    + "/t"+
    subComponent + "/t"+
    description);
    returnfalse;
    May you explain to me what I am missing.  The following are the errors I am getting when running and compiled:
    "Error in/t Micrrosoft.SqlServer.DTs.Runtime.Package /t/t Unable to load the package as XML because of package does not have a valid XML format.  A specific XML parser error will be posted."
    Then...
    "Error in/t Micrrosoft.SqlServer.DTs.Runtime.Package /t/t Failed to open package file "" due to error 0x8000057 "The parameter is incorrect.". This occurs when a loading a package and the file cannot be opened or loaded correctly
    into the XML document.  This can be the result of specifying an incorrect file name when calling LoadPackage or the specified XML file has an incorrect format."

  • Where do i put plugin node for my printer and photoshop cs

    hello all. i have a question that has been vexing me for some time. where do i place the plugin nodes for my printer software and my photoshop cs? the printer is an epson r200. also, i need to place the scanner plugin for an epson stylus 3200 all-in-one printer. i have read the help library for each app, but haven't found where ot put them. thanks for your time and attntion, mcrat

    I have that printer...
    Maybe we can approach this differently? I haven't manually installed anything and the printer prints fine. To start, have you Added the printer using More Printers > Epson USB? That's how you use the epson driver. If that's not it, can you explain what isn't working?

  • Where does iphone put backup files? I have time machine, ios 10.6.7, iphone 3. Thanks!

    I am looking to retrieve an important text that somehow I erased! Where might you suggest I look for a iphone backup & do you know if texts are also backed up?

    SMS's are included in the iPhone backup:
    http://support.apple.com/kb/ht1766
    iTunes places the backup files in the following places:
    Mac: ~/Library/Application Support/MobileSync/Backup/
    Windows XP: \Documents and Settings\(username)\Application Data\Apple Computer\MobileSync\Backup\
    Windows Vista and Windows 7: \Users\(username)\AppData\Roaming\Apple Computer\MobileSync\Backup\

  • Where do you put libflishplayer.so for firefox6 on mandriva 2010.2

    I am running Mandriva 2010.2
    just went to firefox 6 :)
    where do you put libflashplayer.so

    Does it work if you create a plugins folder in the Firefox Profile Folder and place a symlink to the Flash plugin (libflashplayer.so) in that folder?
    *http://kb.mozillazine.org/Profile_folder_-_Firefox
    *Help > Troubleshooting Information > Profile Directory: Open Containing Folder

  • Where should i put the file adf-config.xml ?

    hi,
    I want to enable adf authorization,according to B25947(developer guide for 4gl/form developer),this file should put to <application_ name>/.adf/META-INF
    Is it correct?I'm feel odd. Another thing is :why container binding authorization user/role come from system-jazn-data.xml?
    thanks everyone advance
    lixinzhu
    2007/4/25

    Hi,
    yes, .adf\META-INF is located in the root workspac directory. It is created automatically if you se JDeveloper 10.1.3.2, which has an ADF Security wizard to automate the setup.
    The system-jazn-data.xml usage is a requirement coming from OC4J and has to do with ADF Security using JAAS for authorization. This is subject tochange in a future version in which JAAS definitions will be possible on an application scope (jazn-data.xml) as well
    Frank

  • Where is the php config file?

    where does os x 10.4.6 keep the php.ini (configuration) file for it's preinstalled php api?

    i wouldnt go messing with the system php install... install a new one in /usr/local and mess with that if you need some customization. that way youre not put in a situation where you have to try to patch things back or reinstall. Not that backing up an restoring a simple ini is all that involved but you never know what it may lead to

  • IPhoto where does it put camera files?

    I can't figure out where iPhoto puts my camera files when it downloads them. It seems the only way to find them is via iPhoto. I diligently looked in Preferences but nothing popped out. I went to the Help and under the various "Lessons" all I get is The selected topic is currently unavailable.
    Why does Apple make this sort of thing so hard to figure out?

    By default, your files are copied to the iPhoto Library in your Pictures Folder.
    Yes, the way to interact with your Photos is with iPhoto. That's the point of the application, and why you would use it. It replaces the File Manager. Anything you want or need to do with your Photos  - and I do mean anything - is done either with or via iPhoto.
    For help accessing your photos in iPhoto see this user tip:
    https://discussions.apple.com/docs/DOC-4491
    If you have a specific need then by all means post back and we can tell you how to use iPhoto for that purpose.

  • Where is the Terminal config file?

    Hello,
    I am trying to add a simple alias as a default to Terminal. Where is the configuration file? I can't find it anywhere.
    Thanks!

    Hopefully you are talking about the Shell's initialization file, where the default shell is 'bash'
    Bash looks for
    $HOME/.bash_profile
    $HOME/.bash_login
    $HOME/.profile
    in that order, and stops looking after finding the first one.
    If you are using a different shell, then the shell initialization file will be different.
    This is totally independent of the Terminal, as you could also be using a different terminal emulator, such as iTerm, or an X11 xterm emulator.  You might be remotely logged in via ssh from a Windows, Solaris, AIX, Linux, HP-UX, etc... system where they are using a totally different terminal emulator.

  • Where are the about:config settings for a profile stored?

    I am setting up a custom firefox profile and would like to tweak some of the options that are accessed via about:config.
    I would like to know where this information is stored and whether I am able to modify these options outside of the browser.

    Thanks, I was modifying the prefs.js file the whole time but didn't realize these were the same settings from about:config. The user.js file is also useful to know.

  • What is the best screen protector for the iPad 3 where was I put it on for me chits hard steps

    What's the best screen protector for the iPad three and reasonably priced. Why doesn't Apple just make wondering themselves.

    Invisible Shield by Zagg has always been my preference. 

  • Where should I put downloaded templates for iWork?

    I have downloaded several templates and they are in the "downloads" folder. Which folder should they be in to appear in the iWork applications "file", "new" menu? Is there an easier way to download templates and have them automatically placed in the right spot?
    Thanks!

    The way I store templates is I open them in the application that they will be used in and then use File > Save As Template.
    Allan

  • Where do I put the code for ePrint mobile?

    I am currently signed in and can't find the area for ePrint mobile.

    Hi MalWill456,
    Which code are you talking about?:
    - The ePrint code that printed off when web services was enabled?
    - The code for the HP ePrint Home and Biz app?
    - The code or server for the HP ePrint Service app?
    Depending on which code you need, you would obtain it different ways.
    If I have solved your issue, please feel free to provide kudos and make sure you mark this thread as solution provided!
    Although I work for HP, my posts and replies are my own opinion and not those of HP.

Maybe you are looking for

  • Hardware Summary Report export

    Using ConsoleOne, and performing a Zenworks Report (Hardware Summary Report), this is OK but I need to export it to an Access database. It exports, but half the info on the Zen report is not exported (Current Speed and HD Size). I've tried exporting

  • Does clustered MSDTC require Application Server role in Windows 2008 R2?

    I'm reviewing a windows 2008 R2 2-node Active/Passive cluster which has clustered MSDTC and SQL Server.   The strange thing is that Application Server role is not installed. I thought MSDTC requires Application Server role in order to be clustered.

  • Help me! cann't restore database using RMAN!!

    i've backuped database using RMAN, now datafile of system tablespace have lost, and i execute the command as following: run { allocate channel c1 type disk; restore database; these are errors: RMAN-03002: failure during compilation of command RMAN-03

  • Bluetooth trouble with Mac Pro

    Hi I have recently bought a D-Link DBT-120 Bluetooth Adapter for my Mac Pro and i am losing connection with my devices on waking the Mac Pro from sleep, both my Logitech Bluetooth Mouse and a Jabra headset. Typically I need to disconnect and reconnec

  • Saving photos in OS6

    In iPad iOS6, when I try to save a picture I am viewing, the "Save Photo" button appears, but the photo does not save to my Photos app, nor does it upload to Dropbox. I have confirmed the Dropbox is turned on in Privacy settings.