2 Replies Latest reply on Feb 4, 2009 10:37 AM by jamie3_james.archibald

    Annotation Type Converter Loader can't find my classes

    jamie3_james.archibald

      I have created my own type converter as follows

       

      package my.converter;

       

      @Converter

      public class MyConverter {

       

          

      @Converter

          

      public static ProprietaryMessage toProprietaryMessage(ActiveMQStreamMessage msg) {

          

             /// do something

          

      }

      }

       

      I then added META-INF/services/org/apache/camel/TypeConverter to my classpath in eclipse and added the my.converter package.

       

      I then built my message router which pulls messages from ActiveMQ from one topic and routers them to another.

       

      context.addRoutes(new RouteBuilder() {

       

       

       

          

      @Override

         public void configure() throws Exception {

            from("activemq:topic:SomeTopic")

            .convertBodyTo(ProprietaryMessage.class)

            .to("activemq:topic:SomeOtherTopic")

         });

       

       

       

      The problem is that the Annotation Type Converter Loader isn't finding my MyConverter class.

       

      I've confirmed this by running the following code:

       

      DefaultTypeConverter tc = (DefaultTypeConverter)context.getTypeConverter();

      List<TypeConverterLoader> loaders = tc.getTypeConverterLoaders();

       

       

       

      TypeConverter type = tc.getTypeConverter(ProprietaryMessage.class, ActiveMQStreamMessage.class);

       

      // type is null!!!!

       

       

       

       

      The only difference I can see here is that I am not packaging my code into a jar. Instead I am running it in eclipse, however I still have the META-INF/... folder in my classpath.

       

      Edited by: jamie3 on Feb 3, 2009 12:16 PM

       

      Edited by: jamie3 on Feb 3, 2009 12:22 PM