NutzCN Logo
问答 Fail to born or cast to 'com.java.onlineqs.xzfwzx.dao.XStaffDao'
发布于 10天前 作者 qq_b54b367e 58 次浏览 复制 上一个帖子 下一个帖子
标签:
[DEBUG] 2018-01-12 16:20:39,053 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:157) - Get 'baseStaffDao'<class com.java.onlineqs.base.dao.StaffDao>
[DEBUG] 2018-01-12 16:20:39,053 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:183) - 	 >> Load definition name=baseStaffDao
[DEBUG] 2018-01-12 16:20:39,053 org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:163) - Found IocObject(baseStaffDao) in AnnotationIocLoader(packages=[cn.wizzer, com.java])
[DEBUG] 2018-01-12 16:20:39,054 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:215) - 	 >> Make...'baseStaffDao'<class com.java.onlineqs.base.dao.StaffDao>
[DEBUG] 2018-01-12 16:20:39,054 org.nutz.ioc.impl.ScopeContext.save(ScopeContext.java:64) - Save object 'baseStaffDao' to [app] 
[DEBUG] 2018-01-12 16:20:39,054 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:157) - Get 'dao'<>
[DEBUG] 2018-01-12 16:20:39,055 cn.wizzer.app.web.commons.plugin.PluginAopConfigure.getInterceptorPairList(PluginAopConfigure.java:33) - skip -- com.java.onlineqs.base.dao.StaffDao
[DEBUG] 2018-01-12 16:20:39,055 org.nutz.ioc.aop.impl.DefaultMirrorFactory.getMirror(DefaultMirrorFactory.java:70) - Load class com.java.onlineqs.base.dao.StaffDao without AOP
[DEBUG] 2018-01-12 16:20:39,056 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:157) - Get 'dao'<>
[DEBUG] 2018-01-12 16:20:39,065 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:157) - Get 'windowService'<class com.java.onlineqs.base.service.WindowService>
[DEBUG] 2018-01-12 16:20:39,065 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:183) - 	 >> Load definition name=windowService
[DEBUG] 2018-01-12 16:20:39,066 org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:163) - Found IocObject(windowService) in AnnotationIocLoader(packages=[cn.wizzer, com.java])
[DEBUG] 2018-01-12 16:20:39,066 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:215) - 	 >> Make...'windowService'<class com.java.onlineqs.base.service.WindowService>
[DEBUG] 2018-01-12 16:20:39,067 org.nutz.ioc.impl.ScopeContext.save(ScopeContext.java:64) - Save object 'windowService' to [app] 
[DEBUG] 2018-01-12 16:20:39,067 cn.wizzer.app.web.commons.plugin.PluginAopConfigure.getInterceptorPairList(PluginAopConfigure.java:33) - skip -- com.java.onlineqs.base.service.WindowService
[DEBUG] 2018-01-12 16:20:39,068 org.nutz.ioc.aop.impl.DefaultMirrorFactory.getMirror(DefaultMirrorFactory.java:70) - Load class com.java.onlineqs.base.service.WindowService without AOP
[DEBUG] 2018-01-12 16:20:39,068 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:157) - Get 'serviceIoc'<>
[DEBUG] 2018-01-12 16:20:39,070 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:157) - Get 'xWindowService'<class com.java.onlineqs.xzfwzx.service.XWindowService>
[DEBUG] 2018-01-12 16:20:39,071 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:183) - 	 >> Load definition name=xWindowService
[DEBUG] 2018-01-12 16:20:39,071 org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:163) - Found IocObject(xWindowService) in AnnotationIocLoader(packages=[cn.wizzer, com.java])
[DEBUG] 2018-01-12 16:20:39,071 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:215) - 	 >> Make...'xWindowService'<class com.java.onlineqs.xzfwzx.service.XWindowService>
[DEBUG] 2018-01-12 16:20:39,072 org.nutz.ioc.impl.ScopeContext.save(ScopeContext.java:64) - Save object 'xWindowService' to [app] 
[DEBUG] 2018-01-12 16:20:39,072 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:157) - Get 'dao'<>
[DEBUG] 2018-01-12 16:20:39,072 cn.wizzer.app.web.commons.plugin.PluginAopConfigure.getInterceptorPairList(PluginAopConfigure.java:33) - skip -- com.java.onlineqs.xzfwzx.service.XWindowService
[DEBUG] 2018-01-12 16:20:39,073 org.nutz.ioc.aop.impl.DefaultMirrorFactory.getMirror(DefaultMirrorFactory.java:70) - Load class com.java.onlineqs.xzfwzx.service.XWindowService without AOP
[DEBUG] 2018-01-12 16:20:39,075 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:157) - Get 'dao'<>
[DEBUG] 2018-01-12 16:20:39,104 org.nutz.service.EntityService.<init>(EntityService.java:41) - Get TypeParams for self : com.java.onlineqs.base.models.po.Window
[DEBUG] 2018-01-12 16:20:39,108 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:157) - Get 'xStaffDao'<class com.java.onlineqs.xzfwzx.dao.XStaffDao>
[DEBUG] 2018-01-12 16:20:39,109 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:183) - 	 >> Load definition name=xStaffDao
[DEBUG] 2018-01-12 16:20:39,109 org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:163) - Found IocObject(xStaffDao) in AnnotationIocLoader(packages=[cn.wizzer, com.java])
[DEBUG] 2018-01-12 16:20:39,109 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:215) - 	 >> Make...'xStaffDao'<class com.java.onlineqs.xzfwzx.dao.XStaffDao>
[DEBUG] 2018-01-12 16:20:39,110 org.nutz.ioc.impl.ScopeContext.save(ScopeContext.java:64) - Save object 'xStaffDao' to [app] 
[DEBUG] 2018-01-12 16:20:39,110 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:157) - Get 'dao'<>
[DEBUG] 2018-01-12 16:20:39,110 cn.wizzer.app.web.commons.plugin.PluginAopConfigure.getInterceptorPairList(PluginAopConfigure.java:33) - skip -- com.java.onlineqs.xzfwzx.dao.XStaffDao
[DEBUG] 2018-01-12 16:20:39,111 org.nutz.ioc.aop.impl.DefaultMirrorFactory.getMirror(DefaultMirrorFactory.java:70) - Load class com.java.onlineqs.xzfwzx.dao.XStaffDao without AOP
[DEBUG] 2018-01-12 16:20:39,112 org.nutz.ioc.impl.ScopeContext.remove(ScopeContext.java:84) - Remove object 'xStaffDao' from [app] 
[DEBUG] 2018-01-12 16:20:39,112 org.nutz.ioc.impl.ScopeContext.remove(ScopeContext.java:84) - Remove object 'xWindowService' from [app] 
[DEBUG] 2018-01-12 16:20:39,113 org.nutz.ioc.impl.ScopeContext.remove(ScopeContext.java:84) - Remove object 'windowService' from [app] 
[DEBUG] 2018-01-12 16:20:39,113 org.nutz.ioc.impl.ScopeContext.remove(ScopeContext.java:84) - Remove object 'xQueueController' from [app] 
[DEBUG] 2018-01-12 16:20:39,113 cn.wizzer.app.web.commons.processor.LogTimeProcessor.process(LogTimeProcessor.java:26) - [POST]URI=/onlineqs/base/queue/getAllRecord 509ms
[WARN ] 2018-01-12 16:20:39,115 org.nutz.mvc.impl.processor.FailProcessor.process(FailProcessor.java:28) - Error@/base/queue/getAllRecord :
org.nutz.ioc.IocException: IocBean[xQueueController] throw Exception when creating
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:150)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:216)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:245)
	at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:116)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.EncodingProcessor.process(EncodingProcessor.java:27)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.UpdateRequestAttributesProcessor.process(UpdateRequestAttributesProcessor.java:15)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at cn.wizzer.app.web.commons.processor.GlobalsSettingProcessor.process(GlobalsSettingProcessor.java:36)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at cn.wizzer.app.web.commons.processor.LogTimeProcessor.process(LogTimeProcessor.java:21)
	at org.nutz.mvc.impl.NutActionChain.doChain(NutActionChain.java:44)
	at org.nutz.mvc.impl.ActionInvoker.invoke(ActionInvoker.java:67)
	at org.nutz.mvc.ActionHandler.handle(ActionHandler.java:31)
	at org.nutz.mvc.NutFilter.doFilter(NutFilter.java:202)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
	at cn.wizzer.app.web.commons.filter.RouteFilter.doFilter(RouteFilter.java:31)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61)
	at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
	at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
	at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
	at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
	at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
	at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
	at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
	at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
	at org.nutz.mvc.WhaleFilter.doFilter(WhaleFilter.java:159)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:94)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:502)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1132)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1539)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1495)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException: IocBean[xQueueController] fail at field=[windowService]
	at org.nutz.ioc.weaver.FieldInjector.inject(FieldInjector.java:40)
	at org.nutz.ioc.weaver.DefaultWeaver.fill(DefaultWeaver.java:56)
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:136)
	... 53 more
