• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

adding to classpath

 
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to get my war to load up in tomcat but keep getting a listenerStart error. This is because my app uses Spring + Hibernate, and tomcat isn't finding my Hibernate mapping files - I am seeing FileNotFoundException in the tomcat.log. Do I have to add these config files to my classpath? I thought that everything under WEB-INF was added, or is that just classes?
 
Sheriff
Posts: 67750
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Everything under WEB-INF/classes is added to the classpath. Where in this hierarchy are you placing the property files?
[ November 11, 2006: Message edited by: Bear Bibeault ]
 
joe black
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for that correction Bear. It is now working. I previously had the configuration files in /WEB-INF, not /WEB-INF/classes.

Is it common practice to put everything, such as configuration files, other resources, etc.. under /WEB-INF/classes, or do a lot of people modify the classpath? For example, lets say I wanted my configuration files to be in a folder under / instead of /WEB-INF/classes, or even in a folder outside of the war.
 
Bear Bibeault
Sheriff
Posts: 67750
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There was a question just like this earlier today.

If the property files (or any other resources) need to be in the classpath (this is not always the case), it is customary to put them into the WEB-INF/classes hierarchy, or to jar them up and put the jar in WEB-INF/lib.

Doing weird class-loader things is not recommended.
[ November 11, 2006: Message edited by: Bear Bibeault ]
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Is it common practice to put everything, such as configuration files, other resources, etc.. under /WEB-INF/classes,


One very good reason is that servlet containers are not allowed to directly serve anything under /WEB-INF/ - imagine the security holes that would open up if your configuration files could be downloaded by anybody.

Bill
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic