public class InitSetup implements Setup {
private Ioc ioc;
@Override
public void init(NutConfig config) {
ioc = null;
Dao dao = config.getIoc().get(Dao.class);
for (Class<?> klass : Scans.me().scanPackage("net.wendal.nutzbook")) {
if(null != klass.getAnnotation(Table.class))
{
dao.create(klass,false);//查询表是否存在,存在就不重新建表
}
UserService userService = ioc.get(UserService.class);
userService.addUser("sddssd", "ssddsds");
}
}
@Override
public void destroy(NutConfig nc) {
// TODO Auto-generated method stub
}
}
8-07-12 21:12:17.108 DEBUG [localhost-startStop-1] select expert : org.nutz.dao.impl.jdbc.sqlserver2005.Sqlserver2005JdbcExpert
18-07-12 21:12:17.118 DEBUG [localhost-startStop-1] JDBC Driver --> 4.0.4621.201
18-07-12 21:12:17.119 DEBUG [localhost-startStop-1] JDBC Name --> Microsoft JDBC Driver 4.0 for SQL Server
18-07-12 21:12:17.119 DEBUG [localhost-startStop-1] JDBC URL --> jdbc:sqlserver://127.0.0.1:1433;authenticationScheme=nativeAuthentication;xopenStates=false;sendTimeAsDatetime=true;trustServerCertificate=false;sendStringParametersAsUnicode=true;selectMethod=direct;responseBuffering=adaptive;packetSize=8000;multiSubnetFailover=false;loginTimeout=15;lockTimeout=-1;lastUpdateCount=true;encrypt=false;disableStatementPooling=true;databaseName=Nutz;applicationName=Microsoft JDBC Driver for SQL Server;applicationIntent=readwrite;
18-07-12 21:12:17.119 DEBUG [localhost-startStop-1] Database info --> SQLSERVER:[Microsoft SQL Server - 10.50.1600]
18-07-12 21:12:17.126 DEBUG [localhost-startStop-1] Found 10 resource by src( net/wendal/nutzbook/ ) , regex( ^.+[.]class$ )
18-07-12 21:12:17.127 ERROR [localhost-startStop-1] Error happend during start serivce!
java.lang.NullPointerException
at net.wendal.nutzbook.InitSetup.init(InitSetup.java:30)
at org.nutz.mvc.impl.NutLoading.evalSetup(NutLoading.java:278)
at org.nutz.mvc.impl.NutLoading.load(NutLoading.java:121)
at org.nutz.mvc.ActionHandler.<init>(ActionHandler.java:19)
at org.nutz.mvc.NutFilter._init(NutFilter.java:91)
at org.nutz.mvc.NutFilter.init(NutFilter.java:69)
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:4958)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5652)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1571)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1561)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
18-07-12 21:12:17.127 ERROR [localhost-startStop-1] try to depose ioc
18-07-12 21:12:17.128 INFO [localhost-startStop-1] org.nutz.ioc.impl.NutIoc@1256584083 is closing. startup date [18-07-12 21:12:16.070]
18-07-12 21:12:17.128 DEBUG [localhost-startStop-1] Depose object 'dao' ...
18-07-12 21:12:17.128 DEBUG [localhost-startStop-1] Depose object 'dataSource' ...
18-07-12 21:12:17.129 INFO [localhost-startStop-1] org.nutz.ioc.impl.NutIoc@1256584083 is deposed. startup date [18-07-12 21:12:16.070]
七月 12, 2018 9:12:17 下午 org.apache.catalina.core.StandardContext filterStart
严重: Exception starting filter nutz
org.nutz.mvc.LoadingException: java.lang.NullPointerException
at org.nutz.mvc.LoadingException$FC$7fbf041f2080c9b836f5c41db56b936b.invoke(LoadingException.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:1022)
at org.nutz.lang.Lang.wrapThrow(Lang.java:203)
at org.nutz.mvc.impl.NutLoading.load(NutLoading.java:135)
at org.nutz.mvc.ActionHandler.<init>(ActionHandler.java:19)
at org.nutz.mvc.NutFilter._init(NutFilter.java:91)
at org.nutz.mvc.NutFilter.init(NutFilter.java:69)
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:4958)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5652)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1571)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1561)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NullPointerException
at net.wendal.nutzbook.InitSetup.init(InitSetup.java:30)
at org.nutz.mvc.impl.NutLoading.evalSetup(NutLoading.java:278)
at org.nutz.mvc.impl.NutLoading.load(NutLoading.java:121)
... 15 more