-
1. Re: Using camel file component within a jar to read a file
njiang Sep 28, 2009 9:36 PM (in response to alexbp80)Did you deploy the camel route into some other container ?
If so , can you try to use the absolute path instead of relative path to specify the file which camel file component need to deal with ?
-
2. Re: Using camel file component within a jar to read a file
davsclaus Sep 29, 2009 2:38 AM (in response to alexbp80)The Camel file component cannot look inside archives such as .jar or .zip files. It can only look from the file system perspective.
If you can locate the file using a command prompt then Camel can find the file as well.
There is Apache Commons VFS project which apparently can look inside archives. Maybe in the future if we got the time, we add this to Camel itself. There is a ticket in JIRA about it.
-
3. Re: Using camel file component within a jar to read a file
alexbp80 Sep 29, 2009 9:33 AM (in response to davsclaus)Hi,
Thanks for your reply.
I tried placing the data files directly on the filesystem path beside the jar, where camel can find it, however when camel locates it, it sends only the literal filename through the route instead of the file contents.
For instance, if there is a file called data_file.xml which contains data, what is sent is "data_file.xml" string, not the contents of the file. This same route sends data correctly if camel route is not within a jar.
Have you seen this before
Thanks again.
Alex.
-
4. Re: Using camel file component within a jar to read a file
davsclaus Sep 29, 2009 10:33 AM (in response to alexbp80)What version of camel do you use?
-
5. Re: Using camel file component within a jar to read a file
alexbp80 Sep 29, 2009 10:49 AM (in response to davsclaus)1.6.1-fuse
-
6. Re: Using camel file component within a jar to read a file
davsclaus Sep 29, 2009 11:40 AM (in response to alexbp80)Hmm and you are sure the file is not open by some other programs. It could be that it cannot load the file content and then fallback to its filename instead.
What OS do you use?
-
7. Re: Using camel file component within a jar to read a file
alexbp80 Sep 29, 2009 11:59 AM (in response to davsclaus)The file was not open during camel run.
I am using CentOs Linux.
-
8. Re: Using camel file component within a jar to read a file
davsclaus Sep 29, 2009 3:16 PM (in response to alexbp80)I was suspected windows as we had an issue beforehand with it, but that was in fact related to moving the file after it was processed.
Does the JVM have permissions on that file system to read / edit / write to that file?
-
9. Re: Using camel file component within a jar to read a file
alexbp80 Sep 29, 2009 4:01 PM (in response to davsclaus)JVM does have those permissions.
Also, for example when the file is not found, camel creates a directory and names it with that filename beside the jar. If the file is found, it sends it's name instead of the contents.
-
10. Re: Using camel file component within a jar to read a file
davsclaus Sep 30, 2009 1:50 AM (in response to alexbp80)The file component works best if you configure it to scan a folder.
Could you try creating a new empty folder for Camel to use to scan. And then drop your xml file in that folder.
And configure the consumer endpoint as
<from uri="file:path_to_folder?noop=true"/>