2015-01-14 18 views
1

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'반환 존재한다.

+1

당신은 * \\ 서버 \ share' 그래서 창'인터넷 사용 ... 드라이브를 매핑하거나 어떤 계정이입니다 –

+0

을 마운트를 사용 (명령 프롬프트에서 인터넷 사용을 실행)해야합니다 아래에서 실행중인 서비스? 계정이 네트워크 리소스에 액세스 할 수 있습니까? –

+0

@MarkWagoner .. 서비스가 LocalSystem 계정으로 실행 중입니다. – rsr

답변

0

Kenneth가 말했듯이 공유 폴더를 드라이브에 매핑 한 다음 해당 드라이브에 직접 쓸 필요가 있습니다.

http://windows.microsoft.com/en-us/windows/create-shortcut-map-network-drive

+0

드라이브 매핑은 tomcat이 localsystem을 계정으로 사용하는 서비스로 실행 중일 때 도움이되지 않습니다. – rsr

+0

나중에 다시 시도 하겠지만 Tomcat 서비스를 실행하기 위해 계정을 변경할 수 없습니까? http://superuser.com/questions/301864/run-tomcat-service-as-different-user-on-windows-7 –

+0

길레르모 Gefaell ... 그것은 일했습니다! 하지만 내 요구 사항은 localsystem 계정으로 실행해야합니다. 그렇다면 제발 저를 안내해주십시오. 다시 한번 감사합니다. – rsr