Could some one help me on this problem. i have webservice , which reads data from configuration files. When i run this webservice from eclipse , i give absolute the path for these webservices of these configuration files , but when i shift the webservice in to server and run, it can not read the config file. so how can i solve this problem. is there a relative path that webservice can understand during run time.
A:
How are you deploying these configurations. If they're packed inside the .aar file I would expect them to reside in the classpath, and you could access them via Class.getResourceAsStream()
If they're deployed in the .aar file, however, they're going to be difficult to edit post deployment. In that case you may want to deploy them separately as files and put them in a location well-known to the application, and just read them as files.
Brian Agnew
2010-05-30 17:35:34
Hi Brian, they way i am deploying it is, first i create .aar for the webservice and it is deployed in tomcat web container
KItis
2010-05-30 17:36:26
A:
You can put your configuration files in the root of the AAR archive or in the classes folder. Then use getResourceAsStream
to read them.
ClassLoader loader = getClass().getClassLoader();
InputStream inputstream = loader.getResourceAsStream(sFilePath);
Pascal Thivent
2010-05-30 18:13:11