NutzCN Logo
问答 文件上传报错,提交到后台
发布于 2641天前 作者 kamier 1763 次浏览 复制 上一个帖子 下一个帖子
标签:

org.nutz.ioc.IocException: org.nutz.lang.born.BorningException: Fail to born 'org.nutz.filepool.NutFilePool'
by args: [
@(null)
@(0)] becasue:
null
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.nutz.lang.born.ConstructorBorning.born(ConstructorBorning.java:16)
at org.nutz.lang.born.BornContext.doBorn(BornContext.java:60)
at org.nutz.lang.Mirror.born(Mirror.java:926)
at org.nutz.lang.Lang.wrapThrow(Lang.java:159)
at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:105)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:181)
at org.nutz.ioc.val.ReferValue.get(ReferValue.java:24)
at org.nutz.ioc.weaver.FieldInjector.inject(FieldInjector.java:23)
at org.nutz.ioc.weaver.DefaultWeaver.fill(DefaultWeaver.java:56)
at org.nutz.ioc.ObjectProxy.get(ObjectProxy.java:63)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:194)
at org.nutz.ioc.val.ReferValue.get(ReferValue.java:24)
at org.nutz.ioc.weaver.FieldInjector.inject(FieldInjector.java:23)
at org.nutz.ioc.weaver.DefaultWeaver.fill(DefaultWeaver.java:56)
at org.nutz.ioc.ObjectProxy.get(ObjectProxy.java:63)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:194)
at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:72)
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.NutActionChain.doChain(NutActionChain.java:40)
at org.nutz.mvc.impl.ActionInvoker.invoke(ActionInvoker.java:64)
at org.nutz.mvc.ActionHandler.handle(ActionHandler.java:31)
at org.nutz.mvc.NutFilter.doFilter(NutFilter.java:88)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1001)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: org.nutz.lang.born.BorningException: Fail to born 'org.nutz.filepool.NutFilePool'
by args: [
@(null)
@(0)] becasue:
null
at org.nutz.lang.born.ConstructorCastingBorning.born(ConstructorCastingBorning.java:24)
at org.nutz.ioc.weaver.DefaultWeaver.born(DefaultWeaver.java:67)
at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:76)
... 36 more
Caused by: java.lang.NullPointerException
at java.io.File.(File.java:222)
at org.nutz.lang.Files.createDirIfNoExists(Files.java:385)
at org.nutz.filepool.NutFilePool.(NutFilePool.java:27)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.nutz.lang.born.ConstructorCastingBorning.born(ConstructorCastingBorning.java:21)
... 38 more

12 回复

用 "插入代码或日志片段" 按钮重新贴一次

org.nutz.ioc.IocException: org.nutz.lang.born.BorningException: Fail to born 'org.nutz.filepool.NutFilePool'
 by args: [
  @(null)
  @(0)] becasue:
null
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
	at org.nutz.lang.born.ConstructorBorning.born(ConstructorBorning.java:16)
	at org.nutz.lang.born.BornContext.doBorn(BornContext.java:60)
	at org.nutz.lang.Mirror.born(Mirror.java:926)
	at org.nutz.lang.Lang.wrapThrow(Lang.java:159)
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:105)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:181)
	at org.nutz.ioc.val.ReferValue.get(ReferValue.java:24)
	at org.nutz.ioc.weaver.FieldInjector.inject(FieldInjector.java:23)
	at org.nutz.ioc.weaver.DefaultWeaver.fill(DefaultWeaver.java:56)
	at org.nutz.ioc.ObjectProxy.get(ObjectProxy.java:63)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:194)
	at org.nutz.ioc.val.ReferValue.get(ReferValue.java:24)
	at org.nutz.ioc.weaver.FieldInjector.inject(FieldInjector.java:23)
	at org.nutz.ioc.weaver.DefaultWeaver.fill(DefaultWeaver.java:56)
	at org.nutz.ioc.ObjectProxy.get(ObjectProxy.java:63)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:194)
	at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:72)
	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.NutActionChain.doChain(NutActionChain.java:40)
	at org.nutz.mvc.impl.ActionInvoker.invoke(ActionInvoker.java:64)
	at org.nutz.mvc.ActionHandler.handle(ActionHandler.java:31)
	at org.nutz.mvc.NutFilter.doFilter(NutFilter.java:88)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1001)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:662)
