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

Add better exception message when data format not on classpath

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.5.0
    • 2.6.0
    • camel-core
    • None

    Description

      For example when you dont have camel-jaxb on classpath, you end up with something like this starting a Camel route

      Error occurred while running main from: org.apache.camel.spring.Main
      java.lang.reflect.InvocationTargetException
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:597)
              at org.apache.camel.maven.RunMojo$1.run(RunMojo.java:415)
              at java.lang.Thread.run(Thread.java:619)
      Caused by: org.apache.camel.RuntimeCamelException: org.apache.camel.FailedToCreateRouteException: Failed to create route route1 at: >>> Marshal[ref:myJaxb] <<< in route: Route[[From[timer://myTimer?fixedRate=true&period=60000]] ->... because of dataFormat must be specified
              at org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1126)
              at org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:103)
              at org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:231)
              at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:97)
              at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:303)
              at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:911)
              at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:428)
              at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
              at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93)
              at org.apache.camel.spring.Main.createDefaultApplicationContext(Main.java:219)
              at org.apache.camel.spring.Main.doStart(Main.java:173)
              at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:56)
              at org.apache.camel.impl.MainSupport.run(MainSupport.java:114)
              at org.apache.camel.impl.MainSupport.run(MainSupport.java:291)
              at org.apache.camel.spring.Main.main(Main.java:97)
              ... 6 more
      Caused by: org.apache.camel.FailedToCreateRouteException: Failed to create route route1 at: >>> Marshal[ref:myJaxb] <<< in route: Route[[From[timer://myTimer?fixedRate=true&period=60000]] ->... because of dataFormat must be specified
              at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:720)
              at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:138)
              at org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:559)
              at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:1207)
              at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1076)
              at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:986)
              at org.apache.camel.spring.SpringCamelContext.doStart(SpringCamelContext.java:164)
              at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:56)
              at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:946)
              at org.apache.camel.spring.SpringCamelContext.maybeStart(SpringCamelContext.java:203)
              at org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:101)
              ... 19 more
      Caused by: java.lang.IllegalArgumentException: dataFormat must be specified
              at org.apache.camel.util.ObjectHelper.notNull(ObjectHelper.java:262)
              at org.apache.camel.model.DataFormatDefinition.getDataFormat(DataFormatDefinition.java:86)
              at org.apache.camel.model.DataFormatDefinition.getDataFormat(DataFormatDefinition.java:69)
              at org.apache.camel.model.UnmarshalDefinition.createProcessor(UnmarshalDefinition.java:123)
              at org.apache.camel.model.ProcessorDefinition.makeProcessor(ProcessorDefinition.java:389)
              at org.apache.camel.model.ProcessorDefinition.addRoutes(ProcessorDefinition.java:169)
              at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:717)
              ... 29 more
      *************************************
      [INFO] ------------------------------------------------------------------------
      [ERROR] BUILD ERROR
      [INFO] ------------------------------------------------------------------------
      [INFO]
      
      dataFormat must be specified
      [INFO] ------------------------------------------------------------------------
      [INFO] For more information, run Maven with the -e switch
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 7 seconds
      [INFO] Finished at: Thu Jan 06 14:52:24 CET 2011
      [INFO] Final Memory: 30M/55M
      [INFO] ------------------------------------------------------------------------
      

      Attachments

        1. CAMEL-3508.patch
          1 kB
          Ashwin J. Karpe
        2. CAMEL-3508-message.patch
          2 kB
          Ashwin J. Karpe
        3. CAMEL-3508-UT.patch
          5 kB
          Ashwin J. Karpe

        Activity

          People

            akarpe Ashwin J. Karpe
            davsclaus Claus Ibsen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: