NutzCN Logo
问答 ioc.get(NutQuartzCronJobFactory.class);时
发布于 3245天前 作者 CXW0504 6454 次浏览 复制 上一个帖子 下一个帖子
标签: quartz

org.nutz.ioc.IocException: Object 'nutQuartzCronJobFactory' without define! For object [nutQuartzCronJobFactory] - type:[class org.nutz.integration.quartz.NutQuartzCronJobFactory]
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:203)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:221)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:140)
at com.hgd.MainSetup.init(MainSetup.java:34)
at org.nutz.mvc.impl.NutLoading.evalSetup(NutLoading.java:270)
at org.nutz.mvc.impl.NutLoading.load(NutLoading.java:119)
at org.nutz.mvc.ActionHandler.(ActionHandler.java:19)
at org.nutz.mvc.NutFilter.init(NutFilter.java:77)

14 回复

检查@IocBy配置,看看有无包含quartz插件的IocLoader类

@wendal 已经写了
@IocBy(type=ComboIocProvider.class,
args={"*js", "ioc/",
"*anno","com.yunda","*tx",
"*org.nutz.integration.quartz.QuartzIocLoader"})

@cxw0504 我猜你自己new NutIoc了

来自炫酷的 NutzCN

@wendal
if (!Charset.defaultCharset().name().equalsIgnoreCase(Encoding.UTF8)) {
log.warn("This project must run in UTF-8, pls add -Dfile.encoding=UTF-8 to JAVA_OPTS");
}
Ioc ioc = config.getIoc();
// 获取NutQuartzCronJobFactory从而触发计划任务的初始化与启动
ioc.get(NutQuartzCronJobFactory.class);

检查一下启动日志,看看加载了啥bean定义

来自炫酷的 NutzCN

@wendal
2015-11-20 11:48:57,408 org.nutz.mvc.config.AbstractNutConfig.getMainModule(AbstractNutConfig.java:119) DEBUG - MainModule: <com.yunda.MainModule>
2015-11-20 11:48:57,408 org.nutz.mvc.impl.NutLoading.createContext(NutLoading.java:231) DEBUG - >> app.root = E:/eclipse_work/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/yunda
2015-11-20 11:48:57,472 org.nutz.castor.Castors.reload(Castors.java:116) DEBUG - Using 91 castor for Castors
2015-11-20 11:48:57,476 org.nutz.mvc.impl.NutLoading.createIoc(NutLoading.java:368) DEBUG - @IocBy(type=org.nutz.mvc.ioc.provider.ComboIocProvider, args=["*js", "ioc/", "*anno", "com.yunda", "*tx", "*org.nutz.integration.quartz.QuartzIocLoader"],init=[])
2015-11-20 11:48:57,496 org.nutz.resource.Scans.scan(Scans.java:234) DEBUG - Found 3 resource by src( ioc/ ) , regex( ^(.+[.])(js|json)$ )
2015-11-20 11:48:57,497 org.nutz.ioc.loader.json.JsonLoader.(JsonLoader.java:44) DEBUG - loading ioc js config from [dao.js]
2015-11-20 11:48:57,500 org.nutz.ioc.loader.json.JsonLoader.(JsonLoader.java:44) DEBUG - loading ioc js config from [quartz.js]
2015-11-20 11:48:57,501 org.nutz.ioc.loader.json.JsonLoader.(JsonLoader.java:44) DEBUG - loading ioc js config from [redis.js]
2015-11-20 11:48:57,503 org.nutz.ioc.loader.json.JsonLoader.(JsonLoader.java:52) DEBUG - Loaded 6 bean define from path=[ioc/] --> [dataSource, scheduler, dao, jedisPoolConfig, conf, jedisPool]
2015-11-20 11:48:57,517 org.nutz.resource.Scans.scan(Scans.java:234) DEBUG - Found 29 resource by src( com/yunda/ ) , regex( ^.+[.]class$ )
2015-11-20 11:48:57,555 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:71) DEBUG - Found a Class with Ioc-Annotation : class com.yunda.task.Autocensure
2015-11-20 11:48:57,569 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:71) DEBUG - Found a Class with Ioc-Annotation : class com.yunda.Service.MSGService
2015-11-20 11:48:57,571 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:71) DEBUG - Found a Class with Ioc-Annotation : class com.yunda.action.MsgAction
2015-11-20 11:48:57,580 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:71) DEBUG - Found a Class with Ioc-Annotation : class com.yunda.action.UserAction
2015-11-20 11:48:57,589 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:71) DEBUG - Found a Class with Ioc-Annotation : class com.yunda.Service.RedisService
2015-11-20 11:48:57,600 org.nutz.ioc.loader.annotation.AnnotationIocLoader.(AnnotationIocLoader.java:48) INFO - Scan complete ! Found 5 classes in 1 base-packages!
beans = ["redis", "yundaAction", "userAction", "yundacensure", "yundaervice"]

