For example:> "INSERT INTO CLOCK_IN(ID,NAME,DEPARTMENT,SERIAL_NUMBER,ATTENDANCE_DAYS,ATTENDANCE_SHIFT,REST_DAYS,WORK_HOURS,LATE_NUMBER,LATE_HOURS,SERIOUS_LATE_NUMBER,SERIOUS_LATE_HOURS,ABSENTEEISM_LATE_DAYS,LEAVE_EARLY_NUMBER,LEAVE_EARLY_HOURS,MISSING_WORK_CLOCK_NUMBER,MISSING_LEAVE_WORK_NUMBER,ABSENTEEISM_DAYS,TRAVELING_DAYS,OUT_WORK_HOURS,AFFAIR_LEAVE_DAYS,SICK_LEAVE_DAYS,PAID_LEAVE_DAYS,OVERTIME_WORKING_DAY_HOURS,REST_OVERTIME_HOURS,HOL_FES_OVERTIME_HOURS) VALUES('10bic28ev6ipkqmta1mj0lr9ja','张杰','综合办公室','','2','2','0','17小时24分钟','0','0','0','0','0','0','0','0','0','29',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL) "
2018-07-03 12:46:17,910 org.nutz.plugins.cache.dao.CachedNutDaoExecutor.exec(CachedNutDaoExecutor.java:200) WARN - clear cache fail: [CLOCK_IN]
java.lang.NullPointerException
at org.nutz.plugins.cache.dao.impl.provider.EhcacheDaoCacheProvider.getCache(EhcacheDaoCacheProvider.java:44)
at org.nutz.plugins.cache.dao.impl.provider.EhcacheDaoCacheProvider.clear(EhcacheDaoCacheProvider.java:34)
at org.nutz.plugins.cache.dao.CachedNutDaoExecutor.exec(CachedNutDaoExecutor.java:195)
at org.nutz.plugins.cache.dao.DaoCacheInterceptor.filter(DaoCacheInterceptor.java:18)
at org.nutz.dao.DaoInterceptorChain.doChain(DaoInterceptorChain.java:64)
at org.nutz.dao.DaoInterceptorChain.invoke(DaoInterceptorChain.java:139)
at org.nutz.dao.impl.sql.run.NutDaoRunner.runCallback(NutDaoRunner.java:158)
at org.nutz.dao.impl.sql.run.NutDaoRunner._runWithTransaction(NutDaoRunner.java:104)
at org.nutz.dao.impl.sql.run.NutDaoRunner._run(NutDaoRunner.java:88)
at org.nutz.dao.impl.sql.run.NutDaoRunner$1.run(NutDaoRunner.java:74)
at org.nutz.trans.Trans.exec(Trans.java:174)
at org.nutz.dao.impl.sql.run.NutDaoRunner.run(NutDaoRunner.java:72)
at org.nutz.dao.impl.DaoSupport.run(DaoSupport.java:240)
at org.nutz.dao.impl.DaoSupport._exec(DaoSupport.java:252)
at org.nutz.dao.impl.EntityOperator.exec(EntityOperator.java:55)
at org.nutz.dao.impl.NutDao.insert(NutDao.java:149)
at org.sys.yt.service.imp.DingDing.uploadExcle(DingDing.java:29)
at org.mytest.ty.test.NutzJunitTest.test2(NutzJunitTest.java:39)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.nutz.mock.NutTestRunner.runChild(NutTestRunner.java:33)
at org.nutz.mock.NutTestRunner.runChild(NutTestRunner.java:14)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
11 回复
// 第一步,使用j4e解析excel文件获得数据集合
InputStream in = Files.findFileAsStream(Disks.absolute("C:\\Users\\Think\\Desktop\\work files\\doc\\报表_20180527-20180626.xlsx"));
List<ClockIn> clockin = J4E.fromExcel(in, ClockIn.class, null);
// 第二步,插入数据到数据库
// dao.clear(ClockIn.class);
dao.insert(clockin);
初始化……
cacheExecutor : {
type : "org.nutz.plugins.cache.dao.DaoCacheInterceptor",
fields : {
cacheProvider : {refer:"cacheProvider"},
// 需要缓存的表名
cachedTableNames : [//"t_user_profile",
// "t_user", "t_role", "t_permission", "t_role_permission"
]
}
},
// 基于Ehcache的DaoCacheProvider
cacheProvider : {
type : "org.nutz.plugins.cache.dao.impl.provider.EhcacheDaoCacheProvider",
fields : {
cacheManager : {refer:"cacheManager"} // 引用ehcache.js中定义的CacheManager
},
events : {
create : "init"
}
}
}
是这样吗
var ioc = {
"cacheManager" : {
"type" : "net.sf.ehcache.CacheManager",
"factory" : "net.sf.ehcache.CacheManager#getCacheManager",
"args" : ["statistics"] // 对应shiro.ini中指定的ehcache.xml中定义的name
}
/*
// 如果不需要shiro初始化的Ehcache, 使用下面的方式配置
"cacheManager" : {
"type" : "net.sf.ehcache.CacheManager",
"factory" : "net.sf.ehcache.CacheManager#create"
}
*/
};
junit的@Before @After了解一下?
2018-07-03 13:01:34,933 org.nutz.ioc.aop.impl.DefaultMirrorFactory.getMirror(DefaultMirrorFactory.java:70) DEBUG - Load class org.sys.yt.service.imp.DingDing without AOP
2018-07-03 13:01:34,934 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:157) DEBUG - Get 'dao'<interface org.nutz.dao.Dao>
2018-07-03 13:01:34,935 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:157) DEBUG - Get 'cacheManager'<class org.apache.shiro.cache.ehcache.EhCacheManager>
java.lang.NullPointerException
at org.mytest.ty.test.NutzJunitTest.runBeforeTestMethod(NutzJunitTest.java:39)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.nutz.mock.NutTestRunner.runChild(NutTestRunner.java:33)
at org.nutz.mock.NutTestRunner.runChild(NutTestRunner.java:14)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
@Inject
private EhCacheManager cacheManager;
@Before
public void runBeforeTestMethod() {
cacheManager.init();
}
添加回复
请先登陆