NutzCN Logo
问答 For the elements in Collection java.util.LinkedList, castors don't know which one is the key field.
发布于 144天前 作者 wx_5ua8grspmnpc6s99pfjd 197 次浏览 复制 上一个帖子 下一个帖子
标签:

报错日志:

  For example:> "select user.username as userName,data.enterprise_name as enterpriseName,user.id as userId,data.id as dataId,data.corporate_name as corporateName,data.corporate_phone as corporatePhone,data.license_address as licenseAddress,data.sign_time as signTime,data.sign_money as signMoney,data.location_detail as locationDetail,data.corporation_introduce as corporationIntroduce,data.linkman_name as linkmanName,data.linkman_phone as linkmanPhone,data.corporation_email as corporationEmail,data.sign_time as signTime,user.approve_state as approveState,(select name from sys_dict where code = data.enterprise_nature  and parentId=(select id from sys_dict where code='corporationNature')) as corporationNature,(select name from sys_dict where code = data.corporation_scale and parentId=(select id from sys_dict where code='corporationScale')) as corporationScale,(select name from sys_dict where code = data.sign_channel and parentId=(select id from sys_dict where code='signChannel')) as signChannel from (select * from aotu_user where id='12') user left join aotu_enterprise data  on user.data_id=data.id"
[DEBUG] 2020-03-23 15:35:41,789 cn.wizzer.common.processor.LogTimeProcessor.process(LogTimeProcessor.java:26) - [GET ]URI=/aotuzhaopin/web/enterprise/showexamine 129ms
[WARN ] 2020-03-23 15:35:41,790 org.nutz.mvc.impl.processor.FailProcessor.process(FailProcessor.java:28) - Error@/web/enterprise/showexamine :
org.nutz.castor.FailToCastObjectException: For the elements in Collection java.util.LinkedList, castors don't know which one is the key field.
	at org.nutz.castor.FailToCastObjectException$FC$ab706b0cf40b3b24094a0af312e173b9.invoke(FailToCastObjectException.java)
	at org.nutz.lang.born.AbstractConstructorBorning.call(AbstractConstructorBorning.java:25)
	at org.nutz.lang.born.ConstructorBorning.born(ConstructorBorning.java:19)
	at org.nutz.lang.born.BornContext.doBorn(BornContext.java:60)
	at org.nutz.lang.Mirror.born(Mirror.java:990)
	at org.nutz.lang.Lang.makeThrow(Lang.java:152)
	at org.nutz.castor.castor.Collection2Map.cast(Collection2Map.java:17)
	at org.nutz.castor.castor.Collection2Map.cast(Collection2Map.java:10)
	at org.nutz.castor.Castors.cast(Castors.java:252)
	at org.nutz.castor.Castors.castTo(Castors.java:316)
	at org.nutz.dao.impl.sql.NutStatement.getObject(NutStatement.java:131)
	at cn.aotu.zhaopin.service.EnterpriseService.getData(EnterpriseService.java:82)
	at cn.aotu.zhaopin.controller.EnterpriseController.showexamine(EnterpriseController.java:81)
	at cn.aotu.zhaopin.controller.EnterpriseController$FM$showexamine$8ca68ff379736e775d8f0116d4dbb445.invoke(EnterpriseController.java)
	at org.nutz.mvc.impl.processor.MethodInvokeProcessor.process(MethodInvokeProcessor.java:31)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.AdaptorProcessor.process(AdaptorProcessor.java:33)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.ActionFiltersProcessor.process(ActionFiltersProcessor.java:58)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at cn.wizzer.common.processor.XssSqlFilterProcessor.process(XssSqlFilterProcessor.java:35)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at cn.wizzer.common.processor.NutShiroProcessor.process(NutShiroProcessor.java:52)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:123)
	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.common.processor.GlobalsSettingProcessor.process(GlobalsSettingProcessor.java:37)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at cn.wizzer.common.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:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at cn.wizzer.common.filter.RouteFilter.doFilter(RouteFilter.java:37)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	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:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:660)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:798)
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:808)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498)
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
	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:748)
[DEBUG] 2020-03-23 15:35:51,202 org.quartz.impl.jdbcjobstore.JobStoreSupport$ClusterManager.manage(JobStoreSupport.java:3877) - ClusterManager: Check-in complete.

一样的代码放到别处运行就没事请问这是怎么回事啊?
代码:

public Object getData(String id) {
		Sql sql =  Sqls.fetchRecord("select "
			+ "user.username as userName,data.enterprise_name as enterpriseName,user.id as userId,data.id as dataId,"
			+ "data.corporate_name as corporateName,data.corporate_phone as corporatePhone,"
			+ "data.license_address as licenseAddress,data.sign_time as signTime,data.sign_money as signMoney,"
			+ "data.location_detail as locationDetail,data.corporation_introduce as corporationIntroduce,"
			+ "data.linkman_name as linkmanName,data.linkman_phone as linkmanPhone,data.corporation_email as corporationEmail,"
			+ "data.sign_time as signTime,user.approve_state as approveState,"
			+ "(select name from sys_dict where code = data.enterprise_nature  and parentId=(select id from sys_dict where code='corporationNature')) as corporationNature,"
			+ "(select name from sys_dict where code = data.corporation_scale and parentId=(select id from sys_dict where code='corporationScale')) as corporationScale,"
			+ "(select name from sys_dict where code = data.sign_channel and parentId=(select id from sys_dict where code='signChannel')) as signChannel "
			+ "from (select * from aotu_user where id=@id) user left join aotu_enterprise data  on user.data_id=data.id").setParam("id", id);
		sql.setCallback(Sqls.callback.maps());
		dao().execute(sql);
		return sql.getObject(NutMap.class);
	}
3 回复

神奇的是 只要一运行这个代码 其他没有错误的类似代码也会报错

Sqls.callback.maps() 得到的是 List<NutMap>, 取getObject就不对了

谢谢您 问题解决了就是这儿的事

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