Windows 용 톰캣 7.0.57 웹 응용 프로그램을 가지고 있습니다. 서비스로 실행하여 파일 복사 중입니다. 로컬 네트워크 공유 디렉토리 (예 : \\ Network_machine \ Shared_folder)에 있지만, 그렇게 할 수는 없습니다.네트워크 공유 폴더의 파일을 읽을 수 없습니다. [webbapp는 서비스로 톰캣을 사용했습니다]
누구나 읽을 수있는 권한이 있으므로 Windows 탐색기에서 공유 폴더에 액세스 할 수 있습니다. 인증 없이는 공유 폴더에 액세스 할 수 없습니다. 디렉토리 확인 된 다음 코드는 존재합니다
String sourceURL = this.servletContext.getInitParameter("sourceURL");
log.debug("---------->Source reports directory : " + sourceURL);
File sourceDir = new File(sourceURL);
log.debug("---------->Source directory exists : "+sourceDir.exists());
if (sourceDir.exists()) {
String files[] = sourceDir.list();
log.debug("----------> Total files in source dir :" + files.length);
List<String> newFiles = new ArrayList<String>(Arrays.asList(files));
newFiles.removeAll(processedFiles);
log.debug("----------> Latest files in source dir :" + newFiles.size());
File file = null;
if (newFiles.size() > 0) {
for (String fileName : newFiles) {
file = new File(sourceURL + Constants.FILE_SEP + fileName);
latestSourceFiles.add(file);
}
}
} else {
log.debug("Source reports directory " + sourceURL + " is not found");
}
추가 정보 :
로그 - 소스 디렉토리는 'FALSE'반환 존재한다.
당신은 * \\ 서버 \ share' 그래서 창'인터넷 사용 ... 드라이브를 매핑하거나 어떤 계정이입니다 –
을 마운트를 사용 (명령 프롬프트에서 인터넷 사용을 실행)해야합니다 아래에서 실행중인 서비스? 계정이 네트워크 리소스에 액세스 할 수 있습니까? –
@MarkWagoner .. 서비스가 LocalSystem 계정으로 실행 중입니다. – rsr