No exception of type DataAccessException can be thrown; an exception type must be a subclass of Throwable

前端 未结 5 872
旧巷少年郎
旧巷少年郎 2021-01-17 13:42

My source code like below. It has a error, \"No exception of type DataAccessException can be thrown; an exception type must be a subclass of Throwable\".

I can\'t un

5条回答
  •  一生所求
    2021-01-17 14:13

    This can happen if some class in the type-hierarchy of the exception is not on the class-path. In that case, its not possible to verify whether the exception really extends Throwable, whether it is a checked one or not, etc. Hence the errors. e.g superclass of Dataaccessexception : NestedRuntimeException may be missing from the class-path as it is in a differnt jar i.e. spring-core.

提交回复
热议问题