Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-9094

Can't use custom FTPParser on OSGI

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 2.15.2
    • 2.16.0
    • camel-ftp
    • None
    • Unknown

    Description

      Using a custom ftp entry parser on OSGI results in an exception because of the use of Class.forName in commons-net DefaultFTPFileEntryParserFactory :

      org.apache.commons.net.ftp.parser.ParserInitializationException: Unknown parser type: com.example.CustomFTPEntryParser
       
              at org.apache.commons.net.ftp.parser.DefaultFTPFileEntryParserFactory.createFileEntryParser(DefaultFTPFileEntryParserFactory.java:166)[commons-net:commons-net:3.3]
              at org.apache.commons.net.ftp.parser.DefaultFTPFileEntryParserFactory.createFileEntryParser(DefaultFTPFileEntryParserFactory.java:202)[commons-net:commons-net:3.3]
              at org.apache.commons.net.ftp.FTPClient.initiateListParsing(FTPClient.java:3246)[commons-net:commons-net:3.3]
              at org.apache.commons.net.ftp.FTPClient.listFiles(FTPClient.java:2930)[commons-net:commons-net:3.3]
              at org.apache.commons.net.ftp.FTPClient.listFiles(FTPClient.java:2977)[commons-net:commons-net:3.3]
              at org.apache.camel.component.file.remote.FtpOperations.listFiles(FtpOperations.java:779)[org.apache.camel:camel-ftp:2.12.0.redhat-611433]
              at org.apache.camel.component.file.remote.FtpConsumer.doPollDirectory(FtpConsumer.java:91)[org.apache.camel:camel-ftp:2.12.0.redhat-611433]
              at org.apache.camel.component.file.remote.FtpConsumer.pollDirectory(FtpConsumer.java:53)[org.apache.camel:camel-ftp:2.12.0.redhat-611433]
              at org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:117)[org.apache.camel:camel-core:2.12.0.redhat-611433 com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru:1.4]
              at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:187)[org.apache.camel:camel-core:2.12.0.redhat-611433 com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru:1.4]
              at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:114)[org.apache.camel:camel-core:2.12.0.redhat-611433 com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru:1.4]
              at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)[:1.7.0_10]
              at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:351)[:1.7.0_10]
              at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:178)[:1.7.0_10]
              at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178)[:1.7.0_10]
              at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)[:1.7.0_10]
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)[:1.7.0_10]
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)[:1.7.0_10]
              at java.lang.Thread.run(Thread.java:722)[:1.7.0_10]
      

      Camel can work around this by creating a ParserFactory that is used if Camel is being used in an OSGI environment that simply extends the DefaultFTPFileEntryParserFactory and uses the Camel class resolver rather than Class.forName.

      Attachments

        Activity

          People

            davsclaus Claus Ibsen
            tcunning Thomas Cunningham
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: