简体   繁体   English

org.apache.camel.component.file.GenericFileOperationFailedException:无法获取文件找不到网络名称

[英]org.apache.camel.component.file.GenericFileOperationFailedException: Could not get files The network name cannot be found

I'm trying to copy some files from a local folder, to another local folder with Apache Camel JCIFS component. 我正在尝试使用Apache Camel JCIFS组件将某些文件从本地文件夹复制到另一个本地文件夹。

Here is my Java code for MyRouteBuilder class: 这是MyRouteBuilder类的Java代码:

package abc;

import org.apache.camel.builder.RouteBuilder;

public class MyRouteBuilder extends RouteBuilder {

    public void configure() {
        long delay = 60 * 60 * 1000L;
        from("smb://otherUser@localhost/WORKGROUP/home/user/folder?password=secret&delay=" + delay)
        .to("file://home/otherUser/folder");

    // This doesn't work either:
    //from("smb://localhost;otherUser@localhost/WORKGROUP/home/user/folder?password=secret&delay=" + delay)
    //        .to("file://home/otherUser/folder");
    }
}

After executing this route, following exception appears: 执行此路由后,出现以下异常:

org.apache.camel.component.file.GenericFileOperationFailedException: Could not get files The network name cannot be found.
at org.apacheextras.camel.component.jcifs.SmbOperations.listFiles(SmbOperations.java:345)
at org.apacheextras.camel.component.jcifs.SmbConsumer.pollDirectory(SmbConsumer.java:58)
at org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:131)
at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:175)
at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:102)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: jcifs.smb.SmbException: The network name cannot be found.
at jcifs.smb.SmbTransport.checkStatus(SmbTransport.java:563)
at jcifs.smb.SmbTransport.send(SmbTransport.java:663)
at jcifs.smb.SmbSession.send(SmbSession.java:238)
at jcifs.smb.SmbTree.treeConnect(SmbTree.java:176)
at jcifs.smb.SmbFile.doConnect(SmbFile.java:911)
at jcifs.smb.SmbFile.connect(SmbFile.java:954)
at jcifs.smb.SmbFile.connect0(SmbFile.java:880)
at jcifs.smb.SmbFile.resolveDfs(SmbFile.java:669)
at jcifs.smb.SmbFile.send(SmbFile.java:773)
at jcifs.smb.SmbFile.doFindFirstNext(SmbFile.java:1986)
at jcifs.smb.SmbFile.doEnum(SmbFile.java:1738)
at jcifs.smb.SmbFile.listFiles(SmbFile.java:1715)
at jcifs.smb.SmbFile.listFiles(SmbFile.java:1648)
at org.apacheextras.camel.component.jcifs.DefaultSmbClient.listFiles(DefaultSmbClient.java:161)
at org.apacheextras.camel.component.jcifs.SmbOperations.listFiles(SmbOperations.java:341)
... 11 more

Note 1: I have a samba server configured at my computer, and I'm sharing a simple folder with four files inside. 注意1:我在计算机上配置了一个samba服务器,并且正在共享一个包含四个文件的简单文件夹。

Note 2: I'm using localhost, just to test. 注意2:我使用localhost只是为了测试。 After I get this working, I will use another machine IP/domain. 完成这项工作后,我将使用另一个计算机IP /域。

Thank you for your help! 谢谢您的帮助!

I just made it work. 我只是使它工作。 My route was wrong. 我的路线错了。 It should be like this: 应该是这样的:

package abc;

import org.apache.camel.builder.RouteBuilder;

public class MyRouteBuilder extends RouteBuilder {

    public void configure() {
        long delay = 60 * 60 * 1000L;
        from("smb://otherUser@localhost/folder?password=secret&delay=" + delay)
        .to("file://home/otherUser/folder");
    }
}

I noticed my error executing following command on a terminal: 我注意到在终端上执行以下命令时出错:

smbclient -L localhost

That command gave me that Sharename was my shared folder "folder". 该命令告诉我,共享名是我的共享文件夹“文件夹”。

暂无
暂无

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

相关问题 org.apache.camel.NoSuchBeanException: 在注册表中找不到 bean: - org.apache.camel.NoSuchBeanException: No bean could be found in the registry for: org.apache.camel.NoSuchLanguageException:找不到语言:简单 - org.apache.camel.NoSuchLanguageException: No language could be found for: simple Apache Camel文件组件 - 如何仅扫描新文件? - Apache Camel File Component - how to scan for new files only? log4j:WARN找不到记录器的附加程序(org.apache.camel.impl.DefaultCamelContext) - log4j:WARN No appenders could be found for logger (org.apache.camel.impl.DefaultCamelContext) 骆驼 cxf 有效载荷模式拦截器抛出 org.apache.camel.component.cxf.CxfPayload 无法转换为 javax.xml.transform - camel cxf payload mode interceptor throws org.apache.camel.component.cxf.CxfPayload cannot be cast to javax.xml.transform 在 apache 骆驼中找不到带有方案 http 错误的组件 - No component found with scheme http error in apache camel Apache Camel文件组件:在正则表达式中指定1个文件 - Apache Camel File Component: Specifying 1 file in regex 具有动态路径的Apache Camel文件组件 - Apache Camel file component with dynamic path org.apache.camel.impl.HeaderFilterStrategyComponent 类型无法解析 - The type org.apache.camel.impl.HeaderFilterStrategyComponent cannot be resolved 如何在由Apache Camel文件组件编写的文件名中附加索引号? - How can you append an index number in a file name written by the Apache Camel file component?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM