我的配置:
var ioc = {
dao : {
type : "org.nutz.dao.impl.NutDao",
args : [ {
refer : "dataSource"
} ]
},
dataSource : {
type : "org.apache.tomcat.jdbc.pool.DataSource",
events : {
depose : 'close'
},
fields : {
driverClassName : 'com.mysql.jdbc.Driver',
url : 'jdbc:mysql://localhost:3306/dms2?allowMultiQueries=true&useUnicode=true&characterEncoding=gbk',
username : 'root',
password : '123456',
validationQuery : 'SELECT 1',
testWhileIdle : 'true'
}
},
mailConfig : {
type : "com.vms.util.email.MailConfig",
fields : {
mailType : 'smtp',
mailHost : 'smtp.163.com',
mailPort : '25',
mailFrom : 'hbcdcwsjc@163.com',
mailPwd : '87652029',
isCheck : true
}
},
tmpFilePool : {
type : 'org.nutz.filepool.NutFilePool',
args : [ "~/nutz/blog/upload/tmps", 1000 ]
},
uploadFileContext : {
type : 'org.nutz.mvc.upload.UploadingContext',
singleton : false,
args : [ { refer : 'tmpFilePool' } ],
fields : {
ignoreNull : true,
maxFileSize : 1048576,
nameFilter : '^(.+[.])(gif|jpg|png)$'
}
},
myUpload : {
type : 'org.nutz.mvc.upload.UploadAdaptor',
singleton : false,
args : [ { refer : 'uploadFileContext' } ]
}
}
接口:
/**
* 提交反馈接口
* @param docId 文档ID
* @param fileCatalog 文件catalog
* @param content 内容
* @param tf 反馈文件
* @param err 错误信息
* @return json
*/
@At("/doc/json/saveFeedback")
@POST
@Ok("json")
@AdaptBy(type = UploadAdaptor.class,args = { "ioc:myUpload" })
public NutMap _saveFeedback(@Param("docId") long docId,@Param("fileCatalog") String fileCatalog,@Param("content") String content,@Param("file")TempFile tf,AdaptorErrorContext err){
******
}
抛错信息:
启动时抛错信息:
Error happend during start serivce!
java.lang.NullPointerException
at org.nutz.mvc.impl.Loadings.evalObj(Loadings.java:257)
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:34)
at org.nutz.mvc.impl.UrlMappingImpl.add(UrlMappingImpl.java:46)
at org.nutz.mvc.impl.NutLoading.evalUrlMapping(NutLoading.java:175)
at org.nutz.mvc.impl.NutLoading.load(NutLoading.java:91)
at org.nutz.mvc.ActionHandler.<init>(ActionHandler.java:19)
at org.nutz.mvc.NutFilter.init(NutFilter.java:54)
at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:278)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:259)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:383)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:104)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4650)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5306)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
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)
十月 31, 2016 11:48:15 上午 org.apache.catalina.core.StandardContext filterStart
严重: Exception starting filter nutz
org.nutz.mvc.LoadingException: java.lang.NullPointerException
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:16)
at org.nutz.lang.born.BornContext.doBorn(BornContext.java:60)
at org.nutz.lang.Mirror.born(Mirror.java:923)
at org.nutz.lang.Lang.wrapThrow(Lang.java:157)
at org.nutz.mvc.impl.NutLoading.load(NutLoading.java:109)
at org.nutz.mvc.ActionHandler.<init>(ActionHandler.java:19)
at org.nutz.mvc.NutFilter.init(NutFilter.java:54)
at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:278)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:259)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:383)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:104)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4650)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5306)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
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: java.lang.NullPointerException
at org.nutz.mvc.impl.Loadings.evalObj(Loadings.java:257)
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:34)
at org.nutz.mvc.impl.UrlMappingImpl.add(UrlMappingImpl.java:46)
at org.nutz.mvc.impl.NutLoading.evalUrlMapping(NutLoading.java:175)
at org.nutz.mvc.impl.NutLoading.load(NutLoading.java:91)
... 15 more