@cxw0504 这才到*anno的log,继续往下

来自炫酷的 NutzCN

@wendal

2015-11-20 11:48:57,600 org.nutz.ioc.loader.json.JsonLoader.(JsonLoader.java:36) DEBUG - Loaded 5 bean define from reader --
[txREPEATABLE_READ, txREAD_COMMITTED, txNONE, txSERIALIZABLE, txREAD_UNCOMMITTED]
2015-11-20 11:48:57,601 org.nutz.ioc.loader.json.JsonLoader.(JsonLoader.java:52) DEBUG - Loaded 0 bean define from path=[] --> []
2015-11-20 11:48:57,602 org.nutz.ioc.loader.combo.ComboIocLoader.(ComboIocLoader.java:103) WARN - Found Duplicate beanName=scheduler, pls check you config!
2015-11-20 11:48:57,604 org.nutz.ioc.impl.NutIoc.(NutIoc.java:93) INFO - NutIoc init begin ...
2015-11-20 11:48:57,607 org.nutz.ioc.impl.NutIoc.(NutIoc.java:109) INFO - ... NutIoc init complete
2015-11-20 11:48:57,608 org.nutz.mvc.config.AbstractNutConfig.getMainModule(AbstractNutConfig.java:119) DEBUG - MainModule: <com.yunda.MainModule>
2015-11-20 11:48:57,609 org.nutz.mvc.impl.NutLoading.evalUrlMapping(NutLoading.java:157) INFO - Build URL mapping by org.nutz.mvc.impl.UrlMappingImpl ...
2015-11-20 11:48:57,611 org.nutz.mvc.impl.NutLoading.createViewMakers(NutLoading.java:358) DEBUG - @Views(DefaultViewMaker)
2015-11-20 11:48:57,619 org.nutz.resource.Scans.scan(Scans.java:234) DEBUG - Found 1 resource by src( mvc/book-mvc-chain.js ) , regex( ^(.+[.])(js|json)$ )
2015-11-20 11:48:57,625 org.nutz.mvc.impl.chainconfig.JsonActionChainMakerConfiguretion.(JsonActionChainMakerConfiguretion.java:37) DEBUG - ActionChain Config:
{
"default" :{
"ps" :["com.yunda.mvc.LogTimeProcessor", "com.yunda.mvc.yundaProcessor", "org.nutz.mvc.impl.processor.UpdateRequestAttributesProcessor", "org.nutz.mvc.impl.processor.EncodingProcessor", "org.nutz.mvc.impl.processor.ModuleProcessor", "org.nutz.mvc.impl.processor.ActionFiltersProcessor", "org.nutz.mvc.impl.processor.AdaptorProcessor", "org.nutz.mvc.impl.processor.MethodInvokeProcessor", "org.nutz.mvc.impl.processor.ViewProcessor"],
"error" :"org.nutz.mvc.impl.processor.FailProcessor"
}
}
2015-11-20 11:48:57,626 org.nutz.mvc.impl.NutLoading.createChainMaker(NutLoading.java:259) DEBUG - @ChainBy(org.nutz.mvc.impl.NutActionChainMaker)
2015-11-20 11:48:57,628 org.nutz.mvc.impl.Loadings.scanModules(Loadings.java:139) DEBUG - module class location 'file:/E:/eclipse_work/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/yunda/WEB-INF/classes/com/yunda/MainModule.class'
2015-11-20 11:48:57,629 org.nutz.mvc.impl.Loadings.scanModuleInPackage(Loadings.java:169) DEBUG - > scan 'com.yunda'
2015-11-20 11:48:57,638 org.nutz.resource.Scans.scan(Scans.java:234) DEBUG - Found 29 resource by src( com/yunda/ ) , regex( ^.+[.]class$ )
2015-11-20 11:48:57,641 org.nutz.mvc.impl.Loadings.checkModule(Loadings.java:183) DEBUG - >> add 'com.yunda.action.MsgAction'
2015-11-20 11:48:57,642 org.nutz.mvc.impl.Loadings.checkModule(Loadings.java:183) DEBUG - >> add 'com.yunda.action.UserAction'
2015-11-20 11:48:57,659 org.nutz.mvc.impl.UrlMappingImpl.printActionMapping(UrlMappingImpl.java:130) DEBUG - '/sendSMS' >> yundaMsgAction.sendSMS(...) : Object | @Ok(Json ) @Fail(null ) | by 0 Filters | (I:UTF-8/O:UTF-8)
2015-11-20 11:48:57,663 org.nutz.mvc.impl.UrlMappingImpl.printActionMapping(UrlMappingImpl.java:130) DEBUG - '/register' >> UserAction.register(...) : Object | @Ok(json ) @Fail(null ) | by 0 Filters | (I:UTF-8/O:UTF-8)
2015-11-20 11:48:57,674 org.nutz.mvc.impl.UrlMappingImpl.printActionMapping(UrlMappingImpl.java:130) DEBUG - '/login' >> UserAction.login(...) : Object | @Ok(json:{locked:'password|salt',ignoreNull:true}) @Fail(null ) | by 0 Filters | (I:UTF-8/O:UTF-8)
2015-11-20 11:48:57,675 org.nutz.mvc.impl.NutLoading.evalUrlMapping(NutLoading.java:217) INFO - Found 3 module methods
2015-11-20 11:48:57,675 org.nutz.mvc.impl.NutLoading.evalLocalization(NutLoading.java:323) DEBUG - @Localization not define
2015-11-20 11:48:57,676 org.nutz.mvc.impl.NutLoading.evalSetup(NutLoading.java:267) INFO - Setup application...
2015-11-20 11:48:57,677 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:145) DEBUG - Get 'nutQuartzCronJobFactory'<class org.nutz.integration.quartz.NutQuartzCronJobFactory>
2015-11-20 11:48:57,677 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:165) DEBUG - >> Load definition
2015-11-20 11:48:57,679 org.nutz.mvc.impl.NutLoading.load(NutLoading.java:123) ERROR - Error happend during start serivce!
org.nutz.ioc.IocException: Object 'nutQuartzCronJobFactory' without define! For object [nutQuartzCronJobFactory] - type:[class org.nutz.integration.quartz.NutQuartzCronJobFactory]
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:203)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:221)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:140)
at com.yunda.MainSetup.init(MainSetup.java:35)
at org.nutz.mvc.impl.NutLoading.evalSetup(NutLoading.java:270)
at org.nutz.mvc.impl.NutLoading.load(NutLoading.java:119)
at org.nutz.mvc.ActionHandler.(ActionHandler.java:19)
at org.nutz.mvc.NutFilter.init(NutFilter.java:77)
at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:273)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:254)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:372)
at org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:98)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4584)
at org.apache.catalina.core.StandardContext$2.call(StandardContext.java:5262)
at org.apache.catalina.core.StandardContext$2.call(StandardContext.java:5257)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.nutz.ioc.ObjectLoadException: Object 'nutQuartzCronJobFactory' without define!
at org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:149)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:168)

2015-11-20 11:48:57,601 org.nutz.ioc.loader.json.JsonLoader.(JsonLoader.java:52) DEBUG - Loaded 0 bean define from path=[] --> []
2015-11-20 11:48:57,602 org.nutz.ioc.loader.combo.ComboIocLoader.(ComboIocLoader.java:103) WARN - Found Duplicate beanName=scheduler, pls check you config!

我猜是有个 ioc/quartz.js , 删掉它, 就会加载插件默认的

@wendal
2015-11-20 12:28:34,886 org.nutz.ioc.loader.json.JsonLoader.(JsonLoader.java:52) DEBUG - Loaded 0 bean define from path=[] --> []
2015-11-20 12:28:34,890 org.nutz.ioc.impl.NutIoc.(NutIoc.java:93) INFO - NutIoc init begin ...

找 ioc/quartz.js 删掉

完全正确,我也遇到这个问题,果然是quartz.js造成的

把里面的内容搞掉就没事了

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