NutzCN Logo
问答 quartz启动加载失败,疑似冲突?
发布于 3026天前 作者 qq_a930202f 2205 次浏览 复制 上一个帖子 下一个帖子
标签:

项目中存在另一个类库cron4j,疑似Scheduler重名引起报错,改如何处理最好?

2016-09-08 18:04:18 [ContainerBackgroundProcessor[StandardEngine[Catalina]]] INFO  org.nutz.lang.inject.InjectByField -Fail to set value by field
org.nutz.castor.FailToCastObjectException: Fail to cast from <it.sauronsoftware.cron4j.Scheduler> to <org.quartz.Scheduler> for {it.sauronsoftware.cron4j.Scheduler@77d5cdd0} because:
BorningException:Fail to born 'org.quartz.Scheduler'
 by args: [
  @(it.sauronsoftware.cron4j.Scheduler@77d5cdd0)]
	at org.nutz.castor.Castors.cast(Castors.java:264) ~[nutz-1.r.57.r3.jar:na]
	at org.nutz.castor.Castors.castTo(Castors.java:318) ~[nutz-1.r.57.r3.jar:na]
	at org.nutz.lang.inject.InjectByField.inject(InjectByField.java:24) ~[nutz-1.r.57.r3.jar:na]
	at org.nutz.ioc.weaver.FieldInjector.inject(FieldInjector.java:32) [nutz-1.r.57.r3.jar:na]
	at org.nutz.ioc.weaver.DefaultWeaver.fill(DefaultWeaver.java:56) [nutz-1.r.57.r3.jar:na]
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:135) [nutz-1.r.57.r3.jar:na]
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:210) [nutz-1.r.57.r3.jar:na]
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:239) [nutz-1.r.57.r3.jar:na]
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:146) [nutz-1.r.57.r3.jar:na]
	at com.my.MvcSetup.init(MvcSetup.java:29) [classes/:na]
	at org.nutz.mvc.impl.NutLoading.evalSetup(NutLoading.java:276) [nutz-1.r.57.r3.jar:na]
	at org.nutz.mvc.impl.NutLoading.load(NutLoading.java:120) [nutz-1.r.57.r3.jar:na]
	at org.nutz.mvc.ActionHandler.<init>(ActionHandler.java:19) [nutz-1.r.57.r3.jar:na]
	at org.nutz.mvc.NutFilter._init(NutFilter.java:87) [nutz-1.r.57.r3.jar:na]
	at org.nutz.mvc.NutFilter.init(NutFilter.java:65) [nutz-1.r.57.r3.jar:na]
	at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279) [catalina.jar:8.0.30]
	at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260) [catalina.jar:8.0.30]
	at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105) [catalina.jar:8.0.30]
	at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4659) [catalina.jar:8.0.30]
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5281) [catalina.jar:8.0.30]
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [catalina.jar:8.0.30]
	at org.apache.catalina.core.StandardContext.reload(StandardContext.java:3831) [catalina.jar:8.0.30]
	at org.apache.catalina.loader.WebappLoader.backgroundProcess(WebappLoader.java:292) [catalina.jar:8.0.30]
	at org.apache.catalina.core.StandardContext.backgroundProcess(StandardContext.java:5616) [catalina.jar:8.0.30]
	at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1377) [catalina.jar:8.0.30]
	at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1381) [catalina.jar:8.0.30]
	at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1381) [catalina.jar:8.0.30]
	at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1349) [catalina.jar:8.0.30]
	at java.lang.Thread.run(Thread.java:745) [na:1.8.0_73]
Caused by: org.nutz.lang.born.BorningException: Fail to born 'org.quartz.Scheduler'
 by args: [
  @(it.sauronsoftware.cron4j.Scheduler@77d5cdd0)]
	at org.nutz.lang.Mirror.born(Mirror.java:988) ~[nutz-1.r.57.r3.jar:na]
	at org.nutz.castor.castor.Object2Object.cast(Object2Object.java:12) ~[nutz-1.r.57.r3.jar:na]
	at org.nutz.castor.Castors.cast(Castors.java:252) ~[nutz-1.r.57.r3.jar:na]
	... 28 common frames omitted
