很诡异的问题,不知是何原因,每次都启动了两个实例的nutz,可以看日志:
2017-11-24 17:16:34 Commons Daemon procrun stdout initialized
2017-11-24 17:16:39,485 INFO 15 - Starting Shiro environment initialization.
2017-11-24 17:16:39,927 INFO 15 - An instance with name 'authc' already exists. Redefining this object as a new instance of type org.nutz.integration.shiro.SimpleAuthenticationFilter
2017-11-24 17:16:40,028 INFO 15 - Shiro environment initialized in 543 ms.
2017-11-24 17:16:40,086 INFO 15 - NutFilter[nutz] starting ...
2017-11-24 17:16:40,706 INFO 15 - Nutz Version : 1.r.60
2017-11-24 17:16:40,707 INFO 15 - Nutz.Mvc[nutz] is initializing ...
2017-11-24 17:16:41,262 INFO 15 - Found 27 classes in 1 base-packages!
beans = ["weeklyJob", "loop10SJob", "beforeTradeJob", "stock1", "marketThrendModule", "userModule", "loop1MinJob", "stockModule", "tradeModule", "stock2", "taskModule", "loopBuyJob", "dairyModule", "dailyJob2", "loopSellJob", "userProfileModule", "macdModule", "captchaModule", "rootModule", "dailyJob", "emailService", "userService", "trendService", "logInterceptor", "banKuaiModule", "beetlTemplateModule", "acctModule"]
2017-11-24 17:16:41,270 INFO 15 - NutIoc init begin ...
2017-11-24 17:16:41,273 INFO 15 - ... NutIoc init complete
2017-11-24 17:16:41,278 INFO 15 - Build URL mapping by org.nutz.mvc.impl.UrlMappingImpl ...
2017-11-24 17:16:41,505 INFO 15 - Init file-pool by: C:/tools/apache-tomcat-8.0.44-32/webapps/s2/WEB-INF/tmp/user_avatar [20000]
2017-11-24 17:16:41,508 INFO 15 - file-pool.cursor: 0
2017-11-24 17:16:41,546 WARN 15 - Duplicate @At mapping ? path=/trend/getpolicypatrol
2017-11-24 17:16:41,551 INFO 15 - Found 119 module methods
2017-11-24 17:16:41,557 INFO 15 - SessionBy --> org.nutz.integration.shiro.ShiroSessionProvider@1105516
2017-11-24 17:16:41,557 INFO 15 - Setup application...
2017-11-24 17:16:41,879 INFO 15 - {dataSource-1} inited
2017-11-24 17:16:41,910 INFO 15 - Init file-pool by: C:\Windows\system32\config\systemprofile/.nutz/tmp/dao/ [200000]
2017-11-24 17:16:41,910 INFO 15 - file-pool.cursor: 0
2017-11-24 17:16:41,917 INFO 15 - Get Connection from DataSource for JdbcExpert, if you lock at here, check your database server and configure
2017-11-24 17:16:42,838 INFO 15 - Using default implementation for ThreadExecutor
2017-11-24 17:16:42,859 INFO 15 - Initialized Scheduler Signaller of type: class org.quartz.core.SchedulerSignalerImpl
2017-11-24 17:16:42,860 INFO 15 - Quartz Scheduler v.2.2.3 created.
2017-11-24 17:16:42,861 INFO 15 - RAMJobStore initialized.
2017-11-24 17:16:42,861 INFO 15 - Scheduler meta-data: Quartz Scheduler (v2.2.3) 'NutzbookScheduler' with instanceId 'NON_CLUSTERED'
Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally.
NOT STARTED.
Currently in standby mode.
Number of jobs executed: 0
Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 3 threads.
Using job-store 'org.quartz.simpl.RAMJobStore' - which does not support persistence. and is not clustered.
2017-11-24 17:16:42,861 INFO 15 - Quartz scheduler 'NutzbookScheduler' initialized from default resource file in Quartz package: 'quartz.properties'
2017-11-24 17:16:42,861 INFO 15 - Quartz scheduler version: 2.2.3
2017-11-24 17:16:42,865 INFO 15 - JobFactory set to: org.nutz.integration.quartz.NutQuartzJobFactory@1c65422
2017-11-24 17:16:42,865 INFO 15 - Scheduler NutzbookScheduler_$_NON_CLUSTERED started.
2017-11-24 17:16:42,925 INFO 15 - Nutz.Mvc[nutz] is up in 2217ms
2017-11-24 17:16:46,576 INFO 15 - Starting Shiro environment initialization.
2017-11-24 17:16:46,724 INFO 15 - An instance with name 'authc' already exists. Redefining this object as a new instance of type org.nutz.integration.shiro.SimpleAuthenticationFilter
2017-11-24 17:16:46,817 INFO 15 - Shiro environment initialized in 241 ms.
2017-11-24 17:16:46,857 INFO 15 - NutFilter[nutz] starting ...
2017-11-24 17:16:47,469 INFO 15 - Nutz Version : 1.r.60
2017-11-24 17:16:47,469 INFO 15 - Nutz.Mvc[nutz] is initializing ...
2017-11-24 17:16:47,953 INFO 15 - Found 27 classes in 1 base-packages!
beans = ["weeklyJob", "loop10SJob", "beforeTradeJob", "stock1", "marketThrendModule", "userModule", "loop1MinJob", "stockModule", "tradeModule", "stock2", "taskModule", "loopBuyJob", "dairyModule", "dailyJob2", "loopSellJob", "userProfileModule", "macdModule", "captchaModule", "rootModule", "dailyJob", "emailService", "userService", "trendService", "logInterceptor", "banKuaiModule", "beetlTemplateModule", "acctModule"]
2017-11-24 17:16:47,960 INFO 15 - NutIoc init begin ...
2017-11-24 17:16:47,963 INFO 15 - ... NutIoc init complete
2017-11-24 17:16:47,967 INFO 15 - Build URL mapping by org.nutz.mvc.impl.UrlMappingImpl ...
2017-11-24 17:16:48,195 WARN 15 - Duplicate @At mapping ? path=/trend/getpolicypatrol
2017-11-24 17:16:48,204 INFO 15 - Init file-pool by: C:/tools/apache-tomcat-8.0.44-32/webapps/s2/WEB-INF/tmp/user_avatar [20000]
2017-11-24 17:16:48,207 INFO 15 - file-pool.cursor: 0
2017-11-24 17:16:48,211 INFO 15 - Found 119 module methods
2017-11-24 17:16:48,216 INFO 15 - SessionBy --> org.nutz.integration.shiro.ShiroSessionProvider@8c02cc
2017-11-24 17:16:48,216 INFO 15 - Setup application...
2017-11-24 17:16:48,540 INFO 15 - {dataSource-1} inited
2017-11-24 17:16:48,572 INFO 15 - Init file-pool by: C:\Windows\system32\config\systemprofile/.nutz/tmp/dao/ [200000]
2017-11-24 17:16:48,572 INFO 15 - file-pool.cursor: 0
2017-11-24 17:16:48,582 INFO 15 - Get Connection from DataSource for JdbcExpert, if you lock at here, check your database server and configure
2017-11-24 17:16:49,475 INFO 15 - Using default implementation for ThreadExecutor
2017-11-24 17:16:49,494 INFO 15 - Initialized Scheduler Signaller of type: class org.quartz.core.SchedulerSignalerImpl
2017-11-24 17:16:49,494 INFO 15 - Quartz Scheduler v.2.2.3 created.
2017-11-24 17:16:49,495 INFO 15 - RAMJobStore initialized.
2017-11-24 17:16:49,495 INFO 15 - Scheduler meta-data: Quartz Scheduler (v2.2.3) 'NutzbookScheduler' with instanceId 'NON_CLUSTERED'
Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally.
NOT STARTED.
Currently in standby mode.
Number of jobs executed: 0
Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 3 threads.
Using job-store 'org.quartz.simpl.RAMJobStore' - which does not support persistence. and is not clustered.
2017-11-24 17:16:49,495 INFO 15 - Quartz scheduler 'NutzbookScheduler' initialized from default resource file in Quartz package: 'quartz.properties'
2017-11-24 17:16:49,495 INFO 15 - Quartz scheduler version: 2.2.3
2017-11-24 17:16:49,498 INFO 15 - JobFactory set to: org.nutz.integration.quartz.NutQuartzJobFactory@125fdb0
2017-11-24 17:16:49,498 INFO 15 - Scheduler NutzbookScheduler_$_NON_CLUSTERED started.
2017-11-24 17:16:49,551 INFO 15 - Nutz.Mvc[nutz] is up in 2081ms
之所以发现这个问题,是因为我的quartz执行任务有两个线程同时执行相同任务,日志都是打印双份出来。
所以我只能先把Job任务配置成@DisallowConcurrentExecution 防止并发执行。
但是server一起动的时候,看日志似乎是nutz被重复初始化两次,根本问题还没解决。