This week's book giveaway is in the Server-Side JavaScript and NodeJS forum.
We're giving away four copies of Micro Frontends in Action and have Michael Geers on-line!
See this thread for details.
Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

properties file on tomcat

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Folks:

I would like to use a properties file for JDBC properties cross web module (don't want to use web.xml per web module) that can be read from a standard JDBC library we wrote. It works fine on JRun when we put the properties file under .../server/default. But I couldn't figure out where I should put it on Tomcat or can it be done? If you had experience with this, please give me some feedback. Thanks a lot.

Eric
 
Marshal
Posts: 67451
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moved to the Tomcat forum.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The most portable place to put properties and other resources that you want to be invisible from outside but used by servlets and JSP is under the WEB-INF directory. See the ServletContext getRealPath method.
Bill
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want to use it across web modules, I would think you'd want to keep it someplace on your server other than in a web module. You may even want to keep it out of Tomcat so it doesn't get overwritten or lost when you do upgrades.

Make the path configurable with either context-init-params or servlet-init-params.
 
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And if you want a real simple answer...

put it in [webapp]/WEB-INF/classes

from there you can open it by quoting the filename.





J.
 
Look ma! I'm selling my stuff!
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic