dcsimg
Alternative to ServletContext.getRealPath() for unexploded WAR files in BEA Weblogic.
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Charles_Cuozzo
Posted On:   Tuesday, December 17, 2002 01:32 PM

How can I access a configuration and/or log.properties file (stored under WEB-INF) in a web application deployed in WAR archive format? I'm using Weblogic Server 6.1 and I have a dispatcher servlet that needs to read several configuration files at startup. If I deploy the application in WAR format (unexploded), the code: ServletContext.getRealPath("WEB-INF") + System.getProperty("file.separator") + "log.properties" returns null. In development mode, we are not using the WAR format, so there is no problem. Is there any alternative that can be used to get the custom configuration files I need access to at startup? It is impossible in    More>>

How can I access a configuration and/or log.properties file (stored under WEB-INF) in a web application deployed in WAR archive format?


I'm using Weblogic Server 6.1 and I have a dispatcher servlet that needs to read several configuration files at startup. If I deploy the application in WAR format (unexploded), the code:


ServletContext.getRealPath("WEB-INF") + System.getProperty("file.separator") + "log.properties"


returns null.


In development mode, we are not using the WAR format, so there is no problem.


Is there any alternative that can be used to get the custom configuration files I need access to at startup? It is impossible in our production environment to explode the WAR files upon deployment, so we need a workaround.

   <<Less

Re: Alternative to ServletContext.getRealPath() for unexploded WAR files in BEA Weblogic.

Posted By:   Gautam_Marwaha  
Posted On:   Wednesday, December 18, 2002 03:27 AM

you could maintain config properties for a web app in web.xml in the form of environment entries like:



some desc
my_config_entry
XYZ
java.lang.String




For logging, use log methods available with GenericServlet, ServletContext. They will write to log file of the web container. check your web container docs for details
About | Sitemap | Contact