NutzCN Logo
问答 上传文件添加了At注解后,tomcat启动错误
发布于 3084天前 作者 忧郁深蓝 1918 次浏览 复制 上一个帖子 下一个帖子
标签:

myupload配置文件

tmpFilePool : {
            type : 'org.nutz.filepool.NutFilePool',
            // 临时文件最大个数为 1000 个
            args : [ "/home/jyjf/tmpfiles", 100 ]   
        },
        uploadFileContext : {
            type : 'org.nutz.mvc.upload.UploadingContext',
            singleton : false,
            args : [ { refer : 'tmpFilePool' } ],
            fields : {
                // 是否忽略空文件, 默认为 false
                ignoreNull : true,
                // 单个文件最大尺寸(大约的值,单位为字节,即 1048576 为 1M)
                maxFileSize : 10485760,
                // 正则表达式匹配可以支持的文件名
                nameFilter : '^(.+[.])(gif|jpg|png)$' 
            } 
        },
        myUpload : {
            type : 'org.nutz.mvc.upload.UploadAdaptor',
            singleton : false,
            args : [ { refer : 'uploadFileContext' } ] 
        }

MODULE代码

@IocBean
@At("/upload")
public class Upload {
	@At("/")
	@Ok("json")
	@AdaptBy(type = UploadAdaptor.class, args = { "ioc:myUpload" })
	public Object upload(@Param("nid") Long nid,@Param("type")String type,@Param("file") TempFile[] tfs) {
		System.out.println();
		return null;
	}
}

异常信息

2016-06-06 17:48:59,467 org.nutz.mvc.impl.NutLoading.load(NutLoading.java:124) ERROR - Error happend during start serivce!
org.nutz.ioc.IocException: [myUpload] # For object [myUpload] - type:[class org.nutz.mvc.upload.UploadAdaptor]
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:217)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:235)
	at org.nutz.mvc.impl.Loadings.evalObj(Loadings.java:320)
	at org.nutz.mvc.impl.processor.AbstractProcessor.evalObj(AbstractProcessor.java:48)
	at org.nutz.mvc.impl.processor.AdaptorProcessor.evalHttpAdaptor(AdaptorProcessor.java:37)
	at org.nutz.mvc.impl.processor.AdaptorProcessor.init(AdaptorProcessor.java:23)
	at org.nutz.mvc.impl.NutActionChainMaker.eval(NutActionChainMaker.java:38)
	at org.nutz.mvc.impl.UrlMappingImpl.add(UrlMappingImpl.java:47)
	at org.nutz.mvc.impl.NutLoading.evalUrlMapping(NutLoading.java:203)
	at org.nutz.mvc.impl.NutLoading.load(NutLoading.java:107)
	at org.nutz.mvc.ActionHandler.<init>(ActionHandler.java:19)
	at org.nutz.mvc.NutFilter._init(NutFilter.java:87)
	at org.nutz.mvc.NutFilter.init(NutFilter.java:65)
	at com.jyjf.common.filter.UserFilter.init(UserFilter.java:65)
	at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279)
	at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260)
	at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105)
	at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4841)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5535)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
	at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1263)
	at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1978)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:745)
Caused by: org.nutz.ioc.ObjectLoadException: Object 'myUpload' without define!
	at org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:166)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:181)
	... 29 more
2016-06-06 17:48:59,470 org.nutz.mvc.impl.NutLoading.load(NutLoading.java:126) ERROR - try to depose ioc
2016-06-06 17:48:59,474 org.nutz.ioc.impl.NutIoc.depose(NutIoc.java:251) INFO  - org.nutz.ioc.impl.NutIoc@114638052 is closing. startup date [16-06-06 17:48:58.559]
2016-06-06 17:48:59,475 org.nutz.ioc.impl.NutIoc.depose(NutIoc.java:255) INFO  - org.nutz.ioc.impl.NutIoc@114638052 is deposed. startup date [16-06-06 17:48:58.559]
六月 06, 2016 5:48:59 下午 org.apache.catalina.core.StandardContext filterStart
严重: Exception starting filter nutz
org.nutz.mvc.LoadingException: org.nutz.ioc.IocException: [myUpload] # For object [myUpload] - type:[class org.nutz.mvc.upload.UploadAdaptor]
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
	at org.nutz.lang.born.ConstructorBorning.born(ConstructorBorning.java:17)
	at org.nutz.lang.born.BornContext.doBorn(BornContext.java:60)
	at org.nutz.lang.Mirror.born(Mirror.java:990)
	at org.nutz.lang.Lang.wrapThrow(Lang.java:169)
	at org.nutz.mvc.impl.NutLoading.load(NutLoading.java:134)
	at org.nutz.mvc.ActionHandler.<init>(ActionHandler.java:19)
	at org.nutz.mvc.NutFilter._init(NutFilter.java:87)
	at org.nutz.mvc.NutFilter.init(NutFilter.java:65)
	at com.jyjf.common.filter.UserFilter.init(UserFilter.java:65)
	at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279)
	at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260)
	at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105)
	at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4841)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5535)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
	at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1263)
	at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1978)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:745)
Caused by: org.nutz.ioc.IocException: [myUpload] # For object [myUpload] - type:[class org.nutz.mvc.upload.UploadAdaptor]
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:217)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:235)
	at org.nutz.mvc.impl.Loadings.evalObj(Loadings.java:320)
	at org.nutz.mvc.impl.processor.AbstractProcessor.evalObj(AbstractProcessor.java:48)
	at org.nutz.mvc.impl.processor.AdaptorProcessor.evalHttpAdaptor(AdaptorProcessor.java:37)
	at org.nutz.mvc.impl.processor.AdaptorProcessor.init(AdaptorProcessor.java:23)
	at org.nutz.mvc.impl.NutActionChainMaker.eval(NutActionChainMaker.java:38)
	at org.nutz.mvc.impl.UrlMappingImpl.add(UrlMappingImpl.java:47)
	at org.nutz.mvc.impl.NutLoading.evalUrlMapping(NutLoading.java:203)
	at org.nutz.mvc.impl.NutLoading.load(NutLoading.java:107)
	... 20 more
Caused by: org.nutz.ioc.ObjectLoadException: Object 'myUpload' without define!
	at org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:166)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:181)
	... 29 more

现在的问题是只要把方法的At("/") 去掉,tomcat启动就没有问题.有没有大神来指点一下什么问题

2 回复
Caused by: org.nutz.ioc.ObjectLoadException: Object 'myUpload' without define!

检查IocBy配置,肯定没覆盖定义该myUpload的js文件

找到原因了 因为这个module跟另外一个项目共用了 但是另外一个项目没有配置IOC

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