Caused by: org.nutz.ioc.IocException: IocBean[windowService] throw Exception when creating
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:150)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:216)
	at org.nutz.ioc.val.ReferTypeValue.get(ReferTypeValue.java:60)
	at org.nutz.ioc.weaver.FieldInjector.inject(FieldInjector.java:32)
	... 55 more
Caused by: org.nutz.lang.InvokingException: Fail to invoke [com.java.onlineqs.base.ioc.ServiceIoc].getWindowService() by args:
 
For the reason: Fail to born or cast to 'com.java.onlineqs.xzfwzx.dao.XStaffDao'
 by args: [@(org.nutz.dao.impl.NutDao@52950633)]
 because: No suitable Constructor or Factory Method!!
	at org.nutz.lang.Invoking.invoke(Invoking.java:195)
	at org.nutz.lang.Mirror.invoke(Mirror.java:1120)
	at org.nutz.ioc.impl.ObjectMakerImpl$1.born(ObjectMakerImpl.java:78)
	at org.nutz.ioc.weaver.DefaultWeaver.born(DefaultWeaver.java:67)
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:115)
	... 58 more
Caused by: org.nutz.lang.born.BorningException: Fail to born or cast to 'com.java.onlineqs.xzfwzx.dao.XStaffDao'
 by args: [@(org.nutz.dao.impl.NutDao@52950633)]
 because: No suitable Constructor or Factory Method!!
	at org.nutz.lang.Mirror.getBorning(Mirror.java:967)
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:100)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:216)
	at org.nutz.ioc.val.ReferTypeValue.get(ReferTypeValue.java:60)
	at org.nutz.ioc.weaver.FieldInjector.inject(FieldInjector.java:32)
	at org.nutz.ioc.weaver.DefaultWeaver.fill(DefaultWeaver.java:56)
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:136)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:216)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:245)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:151)
	at com.java.onlineqs.base.ioc.ServiceIoc.getWindowService(ServiceIoc.java:81)
	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:497)
	at org.nutz.lang.Invoking$NullArgInvoker.invoke(Invoking.java:77)
	at org.nutz.lang.Invoking.invoke(Invoking.java:192)
	... 62 more