Caused by: org.nutz.lang.born.BorningException: Fail to born 'org.nutz.filepool.NutFilePool'
 by args: [
  @(null)
  @(0)] becasue:
null
	at org.nutz.lang.born.ConstructorCastingBorning.born(ConstructorCastingBorning.java:24)
	at org.nutz.ioc.weaver.DefaultWeaver.born(DefaultWeaver.java:67)
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:76)
	... 36 more
Caused by: java.lang.NullPointerException
	at java.io.File.<init>(File.java:222)
	at org.nutz.lang.Files.createDirIfNoExists(Files.java:385)
	at org.nutz.filepool.NutFilePool.<init>(NutFilePool.java:27)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
	at org.nutz.lang.born.ConstructorCastingBorning.born(ConstructorCastingBorning.java:21)
	... 38 more

@wendal

入口方法贴一下

	@At("/apply")
	@Ok("json")
	@AdaptBy(type = UploadAdaptor.class, args = { "ioc:taskUA" })
	@Override
	public Object save(ApplyTaskEntity task, TempFile[] tmpFiles) {
		try {
			as.add(task);
			return new Responze(Codes.SUCCESS, "提交申请成功");
		} catch (Exception e) {
			return new Responze(Codes.FAILED, "提交申请成功");
		}
	}

@wendal

ioc:taskUA

贴taskUA的ioc定义

	taskUA : {
		type : 'org.nutz.mvc.upload.UploadAdaptor',
		singleton : false,
		args : [ {
			refer : 'taskAtta'
		} ]
	}

@wendal

taskAtta有是啥? 继续贴

var upload = {
	tmpFilePool : {
		type : 'org.nutz.filepool.NutFilePool',
		// 临时文件最大个数为 1000 个
		args : [ {java : "$comnPrpt.get('temp_file_path')"}, 1000 ]
	},
	pledgeInfoFile : {
		type : 'org.nutz.mvc.upload.UploadingContext',
		singleton : false,
		args : [ {
			refer : 'tmpFilePool'
		} ],
		fields : {
			// 是否忽略空文件, 默认为 false
			ignoreNull : true,
			// 单个文件最大尺寸(大约的值,单位为字节,即 1048576 为 1M)
			maxFileSize : 10485760,
			// 正则表达式匹配可以支持的文件名
			nameFilter : '^(.+[.])(xls|xlsx)$'
		}
	},
	pledgeUploader : {
		type : 'org.nutz.mvc.upload.UploadAdaptor',
		singleton : false,
		args : [ {
			refer : 'pledgeInfoFile'
		} ]
	},
	
	checkFile : {
		type : 'org.nutz.mvc.upload.UploadingContext',
		singleton : false,
		args : [ {
			refer : 'tmpFilePool'
		} ],
		fields : {
			// 是否忽略空文件, 默认为 false
			ignoreNull : true,
			// 单个文件最大尺寸(大约的值,单位为字节,即 1048576 为 1M)
			maxFileSize : 10485760,
			// 正则表达式匹配可以支持的文件名
			nameFilter : '^(.+[.])(ck|txt|del)$'
		}
	},
	checkUploader : {
		type : 'org.nutz.mvc.upload.UploadAdaptor',
		singleton : false,
		args : [ {
			refer : 'checkFile'
		} ]
	},
	
	taskAtta : {
		type : 'org.nutz.mvc.upload.UploadingContext',
		singleton : false,
		args : [ {
			refer : 'tmpFilePool'
		} ],
		fields : {
			// 是否忽略空文件, 默认为 false
			ignoreNull : true,
			// 单个文件最大尺寸(大约的值,单位为字节,即 1048576 为 1M)
			maxFileSize : 10485760,
			// 正则表达式匹配可以支持的文件名
			nameFilter : '^(.+[.])(doc|docx|xls|xlsx|jpg|png|jpeg|bmp|txt|del)$'
		}
	},

	taskUA : {
		type : 'org.nutz.mvc.upload.UploadAdaptor',
		singleton : false,
		args : [ {
			refer : 'taskAtta'
		} ]
	}
};

@wendal
都贴出来了

看上去是 $comnPrpt.get('temp_file_path') 返回了null

这日志有点坑,是ioc另外一处filepool异常了。然而日志当中并不能准确报出具体是哪个ioc对象有问题。

获取ioc对象的时候会先打印ioc名字的,他没贴而已

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