简体   繁体   English

Weblogic Server:使用Java将文件复制到网络内的共享位置

[英]Weblogic Server: Copy files to shared location within network using Java

Our application is deployed on weblogic server 12c. 我们的应用程序部署在weblogic服务器12c上。 This application needs to copy files from server to some folder on the network location. 此应用程序需要将文件从服务器复制到网络位置上的某个文件夹。 How can this be achieved in Java? 如何用Java实现呢?

Application code is like 应用程序代码就像

        String source = 
        "C:\Oracle\Middleware\Oracle_Home\user_projects\domains 
        \base_domain\pdf_files\ABC.pdf";//Location on server
        String destination = "\\machineA\SharedFolder";//shared folder in some machine on same network

        FileInputStream in = new FileInputStream(source);            
        FileOutputStream out = new FileOutputStream(destination);
        byte[] buf = new byte[1024];
        int len = 0;
        while ((len = in.read(buf)) > 0) {
            out.write(buf, 0, len);
        }
        in.close();
        out.close();

Getting a error message java.io.FileNotFoundException: \\\\machineA\\SharedFolder\\ABC.pdf (Access is denied) 收到错误消息java.io.FileNotFoundException:\\\\ machineA \\ SharedFolder \\ ABC.pdf(访问被拒绝)

machineA(server) can be added in the shared folder's Sharing options as machineA$. 可以将machineA(server)作为machineA $添加到共享文件夹的“共享”选项中。 Then this code which is running from application server will be able to access the location. 然后,从应用程序服务器运行的此代码将能够访问该位置。

Reference: https://serverfault.com/questions/135867/how-to-grant-network-access-to-localsystem-account 参考: https : //serverfault.com/questions/135867/how-to-grant-network-access-to-localsystem-account

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM