11 Replies Latest reply on Jul 14, 2011 4:44 PM by rogelio_sevilla1

    camel-atom not working

    rogelio_sevilla1

      Good day everyone:

       

      I'm trying to use the camel-atom component on fuse esb 4.4, I have already installed the camel-atom feature and camel-rss (just in case). I also installed the sream component to print the feeds (just for testing purposes)

       

      And I have a simple route that works fine when is not being deployed as an osgi bundle, the route is this:

       

      from("atom://http://alerts.weather.gov/cap/us.php?x=0&splitEntries=true&consumer.delay=5000")

      .to("stream:out");

       

       

      And i'm getting this error:

       

       

      12:25:59,630 | WARN  | r.gov/cap/us.php | faultPollingConsumerPollStrategy | ?                                   ? | 76 - org.apache.camel.camel-core - 2.7.1.fuse-00-27 | Consumer Consumer[atom://http://alerts.weather.gov/cap/us.php?consumer.delay=5000&splitEntries=true&x=0] could not poll endpoint: atom://http://alerts.weather.gov/cap/us.php?consumer.delay=5000&splitEntries=true&x=0 caused by: null

      java.lang.NullPointerException

           at org.apache.camel.component.atom.AtomUtils.parseDocument(AtomUtils.java:55)[227:org.apache.camel.camel-atom:2.7.1.fuse-00-27]

           at org.apache.camel.component.atom.AtomEntryPollingConsumer.getDocument(AtomEntryPollingConsumer.java:43)[227:org.apache.camel.camel-atom:2.7.1.fuse-00-27]

           at org.apache.camel.component.atom.AtomEntryPollingConsumer.createFeed(AtomEntryPollingConsumer.java:65)[227:org.apache.camel.camel-atom:2.7.1.fuse-00-27]

           at org.apache.camel.component.feed.FeedEntryPollingConsumer.poll(FeedEntryPollingConsumer.java:46)[227:org.apache.camel.camel-atom:2.7.1.fuse-00-27]

           at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:97)[76:org.apache.camel.camel-core:2.7.1.fuse-00-27]

           at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)[:1.6.0_25]

           at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)[:1.6.0_25]

           at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)[:1.6.0_25]

           at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)[:1.6.0_25]

           at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:180)[:1.6.0_25]

           at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:204)[:1.6.0_25]

           at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)[:1.6.0_25]

           at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)[:1.6.0_25]

           at java.lang.Thread.run(Thread.java:662)[:1.6.0_25

       

       

      Could you help me find what could be wrong??

       

      Thanks a lot in advance

        • 1. Re: camel-atom not working
          rogelio_sevilla1

          This is kind of a strange error, I thought it was because of the Abdera version so I deployed the 1.1.2 Abdera version, but still the same error.

           

          This is clearly telling that "there's  no atom on that uri" , but I know there is. just to make sure, I also tried the most simple example from the camel.apache site using the uri they use, like this:

           

          from("atom://http://macstrac.blogspot.com/feeds/posts/default").to("stream:out");

           

          That atom feed also exists, and it works correctly on Apache Camel, but still, fuse esb keeps showing the same error :-S. Am i missing something simple in here??

           

          Thanks in advance

          • 2. Re: camel-atom not working
            rogelio_sevilla1

            Found the exact error although i haven't found the way to solve it. camel-atom is using Abdera behind the scenes. The problem as the stacktrace reports, comes on this code line:

             

            return getAtomParser().parse(in);

             

            which is on line 55 of the AtomUtils class. the getAtomParser() method consists of 1 line only which is this one:

             

            return Abdera.getInstance().getParser();

             

            According to my tests, Abdera.getInstance() is returning null, and this is why the rest of the chained methods are complaining :-S. I will keep the problem updated.

            • 3. Re: camel-atom not working
              njiang

              I can reproduce the error within Fuse ESB 4.4.0-fuse-00-27.

              When I try to work around it by using the new version Abdera bundle, I found these bundle can not work out of box dure to the default class loading issue. We have to wrap abdera bundle ourself to fix this issue.

               

              So I created a issue ESB-1504 in Fuse ESB, and will try to resolve it shortly.

              • 4. Re: camel-atom not working
                rogelio_sevilla1

                Thanks mr Willem,  i thought i was going crazy :-P

                • 5. Re: camel-atom not working
                  njiang

                  I managed to get the camel-atom endpoint work with Fuse ESB 4.4.0-fuse-00-27. You need to do the below works.

                  1. Copied the patched camel-atom.jar from ESB-1504  into $FUSE_ESB_HOME/system/org/apache/camel/camel-atom

                   

                  2. Install the servicemix wrapped Axiom bundle 1.2.12

                     mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.axiom-api/1.2.11-1-SNAPSHOT
                     mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.axiom-impl/1.2.12-1-SNAPSHOT
                  

                   

                   

                  3. Installed abdera 1.1.2 bundles and camel-atom bundle

                     mvn:org.apache.abdera/abdera-core/1.1.2
                     mvn:org.apache.abdera/abdera-extensions-main/1.1.2
                     mvn:org.apache.abdera/abdera-i18n/1.1.2
                     mvn:org.apache.abdera/abdera-parser/1.1.2
                     mvn:org.apache.camel/camel-atom/2.7.1-fuse-00-27
                  

                   

                  4. the route context bundle should imports these packages

                  " org.apache.abdera.parser.stax, org.apache.axiom.om.util,org.apache.axiom.om.impl.llom.factory"

                   

                  Willem

                  • 6. Re: camel-atom not working
                    rogelio_sevilla1

                    Thanks a lot mr. Willem,  I've followed your instructions. I've installed the bundles you mentioned using

                     

                    osgi:install mvn:*****    <---  every entry on your answer

                     

                    copied the camel-atom jar from ESB-1504  and add the imports on the pom file, however, after doing this and restarted  fuse esb, I get the same error :-S , should I uninstall or install another feature???

                    • 7. Re: camel-atom not working
                      rogelio_sevilla1

                      double post, sorry

                       

                      Edited by: rogelio_sevilla1 on Jul 14, 2011 8:44 PM

                      • 8. Re: camel-atom not working
                        njiang

                        You need to delete the ${servicemix-home}/data directory first.

                        • 9. Re: camel-atom not working
                          rogelio_sevilla1

                          Thanks for your answer mr. Willem..I've deleted the Data folder and followed the steps on your previous post.However, i just can't make it work. Now I get this exception:

                           

                           

                          Consumer Consumer[atom://http://alerts.weather.gov/cap/us.php?consumer.delay=10000&splitEntries=true&x=0] could not poll endpoint: atom://http://alerts.weather.gov/cap/us.php?consumer.delay=10000&splitEntries=true&x=0 caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: org.apache.abdera.parser.stax.FOMParser

                           

                          java.lang.RuntimeException: java.lang.RuntimeException: java.lang.ClassNotFoundException: org.apache.abdera.parser.stax.FOMParser

                               at org.apache.abdera.util.Discover.locate(Discover.java:37)[237:org.apache.abdera.core:1.1.2]

                               at org.apache.abdera.util.Discover.locate(Discover.java:21)[237:org.apache.abdera.core:1.1.2]

                               at org.apache.abdera.util.AbderaConfiguration.newParserInstance(AbderaConfiguration.java:298)[237:org.apache.abdera.core:1.1.2]

                               at org.apache.abdera.Abdera.newParser(Abdera.java:215)[237:org.apache.abdera.core:1.1.2]

                               at org.apache.abdera.Abdera.getParser(Abdera.java:150)[237:org.apache.abdera.core:1.1.2]

                               at org.apache.camel.component.atom.AtomUtils.getAtomParser(AtomUtils.java:42)[241:org.apache.camel.camel-atom:2.7.1.fuse-00-27]

                               at org.apache.camel.component.atom.AtomUtils.parseDocument(AtomUtils.java:55)[241:org.apache.camel.camel-atom:2.7.1.fuse-00-27]

                               at org.apache.camel.component.atom.AtomEntryPollingConsumer.getDocument(AtomEntryPollingConsumer.java:52)[241:org.apache.camel.camel-atom:2.7.1.fuse-00-27]

                           

                           

                           

                          But i don't get it, FOMParser is already exported by the Abdera Core bundle according to the command

                           

                          packages:exports | grep parser.stax 

                           

                          Somehow, the import on my camel route isn't finding this class :-S

                          • 10. Re: camel-atom not working
                            njiang

                            Your camel route bundle needs import below packages

                            org.apache.abdera.parser.stax, 
                            org.apache.axiom.om.util,
                            org.apache.axiom.om.impl.llom.factory
                            

                             

                            • 11. Re: camel-atom not working
                              rogelio_sevilla1

                              Thanks mr. Willem, I've already made the imports you instructed, I also tried using the * operator on the pom imports, still the same error. I'm probably doing something wrong. I will retry the steps.