Win a copy of Java Database Connections & Transactions (e-book only) this week in the JDBC 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
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

how to set different dir to resource bundle file  RSS feed

 
Ranch Hand
Posts: 602
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is there any way to configure tomcat see ResourceBundle files other then in the WEB-INF\classes directory?
 
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Resource bundles are found in the JVM classloaders classpath.
You could bundle them into jars and put them under WEB-INF/lib.

Where do you want to put them?
 
Meir Yan
Ranch Hand
Posts: 602
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i will like to but them in directory in my webapp
something like : webapps\myApp\include
so I need to add this dir to my classpath?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tomcat ignores your classpath.
It finds resources by looking in a series of directories.

This is why we need to put them in the classes directory or in a jar file under the lib directory.
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
i've create a custom class loader.



From my code, i get the classloader and call the addCustomRepositoryOrLocation method but ResourceBundle not works...



Search in progress...

Bye

 
Bartender
Posts: 20770
124
Android Eclipse IDE Java Linux Redhat Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A) It's not WEB-INF\classes, it's WEB-INF/classes. A true WAR is a ZIP file, not a directory and you use DOS pathname separators at your peril, since Java would much rather interpret them as escape character.

B) You DO realize that if you don't put resources under WEB-INF, anyone who wants to can potentially retrieve them by URL (and in fact, WILL be able to, by default). Which is a potential security exploit.

C) What benefit is kludging up a custom classpath going to gain you here anyway?
 
Gabriele Muscas
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tim,
i would like to create differents directories in which put the properties files.



Now, I'm trying ResourceBundleThemeSource with the Spring framework, but the problem is with the JVM.

I continue to seek a solution.

Thanks,
Gabriele
 
Gabriele Muscas
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
this works for me:



In the class loader i've this code:


So, my problem is a spring problem.

Bye,
Gabriele
 
If I had asked people what they wanted, they would have said faster horses - Ford. Tiny ad:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!