NutzCN Logo
问答 手动创建DAO 错误
发布于 2961天前 作者 qq_cd48ca64 1820 次浏览 复制 上一个帖子 下一个帖子
标签:

我看论坛上一哥们就这么弄的 为什么我就不行。。。。

SimpleDataSource ds= new SimpleDataSource();
ds.setDriverClassName("com.mysql.jdbc.Driver");
ds.setJdbcUrl("jdbc:mysql://192.168.12.15:3306/db_8080_upgrade");
ds.setUsername("root");
ds.setPassword("root");
ds.getConnection();
Dao serverDao = new NutDao(ds);

异常
org.nutz.dao.DaoException: java.lang.NullPointerException
at org.nutz.dao.impl.sql.run.NutDaoRunner.run(NutDaoRunner.java:49)
at org.nutz.dao.impl.DaoSupport.run(DaoSupport.java:239)
at org.nutz.dao.impl.DaoSupport.setDataSource(DaoSupport.java:178)
at org.nutz.dao.impl.NutDao.(NutDao.java:112)
at com.mxlvniao.dataReleased.release.UploadService.releaseBase(UploadService.java:39)
at com.mxlvniao.dataReleased.release.UploadService$$NUTZAOP._aop_invoke(UploadService.java:1)
at org.nutz.aop.InterceptorChain.invoke(InterceptorChain.java:77)
at org.nutz.aop.InterceptorChain.doChain(InterceptorChain.java:57)
at org.nutz.aop.interceptor.TransactionInterceptor.filter(TransactionInterceptor.java:34)
at org.nutz.aop.InterceptorChain.doChain(InterceptorChain.java:60)
at com.mxlvniao.dataReleased.release.UploadService$$NUTZAOP.releaseBase(UploadService.java:1)
at com.mxlvniao.dataReleased.release.UploadServiceTest.testReleaseBase(UploadServiceTest.java:41)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
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.lang.NullPointerException
at org.nutz.dao.impl.sql.run.NutDaoRunner.run(NutDaoRunner.java:35)
... 36 more

3 回复

你先告诉我为啥要手动创建

有这么个需求了 我们做一个APP 地图数据发布的工具
工具是一个工程 记录发布历史 具体的下载地址我要 插入到下载地址服务器的数据库中
有可能 有很多个测试服务器 我也没想到好办法 就想分别建立链接插入然后我在关了

添加回复
请先登陆
回到顶部