2017-09-13 19 views
1

私はTomcat 6で戦争として展開されたWebアプリケーションを持っています。私はWEB-INF/WEB-INF/libの下のjarファイルにパッケージ化されています。私が取得する:ファイルを見つけることができませんシステムが指定されたファイルを見つけることができません - Tomcat 6で実行されているWEB-INF設定ファイル

システムは

コードを指定:

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)); 

それは生産に、サーバーに正常に動作しますが、我々のテストサーバーではそれがありません。それはサーバーの設定に関連することができますか?

+0

あなたはバックスラッシュなしでそれを試みたことがありますか? – stdunbar

+0

はい、同じ結果 – AGG

答えて

0

これを試してみてください:

URL resource = new URL(this.getClass().getResource("."), "config.properties"); 
InputStream stream = resource.openConnection().getInputStream(); 
関連する問題