2016-09-08 18:04:18 [ContainerBackgroundProcessor[StandardEngine[Catalina]]] DEBUG org.nutz.ioc.impl.ScopeContext -Remove object 'nutQuartzCronJobFactory' from [app] 
2016-09-08 18:04:18 [ContainerBackgroundProcessor[StandardEngine[Catalina]]] ERROR org.nutz.mvc.impl.NutLoading -Error happend during start serivce!
org.nutz.ioc.IocException: [nutQuartzCronJobFactory] # FAIL to create Ioc Bean name=[nutQuartzCronJobFactory]
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:149) ~[nutz-1.r.57.r3.jar:na]
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:210) ~[nutz-1.r.57.r3.jar:na]
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:239) ~[nutz-1.r.57.r3.jar:na]
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:146) ~[nutz-1.r.57.r3.jar:na]
	at com.my.MvcSetup.init(MvcSetup.java:29) ~[classes/:na]
	at org.nutz.mvc.impl.NutLoading.evalSetup(NutLoading.java:276) ~[nutz-1.r.57.r3.jar:na]
	at org.nutz.mvc.impl.NutLoading.load(NutLoading.java:120) ~[nutz-1.r.57.r3.jar:na]
	at org.nutz.mvc.ActionHandler.<init>(ActionHandler.java:19) [nutz-1.r.57.r3.jar:na]
	at org.nutz.mvc.NutFilter._init(NutFilter.java:87) [nutz-1.r.57.r3.jar:na]
	at org.nutz.mvc.NutFilter.init(NutFilter.java:65) [nutz-1.r.57.r3.jar:na]
	at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279) [catalina.jar:8.0.30]
	at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260) [catalina.jar:8.0.30]
	at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105) [catalina.jar:8.0.30]
	at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4659) [catalina.jar:8.0.30]
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5281) [catalina.jar:8.0.30]
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [catalina.jar:8.0.30]
	at org.apache.catalina.core.StandardContext.reload(StandardContext.java:3831) [catalina.jar:8.0.30]
	at org.apache.catalina.loader.WebappLoader.backgroundProcess(WebappLoader.java:292) [catalina.jar:8.0.30]
	at org.apache.catalina.core.StandardContext.backgroundProcess(StandardContext.java:5616) [catalina.jar:8.0.30]
	at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1377) [catalina.jar:8.0.30]
	at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1381) [catalina.jar:8.0.30]
	at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1381) [catalina.jar:8.0.30]
	at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1349) [catalina.jar:8.0.30]
	at java.lang.Thread.run(Thread.java:745) [na:1.8.0_73]
Caused by: java.lang.RuntimeException: Fail to set 'it.sauronsoftware.cron4j.Scheduler@77d5cdd0'[ null ] to field org.nutz.integration.quartz.NutQuartzCronJobFactory.'scheduler' because [org.nutz.lang.born.BorningException: Fail to born 'org.quartz.Scheduler'
 by args: [
  @(it.sauronsoftware.cron4j.Scheduler@77d5cdd0)]]: Fail to born 'org.quartz.Scheduler'
 by args: [
  @(it.sauronsoftware.cron4j.Scheduler@77d5cdd0)]
	at org.nutz.lang.Lang.makeThrow(Lang.java:104) ~[nutz-1.r.57.r3.jar:na]
	at org.nutz.lang.inject.InjectByField.inject(InjectByField.java:30) ~[nutz-1.r.57.r3.jar:na]
	at org.nutz.ioc.weaver.FieldInjector.inject(FieldInjector.java:32) ~[nutz-1.r.57.r3.jar:na]
	at org.nutz.ioc.weaver.DefaultWeaver.fill(DefaultWeaver.java:56) ~[nutz-1.r.57.r3.jar:na]
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:135) ~[nutz-1.r.57.r3.jar:na]
	... 23 common frames omitted
3 回复

import成it.sauronsoftware.cron4j.Scheduler,能不报错吗

来自炫酷的 NutzCN

@wendal 么有显式导入啊
看日志是这句报的

ioc.get(NutQuartzCronJobFactory.class);

全文搜索,肯定有地方引用了

来自炫酷的 NutzCN

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