2017-09-13 1 views
1

Tomcat 6에서 웹 응용 프로그램을 전쟁으로 배포했습니다. Java 클래스에서 WEB-INF/아래의 구성 파일을 읽으려고합니다. WEB-INF/lib 아래 항아리에 포장되어 있습니다. 내가 얻을 : 파일을 찾을 수 없습니다시스템에서 지정한 파일을 찾을 수 없습니다. - 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(); 
관련 문제