5 Replies Latest reply on Sep 17, 2010 1:31 AM by Claus Ibsen

    Debugging Camel Routes in Eclipse

    Joseph Krozak Newbie

      Folks,

       

      i am a Camel newbie and I am having trouble setting breakpoints and debugging camel routes in Eclipse.  i have a simple route that pulls an XML file from a directory, passes it to a class that implements Processor, and then sends that output to another directory.  i simply want to debug the Processor step in Eclipse, but i never seem to hit the breakpoint.  Any hints?

        • 1. Re: Debugging Camel Routes in Eclipse
          Claus Ibsen Master

          Its just java code, so if you do set a breakpoint inside your java code in a custom Processor then it should hit it.

           

          Can you do a system out println in the processor and make sure it prints that. Then set a breakpoint on it, and run it in debug mode.

          • 2. Re: Debugging Camel Routes in Eclipse
            Joseph Krozak Newbie

            Yes, i did just that - did a System.out.println from within the Process, which works fine.  Then I set a breakpoint on that same println and never hit it.  Is this a case of the route being multithreaded and I need to do something to jump over to it somehow?

            • 3. Re: Debugging Camel Routes in Eclipse
              Claus Ibsen Master

              No it must be eclipse not being able to align source code when debugging.

               

              So when you set a break point on line XXX in src file, it cannot align that. How do you start the Camel from Eclipse?

              • 4. Re: Debugging Camel Routes in Eclipse
                Joseph Krozak Newbie

                I start the route from a regular Java console application as follows.  Each Processor has code that i want to step through in the debugger.  When i set a breakpoint in Processor1, i never reach it and when i continue the run within the debugger, the route never seems to complete:

                 

                 

                public static void main(String[] args)

                {

                     try

                     {

                          CamelContext context = new DefaultCamelContext();

                          context.setTracing(true);

                 

                          context.addRoutes(

                          new RouteBuilder()

                          {

                               public void configure()

                               {

                                

                from ("file:src/main/resources/messages/src?noop=true").

                process(new Processor1()).

                process(new Processor2()).

                process(new Processor3()).

                to ("file:src/main/resources/messages/dest");

                               }

                          }

                 

                     );

                     // Start the route...

                           

                     context.start();

                     Thread.sleep(60000);

                                

                     // Stop the CamelContext

                                

                     context.stop();

                 

                ...

                • 5. Re: Debugging Camel Routes in Eclipse
                  Claus Ibsen Master

                  Well that is odd. Try setting a break point in the main method to see if it can debug there.

                   

                  And make sure you compile with debug info turned on.