org.springframework.jdbc.UncategorizedSQLException: ConnectionCallback; uncategorized SQLException for SQL []; SQL state [null]; error code [0]; java.lang.InstantiationException: cn.at.bean.domain.ConstantInt; nested exception is java.sql.SQLException: java.lang.InstantiationException: cn.at.bean.domain.ConstantInt
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:83)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:349)
at cn.at.mo.framework.dao.AbstractStorage.execute(AbstractStorage.java:133)
at cn.at.mo.framework.dao.AbstractStorage.execute(AbstractStorage.java:168)
at cn.at.mo.framework.dao.AbstractStorage.executeQuery(AbstractStorage.java:93)
at cn.at.mo.framework.dao.dao.impl.AbstractDao.findBySql(AbstractDao.java:367)
at cn.at.dao.ConstantIntDao.getCommentId(ConstantIntDao.java:43)
at cn.at.dao.TestConstantIntDao.testGetCommentId(TestConstantIntDao.java:41)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:83)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:88)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.sql.SQLException: java.lang.InstantiationException: cn.at.bean.domain.ConstantInt
at cn.at.mo.framework.dao.CrudBuilder.from(CrudBuilder.java:471)
at cn.at.mo.framework.dao.dao.impl.AbstractDao.from(AbstractDao.java:398)
at cn.at.mo.framework.dao.dao.impl.AbstractDao$5.execute(AbstractDao.java:371)
at cn.at.mo.framework.dao.AbstractStorage$5.execute(AbstractStorage.java:102)
at cn.at.mo.framework.dao.AbstractStorage$8.execute(AbstractStorage.java:172)
at cn.at.mo.framework.dao.AbstractStorage$7.doInConnection(AbstractStorage.java:136)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:342)
... 36 more
Caused by: java.lang.InstantiationException: cn.at.bean.domain.ConstantInt
at java.lang.Class.newInstance0(Class.java:357)
at java.lang.Class.newInstance(Class.java:325)
at cn.at.mo.framework.dao.CrudBuilder.from(CrudBuilder.java:426)
... 42 more
每个bean对象 都应该有一个默认无参数的构造方法 负责查询的时候 通过反射的方式实例化的时候 就会抛出无法实例化的情况