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

no exception can be thrown java
no exception of type configurationexception can be thrown;
throw exception of type exception
no exception of type sdkexception can be thrown
dataaccessexception subclasses

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 understand why the error ocurrs. let me know. thx.

package com.sds.afi.cosmos.cmm.db.impl;

import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.orm.ibatis.SqlMapClientTemplate;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
import org.springframework.stereotype.Repository;

import com.sds.afi.cosmos.cmm.db.MainDao;

@Repository
//@SuppressWarnings("unchecked")   // 부적절한 컴파일러의 경고를 제거
public class MainDaoImpl extends SqlMapClientDaoSupport  implements MainDao {

    @Autowired
    private SqlMapClientTemplate sqlMapClientTemplate;

    @SuppressWarnings("unchecked")
    @Override
    public List<HashMap> getUserInfo() throws DataAccessException {

        List<HashMap> lists;

        lists = sqlMapClientTemplate.queryForList("common.getList");

        return lists;
    }

}

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.

"No exception of type SomeException can be thrown; an Exception , EJB project. JBDS shows the error: No exception of type EmailException can be thrown; an Exception type must be a subclass of Throwable� Exception thrown on concurrency failure. class: DataAccessResourceFailureException Data access exception thrown when a resource fails completely: for example, if we can't connect to a database using JDBC. class: DataIntegrityViolationException Exception thrown when an attempt to insert or update data results in violation of an integrity constraint. class

Your DataAccessException is not a subclass of Throwable class (extends Throwable). It should be, and without this inheritance, your code is not compilable with the current throws clause. Here is an example: http://www.osix.net/modules/article/?id=754

No exception of type Exception can be thrown, an exception type , No exception of type Exception can be thrown, an exception type must be a subclass of Throwable. no exception of type configurationexception can be thrown; JBDS shows the error: No exception of type EmailException can be thrown; an Exception type must be a subclass of Throwable. Resolution. Add commons-lang.jar to the project's build path. Root Cause. Apache commons-mail depends on commons-lang, and has an exception class derived from commons-lang's NestedRuntimeException class.

I had this same issue when I upgraded to 5.X.X version. I have added Spring-core.jar file and it worked fine for me. Just adding this here because it may help some one. Spring txn jar , dao jar and spring core are must.

522327 – [9] Bogus error "No exception of type IOException can be , ERROR in nonmodular\ProblemWithThrowable.java (at line 7) public void can be thrown; an exception type must be a subclass of Throwable ----------. If the problem persists, can you please provide the screenshot of the Office application Account page for problematic user and user working normally? (Open the Excel application> Account> Take a screenshot) Note: Please mask the email address and tenant name to protect your privacy. Appreciate your understanding. Best Regards, Chitrahaas

This means that in your getUserInfo() method there is no code that throws that exception. So just remove the throws clause from your method declaration.

DataAccessException (Spring Framework 5.2.7.RELEASE API), As this class is a runtime exception, there is no need for user code to catch it or subclasses if any error is to be considered fatal (the usual case). Author: Rod� ClassNotFoundException This type of exception is thrown when the JVM is not able to find the required class. It may be due to a command-line error, a classpath issue, or a missing.class file. For example, consider the following code snippet:

I was facing same problem. What I have done wrong was I have created Exception class(by mistake) of my own. In other programs I was trying to extend Exception class(default) but complier(eclipse)was loading user defined Exception class giving me same error. So please make sure you are not overriding any default class.

Types of Exceptions, All exception types are subclasses of the built-in class Throwable. different type of exceptions we have to catch both exceptions or we can have When an unchecked exception is thrown, it is usually caused by a misuse of If User enters non-numeric value, program ends in error/exceptional condition. The exception is object created at the time of exceptional/error condition which will be thrown from the program and halt normal execution of the program. Java exceptions object hierarchy is as below: All exception types are subclasses of the built-in class Throwable. Thus, Throwable is at the top of the exception class hierarchy.

No exception of type DataAccessException can be thrown, No exception of type DataAccessException can be thrown; an exception type must be a subclass of Throwable. Question. My source code like below. It has a� If an ingestion source exceeds the maximal size of 4GB, then the exception is thrown. The size validation can be overridden by the IgnoreSizeLimit flag in the IngestionProperties class . However, it's not recommended to ingest single sources larger than 1 GB .

excpetion with multiple catch Solutions, No exception of type Exception can be thrown; an exception type must be a subclass of Throwable The method printStackTrace() is undefined� Unforeseen circumstances can happen at any time while using the computer: it can turn off due to a power cut, a Blue Screen of Death (BSoD) can occur, or random Windows updates can decide to reboot the machine when you went away for a few minutes. As a result, your schoolwork, important documents, and other data might be lost.

No exception of type SDKException can be thrown; an exception , Error is as below -. No exception of type SDKException can be thrown; an exception type must be subclass of Throwable. Thanks in advance.

Comments
  • I wonder the difference between a class that extends Throwable and a subclass of subclass. And If that exception that error occurs is not a subclass of Throwable, How can I handle this problem?
  • I chased my DataAccessException's super classes. And it extends Java.lang.Excpetion.
  • That's odd. According to this thread (first answer): stackoverflow.com/questions/2416980/…, if the superclass is missing from the classpath, you may get this exception.
  • If I get rid of it, another error "Unhandled exception type DataAccessException" occured.
  • then, I wrapped it with try~ catch statements. but another error "No exception of type DataAccessException can be thrown; an exception type must be a subclass of Throwable" ouccred.
  • I think the other answer is probably what you are looking for then, make sure that your DataAccessException is the same one in the called method as in the calling method.