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

NullPointerException when catching exceptions

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 2.6.0, 2.7.0, 2.8.0
    • 2.8.1, 2.9.0
    • camel-core
    • None
    • ServiceMix 4.x (OSGI environment), Blueprint route definition.

    • Unknown

    Description

      The following (blueprint) route produces a NullPointerException :

      <route id="restproxy">           
          <from uri="restlet:http://localhost:9080/oe/ws/offre/{id}"/>
          <doTry>
              <to uri="restlet:http://bla.dot.com:8080/oe/ws/offre/{id}"/>
              <doCatch>
                  <exception>org.apache.camel.component.restlet.RestletOperationException</exception>
              </doCatch>
          </doTry>
      </route>
      

      This happens for when catching any exception classes that does not belong to camel-core or to the classpath (in a OSGI environment).

      The NullPointerException is caused by the following statement in class org.apache.camel.model.CatchDefinition, method createExceptionClasses() :

      Class<Exception> type = CastUtils.cast(ObjectHelper.loadClass(name, getClass().getClassLoader()));
      

      i.e. the class is not found by the class loader.

      A work-around is to activate dev:dynamic-import on the camel-core bundle.

      Attachments

        Activity

          People

            davsclaus Claus Ibsen
            cedric.delaunois Cedric de Launois
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: