java - The system cannot find the file specified - WEB-INF config file running on Tomcat 6 -


i have web application deployed war in tomcat 6. trying read config file under web-inf/ java class packaged in jar under web-inf/lib. get:

the system cannot find file specified

code:

properties props = new properties(); file propsfile = new file(".\config.properties"); inputstream stream = this.getclass().getclassloader().getresourceasstream(propertiesfilepath);  if (stream != null){    props.load(stream);    log.debug("stream not null"); }  else     props.load(new fileinputstream(propsfile)); 

it works fine in server in production in our test server doesn't. server config related?

try this:

url resource = new url(this.getclass().getresource("."), "config.properties"); inputstream stream = resource.openconnection().getinputstream(); 

Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -