title: Mule - Catch Exception strategy isn't being called for specified exception
body: <p>I'm trying to implement an error handling strategy for my Mule application which is writing data to a database. I have the following example of an exception that is thrown when trying to insert a record that has a duplicate identifier:</p>
  
  <pre><code>ERROR 2014-03-17 16:02:15,990 [[processes].inputConnector.receiver.01] org.mule.exception.DefaultMessagingExceptionStrategy: 
  ********************************************************************************
  Message               : Failed to route event via endpoint: DefaultOutboundEndpoint{endpointUri=jdbc://insertRecord, connector=JdbcConnector
  {
    name=dbQueries
    lifecycle=start
    this=4c6f44a0
    numberOfConcurrentTransactedReceivers=4
    createMultipleTransactedReceivers=false
    connected=true
    supportedProtocols=[jdbc]
    serviceOverrides=&lt;none&gt;
  }
  ,  name='endpoint.jdbc.insertRecord', mep=ONE_WAY, properties={queryTimeout=-1}, transactionConfig=Transaction{factory=null, action=INDIFFERENT, timeout=0}, deleteUnacceptedMessages=false, initialState=started, responseTimeout=10000, endpointEncoding=UTF-8, disableTransportTransformer=false}. Message payload is of type: HashMap
  Code                  : MULE_ERROR--2
  --------------------------------------------------------------------------------
  Exception stack is:
  1. The statement was aborted because it would have caused a duplicate key value in a unique or primary key constraint or unique index identified by 'SQL140317160209540' defined on 'TESTTABLE'. (org.apache.derby.iapi.error.StandardException)
    org.apache.derby.iapi.error.StandardException:-1 (null)
  2. The statement was aborted because it would have caused a duplicate key value in a unique or primary key constraint or unique index identified by 'SQL140317160209540' defined on 'TESTTABLE'.(SQL Code: 30000, SQL State: + 23505) (org.apache.derby.impl.jdbc.EmbedSQLException)
    org.apache.derby.impl.jdbc.SQLExceptionFactory:-1 (null)
  3. The statement was aborted because it would have caused a duplicate key value in a unique or primary key constraint or unique index identified by 'SQL140317160209540' defined on 'TESTTABLE'.(SQL Code: 30000, SQL State: + 23505) (java.sql.SQLIntegrityConstraintViolationException)
    org.apache.derby.impl.jdbc.SQLExceptionFactory40:-1 (null)
  4. The statement was aborted because it would have caused a duplicate key value in a unique or primary key constraint or unique index identified by 'SQL140317160209540' defined on 'TESTTABLE'. Query: INSERT INTO TestTable (Id, Quantity) VALUES (?, ?) Parameters: [261000153085, 7](SQL Code: 30000, SQL State: + 23505) (java.sql.SQLException)
    org.apache.commons.dbutils.QueryRunner:540 (null)
  5. Failed to route event via endpoint: DefaultOutboundEndpoint{endpointUri=jdbc://insertRecord, connector=JdbcConnector
  {
    name=dbQueries
    lifecycle=start
    this=4c6f44a0
    numberOfConcurrentTransactedReceivers=4
    createMultipleTransactedReceivers=false
    connected=true
    supportedProtocols=[jdbc]
    serviceOverrides=&lt;none&gt;
  }
  ,  name='endpoint.jdbc.insertRecord', mep=ONE_WAY, properties={queryTimeout=-1}, transactionConfig=Transaction{factory=null, action=INDIFFERENT, timeout=0}, deleteUnacceptedMessages=false, initialState=started, responseTimeout=10000, endpointEncoding=UTF-8, disableTransportTransformer=false}. Message payload is of type: HashMap (org.mule.api.transport.DispatchException)
    org.mule.transport.AbstractMessageDispatcher:109 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/transport/DispatchException.html)
  --------------------------------------------------------------------------------
  Root Exception stack trace:
  ERROR 23505: The statement was aborted because it would have caused a duplicate key value in a unique or primary key constraint or unique index identified by 'SQL140317160209540' defined on 'TESTTABLE'.
      at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
      at org.apache.derby.impl.sql.execute.IndexChanger.insertAndCheckDups(Unknown Source)
      at org.apache.derby.impl.sql.execute.IndexChanger.doInsert(Unknown Source)
      + 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
  ********************************************************************************
  </code></pre>
  
  <p>I've got a Choice Exception strategy defined to deal with different exceptions and have used the following to handle the case outlined:</p>
  
  <pre><code>&lt;catch-exception-strategy when="#[exception.causeMatches(org.apache.derby.*)]" doc:name="Catch Exception Strategy"&gt;         
       &lt;logger level="ERROR" message="Database error." doc:name="Logger"/&gt;
  &lt;/catch-exception-strategy&gt;
  </code></pre>
  
  <p>However, the exception always gets routed to the default strategy and not the catch strategy defined above. I'm assuming this is an issue with my 'when' expression, I'm just not sure how to resolve it. Any help would be appreciated. Thanks</p>