1

Windows 8.1 上の Tomcat 7.0.57 で Web アプリケーションをサービスとして実行しています。これは、ローカル ネットワークの共有ディレクトリ (\\Network_machine\Shared_folder など) にファイルをコピーするように指示されていますが、そうすることができません。

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' が返されます。

4

1 に答える 1

0

Kenneth が言うように、共有フォルダーをドライブにマップしてから、そのドライブに直接書き込む必要があります。

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

于 2015-01-14T12:57:57.113 に答える