axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Junaid.Bha...@mro.com
Subject Re: where to put file so web service can read it?
Date Thu, 09 Feb 2006 15:02:30 GMT
Put your config file under /WEB-INF. You can then read this as follows:

InputStream is = servletContext.getResourceAsStream("/WEB-INF/" +
configFile);

Read this wiki on how to obtain the ServletContext from within your Web
Service:
http://wiki.apache.org/ws/FrontPage/Axis/ServletContext

-Junaid




                                                                           
             Richard Gregory                                               
             <richard.gregory@                                             
             gsf.de>                                                    To 
                                       axis-user@ws.apache.org             
             02/09/2006 09:21                                           cc 
             AM                                                            
                                                                   Subject 
                                       where to put file so web service    
             Please respond to         can read it?                        
             axis-user@ws.apac                                             
                  he.org                                                   
                                                                           
                                                                           
                                                                           
                                                                           




Hi,

I have a web service which needs to read a property from a configuration
file, but I can't work out where in the webapp to put the configuration
file so the web service implmentation class can read it. I've tried
putting it in WEB-INF/classes, in the root directory of the web app, in
WEB-INF, in the same directory as the class which reads it, and in
pretty much every other directory you can think of, but I keep getting a
FileNotFoundException.

If I hard code the full path to the file (C:/..... on Windows or
/home/richard...... on Linux) in my service it can find and read it, but
this isn't really an option as the service will be deployed on different
machines by different customers so the path will vary.

If anyone can give me some suggestions I'd be grateful.

Thanks,

Richard.



Mime
View raw message