In java, we have to catch general exception later and specific exception need to catch first. If we also need to do such that in apache camel. If so, my code will be like below? or it doesn't make any differences?
A little clarification - the order does matter, but not as much as it does in Java.
For the code snippets you posted, it doesn’t make any difference. You’ve defined one onException block than handles multiple exceptions. The order of the onException blocks themselves can effect which block is matches (in the case of two exceptions with the same “distance” from the caught exception).
The link souciance provided has an ok discussion of this, but Claus’s book (Camel In Action) has a much better discussion - an entire chapter on error handling.