9 回复

默认按类属性名注入的

@IocBean
@At("/base/queue")
public class QueueController extends BaseController {
	@Inject
	protected QueueService queueService;
	@Inject
	protected WindowService windowService;
	@Inject
	protected BusinessService businessService;
	@Inject
	protected VenueService venueService;
	@Inject
	protected QueueTimeService queueTimeService;

@IocBean
@At("/base/queue")
public class XQueueController extends QueueController {
	
	@Inject
	XQueueService queueService;
	
}
@IocBean(args = { "refer:dao" },name="baseWindowService")
public class WindowService extends BaseService<Window>{
	
	@Inject
	protected QueueDao queueDao;
    
    @Inject
    protected WindowDao windowDao;
    
    @Inject
    protected StaffDao staffDao;
    
    @Inject
    protected BusinessService businessService;
    
    public WindowService(Dao dao) {
        super(dao);
    }
@IocBean(args = { "refer:dao" },name = "xWindowService")
public class XWindowService extends WindowService {
	
	@Inject
	private XStaffDao xStaffDao;
	
	@Inject
	private XStaffService xStaffService;
	
	public XWindowService(Dao dao) {
		super(dao);
	}

是这个类 com.java.onlineqs.base.ioc.ServiceIoc

getWindowService 这个方法贴来看看

@IocBean(name = "windowService")
	public WindowService getWindowService() {
		if (ProjectType.isXzfuzx()) { return ioc.get(XWindowService.class); }
		return ioc.get(WindowService.class);
	}
@IocBean(args = { "refer:dao" })
public class StaffDao extends BaseDao<Staff>  {

	public StaffDao(Dao dao) {
		super(dao);
	}
@IocBean(args = { "refer:dao"})
public class XStaffDao extends BaseDao<XStaff> {

	protected XStaffDao(Dao dao) {
		super(dao);
	}

}

必须是public构造方法呢

	protected XStaffDao(Dao dao) {
		super(dao);
	}

可以了,我真是手欠,感谢老神仙

这种写错,很少见的样子😊

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