NutzCN Logo
问答 nutzboot启动报错,java.lang.NullPointerException。
发布于 2325天前 作者 @yz 4155 次浏览 复制 上一个帖子 下一个帖子
标签:

系统:Ubuntu 16.04.2 LTS (GNU/Linux 4.4.0-85-generic x86_64)
java版本:1.8

项目是通过maven打包,将当前子模块依赖的其他模块一起打包成一个jar文件,然后执行java -jar xxx.jar(注:xxx是文件名)。

错误日志如下:

[DEBUG] 00:19:23.096 org.nutz.resource.Scans.printLocations(Scans.java:527) - Locations count=2 time use 58ms
[DEBUG] 00:19:23.111 org.nutz.resource.Scans.scan(Scans.java:280) - Found 4 resource by src( custom/ ) , regex( ^.+[.]properties$ )
[DEBUG] 00:19:23.111 org.nutz.ioc.impl.PropertiesProxy.setPaths(PropertiesProxy.java:114) - load properties from jar:file:/usr/local/tzd-backend/tzd-backend-0.0.1-SNAPSHOT-jar-with-dependencies.jar!/custom/j2cache.properties
[DEBUG] 00:19:23.114 org.nutz.ioc.impl.PropertiesProxy.setPaths(PropertiesProxy.java:114) - load properties from jar:file:/usr/local/tzd-backend/tzd-backend-0.0.1-SNAPSHOT-jar-with-dependencies.jar!/custom/redis.properties
[DEBUG] 00:19:23.114 org.nutz.ioc.impl.PropertiesProxy.setPaths(PropertiesProxy.java:114) - load properties from jar:file:/usr/local/tzd-backend/tzd-backend-0.0.1-SNAPSHOT-jar-with-dependencies.jar!/custom/shiro.properties
[DEBUG] 00:19:23.118 org.nutz.ioc.impl.PropertiesProxy.setPaths(PropertiesProxy.java:114) - load properties from jar:file:/usr/local/tzd-backend/tzd-backend-0.0.1-SNAPSHOT-jar-with-dependencies.jar!/custom/emtry.properties
[DEBUG] 00:19:23.122 org.nutz.boot.config.impl.PropertiesConfigureLoader.readPropertiesPath(PropertiesConfigureLoader.java:128) - Loading Properties  - application.properties
[DEBUG] 00:19:23.217 org.nutz.resource.Scans.scan(Scans.java:280) - Found 3 resource by src( ioc/ ) , regex( ^(.+[.])(js|json)$ )
[DEBUG] 00:19:23.219 org.nutz.ioc.loader.json.JsonLoader.<init>(JsonLoader.java:49) - loading [dataCache.js]
[DEBUG] 00:19:23.221 org.nutz.ioc.loader.json.JsonLoader.<init>(JsonLoader.java:49) - loading [dataSource.js]
[DEBUG] 00:19:23.229 org.nutz.ioc.loader.json.JsonLoader.<init>(JsonLoader.java:49) - loading [emtry.json]
[DEBUG] 00:19:23.230 org.nutz.ioc.loader.json.JsonLoader.<init>(JsonLoader.java:57) - Loaded 12 bean define from path=[ioc/] --> [system_jedis_pooler, tzd_sys_dataSource, jedis_pool_config, cm_dao, shopping_dataSource, shopping_dao, acl_dao, acl_dataSource, sysConf, tzd_sys_dao, jedis_config, cm_dataSource]
[DEBUG] 00:19:23.325 org.nutz.castor.Castors.reload(Castors.java:116) - Using 101 castor for Castors
[DEBUG] 00:19:23.345 org.nutz.ioc.aop.SimpleAopMaker.<init>(SimpleAopMaker.java:79) - Load AopConfigure for anno=org.nutz.aop.interceptor.async.Async by type=org.nutz.aop.interceptor.async.AsyncAopIocLoader
[INFO ] 00:19:23.354 org.nutz.ioc.loader.annotation.AnnotationIocLoader.<init>(AnnotationIocLoader.java:51) -  > scan 'com.tzding.tzd'
[DEBUG] 00:19:23.432 org.nutz.resource.Scans.scan(Scans.java:280) - Found 256 resource by src( com/tzding/tzd/ ) , regex( ^.+[.]class$ )
[INFO ] 00:19:23.589 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'cmLogic                                 ' - com.tzding.tzd.backend.logic.cmarket.CmLogic
[INFO ] 00:19:23.595 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'designManufactureLogic                  ' - com.tzding.tzd.backend.logic.customize.DesignManufactureLogic
[INFO ] 00:19:23.597 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'pGDesignEffectLogic                     ' - com.tzding.tzd.backend.logic.customize.PGDesignEffectLogic
[INFO ] 00:19:23.598 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'shoppingOrderStatistics                 ' - com.tzding.tzd.backend.logic.entity.shopping.ShoppingOrderStatistics
[INFO ] 00:19:23.598 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'couponLogic                             ' - com.tzding.tzd.backend.logic.payment.CouponLogic
[INFO ] 00:19:23.600 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'couponStrategyLogic                     ' - com.tzding.tzd.backend.logic.payment.CouponStrategyLogic
[INFO ] 00:19:23.600 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'paymentLogic                            ' - com.tzding.tzd.backend.logic.payment.PaymentLogic
[INFO ] 00:19:23.602 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'brandLogic                              ' - com.tzding.tzd.backend.logic.product.BrandLogic
[INFO ] 00:19:23.608 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'categoryLogic                           ' - com.tzding.tzd.backend.logic.product.CategoryLogic
[INFO ] 00:19:23.609 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'productGroupLogic                       ' - com.tzding.tzd.backend.logic.product.ProductGroupLogic
[INFO ] 00:19:23.610 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'productGroupSpecLogic                   ' - com.tzding.tzd.backend.logic.product.ProductGroupSpecLogic
[INFO ] 00:19:23.613 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'productImageLogic                       ' - com.tzding.tzd.backend.logic.product.ProductImageLogic
[INFO ] 00:19:23.614 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'productLogic                            ' - com.tzding.tzd.backend.logic.product.ProductLogic
[INFO ] 00:19:23.616 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'invoiceInfoLogic                        ' - com.tzding.tzd.backend.logic.shoppingcart.InvoiceInfoLogic
[INFO ] 00:19:23.617 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'invoiceLogic                            ' - com.tzding.tzd.backend.logic.shoppingcart.InvoiceLogic
[INFO ] 00:19:23.618 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'shippingAddressLogic                    ' - com.tzding.tzd.backend.logic.shoppingcart.ShippingAddressLogic
[INFO ] 00:19:23.620 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'shippingLogic                           ' - com.tzding.tzd.backend.logic.shoppingcart.ShippingLogic
[INFO ] 00:19:23.621 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'shoppingCartLogic                       ' - com.tzding.tzd.backend.logic.shoppingcart.ShoppingCartLogic
[INFO ] 00:19:23.621 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'shoppingOrderLogic                      ' - com.tzding.tzd.backend.logic.shoppingcart.ShoppingOrderLogic
[INFO ] 00:19:23.622 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'cMTemplateFreightLogic                  ' - com.tzding.tzd.backend.logic.template.CMTemplateFreightLogic
[INFO ] 00:19:23.623 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'templateLogic                           ' - com.tzding.tzd.backend.logic.template.TemplateLogic
[INFO ] 00:19:23.624 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'userLogic                               ' - com.tzding.tzd.backend.logic.user.UserLogic
[INFO ] 00:19:23.644 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'cmModule                                ' - com.tzding.tzd.backend.web.cmarket.CmModule
[INFO ] 00:19:23.679 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'pGDesignEffectModule                    ' - com.tzding.tzd.backend.web.cutomsize.PGDesignEffectModule
[INFO ] 00:19:23.682 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'pGDesignManufactureModule               ' - com.tzding.tzd.backend.web.cutomsize.PGDesignManufactureModule
[INFO ] 00:19:23.691 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'couponModule                            ' - com.tzding.tzd.backend.web.payment.CouponModule
[INFO ] 00:19:23.693 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'paymentModule                           ' - com.tzding.tzd.backend.web.payment.PaymentModule
[INFO ] 00:19:23.696 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'brandModule                             ' - com.tzding.tzd.backend.web.product.BrandModule
[INFO ] 00:19:23.701 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'categoryModule                          ' - com.tzding.tzd.backend.web.product.CategoryModule
[INFO ] 00:19:23.705 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'productGroupModule                      ' - com.tzding.tzd.backend.web.product.ProductGroupModule
[INFO ] 00:19:23.709 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'productModule                           ' - com.tzding.tzd.backend.web.product.ProductModule
[INFO ] 00:19:23.717 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'invoiceInfoModule                       ' - com.tzding.tzd.backend.web.shoppingcart.InvoiceInfoModule
[INFO ] 00:19:23.720 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'invoiceModule                           ' - com.tzding.tzd.backend.web.shoppingcart.InvoiceModule
[INFO ] 00:19:23.721 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'shippingAdressModule                    ' - com.tzding.tzd.backend.web.shoppingcart.ShippingAdressModule
[INFO ] 00:19:23.727 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'shippingModule                          ' - com.tzding.tzd.backend.web.shoppingcart.ShippingModule
[INFO ] 00:19:23.728 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'shoppingCartModule                      ' - com.tzding.tzd.backend.web.shoppingcart.ShoppingCartModule
[INFO ] 00:19:23.728 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'shoppingOrderModule                     ' - com.tzding.tzd.backend.web.shoppingcart.ShoppingOrderModule
[INFO ] 00:19:23.730 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'templateMoule                           ' - com.tzding.tzd.backend.web.template.TemplateMoule
[INFO ] 00:19:23.734 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'userModule                              ' - com.tzding.tzd.backend.web.user.UserModule
[INFO ] 00:19:23.737 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'backendLauncher                         ' - com.tzding.tzd.BackendLauncher
[INFO ] 00:19:23.744 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'beanNotificationLauncher                ' - com.tzding.tzd.BeanNotificationLauncher
[INFO ] 00:19:23.745 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'beanAclLauncher                         ' - com.tzding.tzd.BeanAclLauncher
[INFO ] 00:19:23.746 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'aclDao                                  ' - com.tzding.tzd.dao.AclDao
[INFO ] 00:19:23.763 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'userTestModule                          ' - com.tzding.tzd.web.UserTestModule
[INFO ] 00:19:23.763 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'routeFilterStarter                      ' - com.tzding.tzd.application.filter.RouteFilterStarter
[DEBUG] 00:19:23.765 org.nutz.ioc.loader.annotation.AnnotationIocLoader.handleIocBeanMethod(AnnotationIocLoader.java:247) - Found @IocBean method : RouteFilterStarter.createRouteFilter(...) define as name=routeFilter
[INFO ] 00:19:23.766 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'jedisConfig                             ' - com.tzding.tzd.application.jedis.JedisConfig
[INFO ] 00:19:23.771 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'jedisPooler                             ' - com.tzding.tzd.application.jedis.JedisPooler
[INFO ] 00:19:23.775 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'shiroEnvStarter                         ' - com.tzding.tzd.application.shiro.ShiroEnvStarter
[DEBUG] 00:19:23.791 org.nutz.ioc.loader.annotation.AnnotationIocLoader.handleIocBeanMethod(AnnotationIocLoader.java:247) - Found @IocBean method : ShiroEnvStarter.getWebSecurityManager(...) define as name=shiroWebSecurityManager
[DEBUG] 00:19:23.791 org.nutz.ioc.loader.annotation.AnnotationIocLoader.handleIocBeanMethod(AnnotationIocLoader.java:247) - Found @IocBean method : ShiroEnvStarter.getCacheManager(...) define as name=shiroCacheManager
[DEBUG] 00:19:23.792 org.nutz.ioc.loader.annotation.AnnotationIocLoader.handleIocBeanMethod(AnnotationIocLoader.java:247) - Found @IocBean method : ShiroEnvStarter.createShiroEnvironmentLoaderListener(...) define as name=shiroEnvironmentLoaderListener
[DEBUG] 00:19:23.792 org.nutz.ioc.loader.annotation.AnnotationIocLoader.handleIocBeanMethod(AnnotationIocLoader.java:247) - Found @IocBean method : ShiroEnvStarter.createWebEnvironment(...) define as name=shiroWebEnvironment
[DEBUG] 00:19:23.792 org.nutz.ioc.loader.annotation.AnnotationIocLoader.handleIocBeanMethod(AnnotationIocLoader.java:247) - Found @IocBean method : ShiroEnvStarter.createRememberMeManager(...) define as name=shiroRememberMeManager
[DEBUG] 00:19:23.793 org.nutz.ioc.loader.annotation.AnnotationIocLoader.handleIocBeanMethod(AnnotationIocLoader.java:247) - Found @IocBean method : ShiroEnvStarter.getWebSessionManager(...) define as name=shiroWebSessionManager
[DEBUG] 00:19:23.794 org.nutz.ioc.loader.annotation.AnnotationIocLoader.handleIocBeanMethod(AnnotationIocLoader.java:247) - Found @IocBean method : ShiroEnvStarter.getShiroLcacheCacheManager(...) define as name=shiroEhcacheCacheManager
[DEBUG] 00:19:23.795 org.nutz.ioc.loader.annotation.AnnotationIocLoader.handleIocBeanMethod(AnnotationIocLoader.java:247) - Found @IocBean method : ShiroEnvStarter.getShiroLcacheCacheManager(...) define as name=shiroLcacheCacheManager
[DEBUG] 00:19:23.797 org.nutz.ioc.loader.annotation.AnnotationIocLoader.handleIocBeanMethod(AnnotationIocLoader.java:247) - Found @IocBean method : ShiroEnvStarter.getRedisLcacheCacheManager(...) define as name=shiroRedisCacheManager
[INFO ] 00:19:23.800 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'shiroFilterStarter                      ' - com.tzding.tzd.application.shiro.ShiroFilterStarter
[DEBUG] 00:19:23.811 org.nutz.ioc.loader.annotation.AnnotationIocLoader.handleIocBeanMethod(AnnotationIocLoader.java:247) - Found @IocBean method : ShiroFilterStarter.createShiroFilter(...) define as name=shiroFilter
[INFO ] 00:19:23.811 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'baseSystemLauncher                      ' - com.tzding.tzd.BaseSystemLauncher
[INFO ] 00:19:23.811 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'cacheDao                                ' - com.tzding.tzd.cache.CacheDao
[INFO ] 00:19:23.812 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'userCache                               ' - com.tzding.tzd.cache.UserCache
[INFO ] 00:19:23.813 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'systemDao                               ' - com.tzding.tzd.dao.SystemDao
[INFO ] 00:19:23.815 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'redisHelper                             ' - com.tzding.tzd.redis.RedisHelper
[INFO ] 00:19:23.816 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'sessionUtil                             ' - com.tzding.tzd.utils.SessionUtil
[INFO ] 00:19:23.817 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'checkNumUtil                            ' - com.tzding.tzd.utils.verify.CheckNumUtil
[INFO ] 00:19:23.823 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'verifyCodeUtil                          ' - com.tzding.tzd.utils.verify.VerifyCodeUtil
[INFO ] 00:19:23.824 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'systemModule                            ' - com.tzding.tzd.web.SystemModule
[INFO ] 00:19:23.824 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'timeModule                              ' - com.tzding.tzd.web.TimeModule
[INFO ] 00:19:23.825 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'beanMultiTenantLauncher                 ' - com.tzding.tzd.BeanMultiTenantLauncher
[INFO ] 00:19:23.827 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'cMCache                                 ' - com.tzding.tzd.cache.CMCache
[INFO ] 00:19:23.828 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'cmDao                                   ' - com.tzding.tzd.dao.CmDao
[INFO ] 00:19:23.833 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'beanShoppingLauncher                    ' - com.tzding.tzd.BeanShoppingLauncher
[INFO ] 00:19:23.836 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'specificationCache                      ' - com.tzding.tzd.cache.SpecificationCache
[INFO ] 00:19:23.837 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'shoppingDao                             ' - com.tzding.tzd.dao.ShoppingDao
[INFO ] 00:19:23.850 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'beanMarketingLauncher                   ' - com.tzding.tzd.BeanMarketingLauncher
[INFO ] 00:19:23.851 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'beanManufactureLauncher                 ' - com.tzding.tzd.BeanManufactureLauncher
[INFO ] 00:19:23.852 org.nutz.ioc.loader.annotation.AnnotationIocLoader.<init>(AnnotationIocLoader.java:51) -  > scan 'org.nutz.boot.starter'
[DEBUG] 00:19:23.853 org.nutz.resource.Scans.scan(Scans.java:280) - Found 18 resource by src( org/nutz/boot/starter/ ) , regex( ^.+[.]class$ )
[INFO ] 00:19:23.868 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'whaleFilterStarter                      ' - org.nutz.boot.starter.nutz.mvc.WhaleFilterStarter
[DEBUG] 00:19:23.879 org.nutz.ioc.loader.annotation.AnnotationIocLoader.handleIocBeanMethod(AnnotationIocLoader.java:247) - Found @IocBean method : WhaleFilterStarter.createNutFilter(...) define as name=whaleFilter
[INFO ] 00:19:23.882 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'nutFilterStarter                        ' - org.nutz.boot.starter.nutz.mvc.NutFilterStarter
[DEBUG] 00:19:23.891 org.nutz.ioc.loader.annotation.AnnotationIocLoader.handleIocBeanMethod(AnnotationIocLoader.java:247) - Found @IocBean method : NutFilterStarter.createNutFilter(...) define as name=nutFilter
[INFO ] 00:19:23.892 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'nutDaoStarter                           ' - org.nutz.boot.starter.nutz.dao.NutDaoStarter
[DEBUG] 00:19:23.901 org.nutz.ioc.loader.annotation.AnnotationIocLoader.handleIocBeanMethod(AnnotationIocLoader.java:247) - Found @IocBean method : NutDaoStarter.getDao(...) define as name=dao
[DEBUG] 00:19:23.902 org.nutz.ioc.loader.annotation.AnnotationIocLoader.handleIocBeanMethod(AnnotationIocLoader.java:247) - Found @IocBean method : NutDaoStarter.getSqlManager(...) define as name=sqlManager
[DEBUG] 00:19:23.906 org.nutz.ioc.loader.annotation.AnnotationIocLoader.handleIocBeanMethod(AnnotationIocLoader.java:247) - Found @IocBean method : NutDaoStarter.createCacheSerializer(...) define as name=daoCacheSerializer
[DEBUG] 00:19:23.910 org.nutz.ioc.loader.annotation.AnnotationIocLoader.handleIocBeanMethod(AnnotationIocLoader.java:247) - Found @IocBean method : NutDaoStarter.createDaoCacheInterceptor(...) define as name=daoCacheInterceptor
[INFO ] 00:19:23.911 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'jettyStarter                            ' - org.nutz.boot.starter.jetty.JettyStarter
[DEBUG] 00:19:23.922 org.nutz.ioc.loader.annotation.AnnotationIocLoader.handleIocBeanMethod(AnnotationIocLoader.java:247) - Found @IocBean method : JettyStarter.getJettyServer(...) define as name=jettyServer
[INFO ] 00:19:23.924 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'nbServletContextListener                ' - org.nutz.boot.starter.servlet3.NbServletContextListener
[INFO ] 00:19:23.926 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'j2cacheStarter                          ' - org.nutz.boot.starter.j2cache.J2cacheStarter
[DEBUG] 00:19:23.927 org.nutz.ioc.loader.annotation.AnnotationIocLoader.handleIocBeanMethod(AnnotationIocLoader.java:247) - Found @IocBean method : J2cacheStarter.getCacheChannel(...) define as name=cacheChannel
[INFO ] 00:19:23.928 org.nutz.ioc.loader.annotation.AnnotationIocLoader.addClass(AnnotationIocLoader.java:99) -    > add 'swaggerServletStarter                   ' - org.nutz.boot.starter.swagger.SwaggerServletStarter
[DEBUG] 00:19:23.936 org.nutz.ioc.loader.annotation.AnnotationIocLoader.handleIocBeanMethod(AnnotationIocLoader.java:247) - Found @IocBean method : SwaggerServletStarter.createSwagger(...) define as name=swagger
[DEBUG] 00:19:23.936 org.nutz.ioc.loader.annotation.AnnotationIocLoader.handleIocBeanMethod(AnnotationIocLoader.java:247) - Found @IocBean method : SwaggerServletStarter.createSwaggerInfo(...) define as name=swaggerInfo
[DEBUG] 00:19:23.938 org.nutz.boot.NbApp.prepareStarterClassList(NbApp.java:410) - Found jar:file:/usr/local/tzd-backend/tzd-backend-0.0.1-SNAPSHOT-jar-with-dependencies.jar!/META-INF/nutz/org.nutz.boot.starter.NbStarter
[INFO ] 00:19:23.949 org.nutz.boot.NbApp.prepare(NbApp.java:289) - Configure Manual:
|id  |key                                     |required  |Possible Values     |Default   |Description         |                                starters|
|----|----------------------------------------|----------|--------------------|----------|--------------------|----------------------------------------|
|0   |nutz.mvc.whale.enc.input                |no        |                    |UTF-8     |在其他Filter之前设置input编码|org.nutz.boot.starter.nutz.mvc.WhaleFilterStarter|
|1   |nutz.mvc.whale.enc.output               |no        |                    |UTF-8     |在其他Filter之前设置output编码|org.nutz.boot.starter.nutz.mvc.WhaleFilterStarter|
|2   |nutz.mvc.whale.http.hidden_method_param |no        |                    |          |隐形http方法参数转换所对应的参数名 |org.nutz.boot.starter.nutz.mvc.WhaleFilterStarter|
|3   |nutz.mvc.whale.http.method_override     |no        |                    |false     |是否允许使用X-HTTP-Method-Override|org.nutz.boot.starter.nutz.mvc.WhaleFilterStarter|
|4   |nutz.mvc.whale.upload.enable            |no        |                    |false     |是否启用隐形Upload支持      |org.nutz.boot.starter.nutz.mvc.WhaleFilterStarter|
[INFO ] 00:19:23.957 org.nutz.ioc.impl.NutIoc.<init>(NutIoc.java:130) - ... NutIoc init complete
[DEBUG] 00:19:23.963 org.nutz.ioc.impl.ScopeContext.save(ScopeContext.java:65) - Save object 'appContext' to [app] 
[DEBUG] 00:19:23.963 org.nutz.ioc.impl.ScopeContext.save(ScopeContext.java:65) - Save object 'conf' to [app] 
[DEBUG] 00:19:23.963 org.nutz.ioc.impl.ScopeContext.save(ScopeContext.java:65) - Save object 'nbApp' to [app] 
[DEBUG] 00:19:23.964 org.nutz.ioc.impl.ScopeContext.save(ScopeContext.java:65) - Save object 'counterService' to [app] 
[DEBUG] 00:19:23.967 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:166) - Get 'nutFilterStarter'<class org.nutz.boot.starter.nutz.mvc.NutFilterStarter>
[DEBUG] 00:19:23.967 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:166) - Get '$aop_async'<interface org.nutz.ioc.aop.config.AopConfigration>
[DEBUG] 00:19:23.975 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:192) - 	 >> Load definition name=$aop_async
[DEBUG] 00:19:23.976 org.nutz.ioc.loader.combo.ComboIocLoader.printFoundIocBean(ComboIocLoader.java:226) - Found IocObject($aop_async) in AsyncAopIocLoader@1484171695
[DEBUG] 00:19:23.976 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:223) - 	 >> Make...'$aop_async'<interface org.nutz.ioc.aop.config.AopConfigration>
[DEBUG] 00:19:24.020 org.nutz.ioc.impl.ScopeContext.save(ScopeContext.java:65) - Save object '$aop_async' to [app] 
[DEBUG] 00:19:24.029 org.nutz.ioc.aop.SimpleAopMaker.<init>(SimpleAopMaker.java:79) - Load AopConfigure for anno=org.nutz.ioc.aop.Aop by type=org.nutz.ioc.aop.config.impl.AnnotationAopConfigration
[DEBUG] 00:19:24.032 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:192) - 	 >> Load definition name=nutFilterStarter
[DEBUG] 00:19:24.032 org.nutz.ioc.loader.combo.ComboIocLoader.printFoundIocBean(ComboIocLoader.java:226) - Found IocObject(nutFilterStarter) in AnnotationIocLoader(packages=[org.nutz.boot.starter])
[DEBUG] 00:19:24.033 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:223) - 	 >> Make...'nutFilterStarter'<class org.nutz.boot.starter.nutz.mvc.NutFilterStarter>
[DEBUG] 00:19:24.033 org.nutz.ioc.impl.ScopeContext.save(ScopeContext.java:65) - Save object 'nutFilterStarter' to [app] 
[DEBUG] 00:19:24.034 org.nutz.ioc.aop.impl.DefaultMirrorFactory.getMirror(DefaultMirrorFactory.java:76) - Load class org.nutz.boot.starter.nutz.mvc.NutFilterStarter without AOP
[DEBUG] 00:19:24.063 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:166) - Get 'conf'<class org.nutz.ioc.impl.PropertiesProxy>
[DEBUG] 00:19:24.063 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:166) - Get 'appContext'<class org.nutz.boot.AppContext>
[DEBUG] 00:19:24.064 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:166) - Get 'whaleFilterStarter'<class org.nutz.boot.starter.nutz.mvc.WhaleFilterStarter>
[DEBUG] 00:19:24.064 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:192) - 	 >> Load definition name=whaleFilterStarter
[DEBUG] 00:19:24.064 org.nutz.ioc.loader.combo.ComboIocLoader.printFoundIocBean(ComboIocLoader.java:226) - Found IocObject(whaleFilterStarter) in AnnotationIocLoader(packages=[org.nutz.boot.starter])
[DEBUG] 00:19:24.064 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:223) - 	 >> Make...'whaleFilterStarter'<class org.nutz.boot.starter.nutz.mvc.WhaleFilterStarter>
[DEBUG] 00:19:24.065 org.nutz.ioc.impl.ScopeContext.save(ScopeContext.java:65) - Save object 'whaleFilterStarter' to [app] 
[DEBUG] 00:19:24.065 org.nutz.ioc.aop.impl.DefaultMirrorFactory.getMirror(DefaultMirrorFactory.java:76) - Load class org.nutz.boot.starter.nutz.mvc.WhaleFilterStarter without AOP
[DEBUG] 00:19:24.069 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:166) - Get 'conf'<class org.nutz.ioc.impl.PropertiesProxy>
[DEBUG] 00:19:24.073 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:166) - Get 'jettyStarter'<interface org.nutz.boot.starter.ServerFace>
[DEBUG] 00:19:24.076 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:192) - 	 >> Load definition name=jettyStarter
[DEBUG] 00:19:24.077 org.nutz.ioc.loader.combo.ComboIocLoader.printFoundIocBean(ComboIocLoader.java:226) - Found IocObject(jettyStarter) in AnnotationIocLoader(packages=[org.nutz.boot.starter])
[DEBUG] 00:19:24.077 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:223) - 	 >> Make...'jettyStarter'<interface org.nutz.boot.starter.ServerFace>
[DEBUG] 00:19:24.078 org.nutz.ioc.impl.ScopeContext.save(ScopeContext.java:65) - Save object 'jettyStarter' to [app] 
[DEBUG] 00:19:24.078 org.nutz.ioc.aop.impl.DefaultMirrorFactory.getMirror(DefaultMirrorFactory.java:76) - Load class org.nutz.boot.starter.jetty.JettyStarter without AOP
[DEBUG] 00:19:24.100 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:166) - Get 'conf'<class org.nutz.ioc.impl.PropertiesProxy>
[ERROR] 00:19:24.107 org.nutz.boot.NbApp.execute(NbApp.java:219) - something happen!!
java.lang.NullPointerException
	at org.nutz.boot.starter.jetty.JettyStarter.start(JettyStarter.java:125)
	at org.nutz.boot.AppContext.startServers(AppContext.java:306)
	at org.nutz.boot.NbApp.execute(NbApp.java:205)
	at org.nutz.boot.NbApp.run(NbApp.java:178)
	at com.tzding.tzd.BackendLauncher.main(BackendLauncher.java:39)
[ERROR] 00:19:24.109 org.nutz.boot.NbApp.run(NbApp.java:187) - something happen
java.lang.NullPointerException
	at org.nutz.boot.starter.jetty.JettyStarter.stop(JettyStarter.java:129)
	at org.nutz.boot.AppContext.stopServers(AppContext.java:315)
	at org.nutz.boot.NbApp._shutdown(NbApp.java:226)
	at org.nutz.boot.NbApp.run(NbApp.java:184)
	at com.tzding.tzd.BackendLauncher.main(BackendLauncher.java:39)
56 回复

打包方式有问题,正确的方式是

mvn clean package nutzboot:shade

其他方式,例如idea/eclipse导出可执行jar,均会挂

哇瑟,这么晚了,还回复问题。

可是,这条命令,nutzboot:shade是什么意思?

mvn clean package nutzboot:shade

这边要打包的那个模块的pom.xml里,写了这个样的内容:
然后就是使用vs code工具的maven for java扩展工具的右键要打包的项目,先clean,后package。然后就生成了两个jar文件,一个是没有包含依赖的(3M左右大小),一个是包含依赖的(40M左右大小)。

<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-dependency-plugin</artifactId>
				<executions>
					<execution>
						<id>copy-dependencies</id>
						<phase>package</phase>
						<goals>
							<goal>copy-dependencies</goal>
						</goals>
						<configuration>
							<outputDirectory>${project.build.directory}/lib</outputDirectory>
							<overWriteReleases>false</overWriteReleases>
							<overWriteSnapshots>false</overWriteSnapshots>
							<overWriteIfNewer>true</overWriteIfNewer>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<artifactId>maven-assembly-plugin</artifactId>
				<configuration>
					<archive>
						<manifest>
							<mainClass>com.tzding.tzd.BackendLauncher</mainClass>
						</manifest>
						<manifestEntries>
							<Class-Path>.</Class-Path>
						</manifestEntries>
					</archive>
					<descriptorRefs>
						<descriptorRef>jar-with-dependencies</descriptorRef>
					</descriptorRefs>
				</configuration>
				<executions>
					<execution>
						<id>make-assembly</id>
						<phase>package</phase>
						<goals>
							<goal>single</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>

https://get.nutz.io 生成个最简单的项目,看里面的pom.xml和readme,别瞎配plugin,nutzboot有自己的maven 插件

嗯。我先看看。谢谢。

使用你说的方式打包成功了。并且能执行成功。就是不知道哪里没有配置好,导致启动日志停留在这个位置好久:

[INFO ] 14:01:26.528 net.oschina.j2cache.util.SerializationUtils.init(SerializationUtils.java:62) - Using Serializer -> [fst:net.oschina.j2cache.util.FSTSerializer]
[INFO ] 14:01:26.535 net.oschina.j2cache.CacheProviderHolder.init(CacheProviderHolder.java:53) - Using L1 CacheProvider : net.oschina.j2cache.caffeine.CaffeineProvider
[INFO ] 14:01:26.545 net.oschina.j2cache.redis.RedisCacheProvider.start(RedisCacheProvider.java:81) - Redis client starts with mode(single),db(0),storage(generic),namespace(null),time(1ms)
[INFO ] 14:01:26.546 net.oschina.j2cache.CacheProviderHolder.init(CacheProviderHolder.java:59) - Using L2 CacheProvider : net.oschina.j2cache.redis.RedisCacheProvider

然后,就报这个异常,最后导致Jetty stop。

[DEBUG] 14:03:33.783 org.nutz.ioc.impl.ScopeContext.remove(ScopeContext.java:85) - Remove object 'cacheChannel' from [app] 
[DEBUG] 14:03:33.784 org.nutz.ioc.impl.ScopeContext.remove(ScopeContext.java:85) - Remove object 'cacheDao' from [app] 
[DEBUG] 14:03:33.784 org.nutz.ioc.impl.ScopeContext.remove(ScopeContext.java:85) - Remove object 'userCache' from [app] 
[DEBUG] 14:03:33.784 org.nutz.ioc.impl.ScopeContext.remove(ScopeContext.java:85) - Remove object 'sessionUtil' from [app] 
[DEBUG] 14:03:33.784 org.nutz.ioc.impl.ScopeContext.remove(ScopeContext.java:85) - Remove object 'backendLauncher' from [app] 
[ERROR] 14:03:33.785 org.nutz.boot.NbApp.execute(NbApp.java:219) - something happen!!
org.nutz.ioc.IocException: IocBean[backendLauncher -> sessionUtil] throw Exception when creating
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:152)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:241)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:271)
	at com.tzding.tzd.BaseSystemLauncher.initDB(BaseSystemLauncher.java:65)
	at com.tzding.tzd.BaseSystemLauncher.init(BaseSystemLauncher.java:44)
	at com.tzding.tzd.BackendLauncher.init(BackendLauncher.java:63)
	at com.tzding.tzd.BackendLauncher$FM$init$fd3a93ac716761ef652deda007bf9ab8.invoke(BackendLauncher.java)
	at org.nutz.ioc.impl.ObjectMakerImpl$2.trigger(ObjectMakerImpl.java:180)
	at org.nutz.ioc.weaver.DefaultWeaver.onCreate(DefaultWeaver.java:89)
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:141)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:241)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:271)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:161)
	at org.nutz.boot.NbApp.execute(NbApp.java:209)
	at org.nutz.boot.NbApp.run(NbApp.java:178)
	at com.tzding.tzd.BackendLauncher.main(BackendLauncher.java:39)
Caused by: java.lang.RuntimeException: IocBean[sessionUtil] fail at field=[userCache]
	at org.nutz.ioc.weaver.FieldInjector.inject(FieldInjector.java:40)
	at org.nutz.ioc.weaver.DefaultWeaver.fill(DefaultWeaver.java:67)
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:138)
	... 15 more
Caused by: org.nutz.ioc.IocException: IocBean[userCache] throw Exception when creating
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:152)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:241)
	at org.nutz.ioc.val.ReferTypeValue.get(ReferTypeValue.java:60)
	at org.nutz.ioc.weaver.FieldInjector.inject(FieldInjector.java:32)
	... 17 more
Caused by: java.lang.RuntimeException: IocBean[userCache] fail at field=[cacheDao]
	at org.nutz.ioc.weaver.FieldInjector.inject(FieldInjector.java:40)
	at org.nutz.ioc.weaver.DefaultWeaver.fill(DefaultWeaver.java:67)
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:138)
	... 20 more
Caused by: org.nutz.ioc.IocException: IocBean[cacheDao] throw Exception when creating
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:152)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:241)
	at org.nutz.ioc.val.ReferTypeValue.get(ReferTypeValue.java:60)
	at org.nutz.ioc.weaver.FieldInjector.inject(FieldInjector.java:32)
	... 22 more
Caused by: java.lang.RuntimeException: IocBean[cacheDao] fail at field=[cacheChannel]
	at org.nutz.ioc.weaver.FieldInjector.inject(FieldInjector.java:40)
	at org.nutz.ioc.weaver.DefaultWeaver.fill(DefaultWeaver.java:67)
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:138)
	... 25 more
Caused by: org.nutz.ioc.IocException: IocBean[cacheChannel] throw Exception when creating
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:152)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:241)
	at org.nutz.ioc.val.ReferTypeValue.get(ReferTypeValue.java:60)
	at org.nutz.ioc.weaver.FieldInjector.inject(FieldInjector.java:32)
	... 27 more
Caused by: org.nutz.lang.InvokingException: Fail to invoke [org.nutz.boot.starter.j2cache.J2cacheStarter].getCacheChannel() by args:
 
For the reason: Connection timed out (Connection timed out)
	at org.nutz.lang.Invoking.invoke(Invoking.java:195)
	at org.nutz.lang.Mirror.invoke(Mirror.java:1132)
	at org.nutz.ioc.impl.ObjectMakerImpl$1.born(ObjectMakerImpl.java:80)
	at org.nutz.ioc.weaver.DefaultWeaver.born(DefaultWeaver.java:78)
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:117)
	... 30 more
Caused by: java.net.ConnectException: Connection timed out (Connection timed out)
	at java.net.PlainSocketImpl.socketConnect(Native Method)
	at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
	at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
	at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
	at java.net.Socket.connect(Socket.java:589)
	at redis.clients.jedis.Connection.connect(Connection.java:184)
	at redis.clients.jedis.BinaryClient.connect(BinaryClient.java:93)
	at redis.clients.jedis.BinaryJedis.connect(BinaryJedis.java:1767)
	at redis.clients.jedis.JedisFactory.makeObject(JedisFactory.java:106)
	at org.apache.commons.pool2.impl.GenericObjectPool.create(GenericObjectPool.java:868)
	at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:435)
	at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:363)
	at redis.clients.util.Pool.getResource(Pool.java:49)
	at redis.clients.jedis.JedisPool.getResource(JedisPool.java:226)
	at net.oschina.j2cache.redis.RedisPubSubClusterPolicy.connect(RedisPubSubClusterPolicy.java:71)
	at net.oschina.j2cache.ClusterPolicyFactory.redis(ClusterPolicyFactory.java:57)
	at net.oschina.j2cache.ClusterPolicyFactory.init(ClusterPolicyFactory.java:39)
	at net.oschina.j2cache.J2CacheBuilder.initFromConfig(J2CacheBuilder.java:102)
	at net.oschina.j2cache.J2CacheBuilder.<init>(J2CacheBuilder.java:36)
	at net.oschina.j2cache.J2CacheBuilder.init(J2CacheBuilder.java:63)
	at org.nutz.boot.starter.j2cache.J2cacheStarter.getCacheChannel(J2cacheStarter.java:135)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.nutz.lang.Invoking$NullArgInvoker.invoke(Invoking.java:77)
	at org.nutz.lang.Invoking.invoke(Invoking.java:192)
	... 34 more
[INFO ] 14:03:33.800 org.eclipse.jetty.server.AbstractConnector.doStop(AbstractConnector.java:332) - Stopped ServerConnector@334168c9{HTTP/1.1,[http/1.1]}{0.0.0.0:8888}
[INFO ] 14:03:33.800 org.eclipse.jetty.server.session.HouseKeeper.stopScavenging(HouseKeeper.java:167) - node0 Stopped scavenging
[INFO ] 14:03:33.806 org.nutz.boot.starter.nutz.mvc.NbMvcLoading.depose(NbMvcLoading.java:54) - Nutz.Mvc[nutz] is deposing ...
[INFO ] 14:03:33.806 org.nutz.boot.starter.nutz.mvc.NbMvcLoading.depose(NbMvcLoading.java:70) - Nutz.Mvc[nutz] is down in 0ms
[INFO ] 14:03:33.808 org.eclipse.jetty.server.handler.ContextHandler$Context.log(ContextHandler.java:2318) - Cleaning up Shiro Environment
[INFO ] 14:03:33.811 org.eclipse.jetty.server.handler.ContextHandler.doStop(ContextHandler.java:1020) - Stopped o.e.j.w.WebAppContext@d71adc2{/tzd/backend,[jar:file:/usr/local/tzd-backend/tzd-backend-0.0.1-SNAPSHOT.jar!/static/, file:///usr/local/tzd-backend/webapp/],UNAVAILABLE}
[INFO ] 14:03:33.833 org.nutz.ioc.impl.NutIoc.depose(NutIoc.java:287) - org.nutz.ioc.impl.NutIoc@1161382705 is closing. startup date [18-08-11 14:01:13.033]
[DEBUG] 14:03:33.834 org.nutz.ioc.impl.ScopeContext.clear(ScopeContext.java:109) - Depose object 'acl_dao' ...
[DEBUG] 14:03:33.834 org.nutz.ioc.impl.ScopeContext.clear(ScopeContext.java:109) - Depose object 'systemDao' ...
[DEBUG] 14:03:33.838 org.nutz.ioc.impl.ScopeContext.clear(ScopeContext.java:109) - Depose object 'sysConf' ...
[DEBUG] 14:03:33.838 org.nutz.ioc.impl.ScopeContext.clear(ScopeContext.java:109) - Depose object 'tzd_sys_dao' ...
[DEBUG] 14:03:33.842 org.nutz.ioc.impl.ScopeContext.clear(ScopeContext.java:109) - Depose object 'swaggerInfo' ...
[DEBUG] 14:03:33.842 org.nutz.ioc.impl.ScopeContext.clear(ScopeContext.java:109) - Depose object 'swagger' ...
[DEBUG] 14:03:33.842 org.nutz.ioc.impl.ScopeContext.clear(ScopeContext.java:109) - Depose object 'nutFilter' ...
[DEBUG] 14:03:33.842 org.nutz.ioc.impl.ScopeContext.clear(ScopeContext.java:109) - Depose object 'shiroFilter' ...
[DEBUG] 14:03:33.842 org.nutz.ioc.impl.ScopeContext.clear(ScopeContext.java:109) - Depose object 'routeFilter' ...
[DEBUG] 14:03:33.842 org.nutz.ioc.impl.ScopeContext.clear(ScopeContext.java:109) - Depose object 'whaleFilter' ...
[DEBUG] 14:03:33.843 org.nutz.ioc.impl.ScopeContext.clear(ScopeContext.java:109) - Depose object 'routeFilterStarter' ...
[DEBUG] 14:03:33.843 org.nutz.ioc.impl.ScopeContext.clear(ScopeContext.java:109) - Depose object 'shiroFilterStarter' ...
[DEBUG] 14:03:33.843 org.nutz.ioc.impl.ScopeContext.clear(ScopeContext.java:109) - Depose object 'shiroEnvironmentLoaderListener' ...
[DEBUG] 14:03:33.843 org.nutz.ioc.impl.ScopeContext.clear(ScopeContext.java:109) - Depose object 'shiroEnvStarter' ...
[DEBUG] 14:03:33.843 org.nutz.ioc.impl.ScopeContext.clear(ScopeContext.java:109) - Depose object 'nbServletContextListener' ...
[DEBUG] 14:03:33.845 org.nutz.ioc.impl.ScopeContext.clear(ScopeContext.java:109) - Depose object 'swaggerServletStarter' ...
[DEBUG] 14:03:33.845 org.nutz.ioc.impl.ScopeContext.clear(ScopeContext.java:109) - Depose object 'j2cacheStarter' ...
[DEBUG] 14:03:33.845 org.nutz.ioc.impl.ScopeContext.clear(ScopeContext.java:109) - Depose object 'jettyStarter' ...
[DEBUG] 14:03:33.845 org.nutz.ioc.impl.ScopeContext.clear(ScopeContext.java:109) - Depose object 'nutDaoStarter' ...
[DEBUG] 14:03:33.845 org.nutz.ioc.impl.ScopeContext.clear(ScopeContext.java:109) - Depose object 'whaleFilterStarter' ...
[DEBUG] 14:03:33.845 org.nutz.ioc.impl.ScopeContext.clear(ScopeContext.java:109) - Depose object 'nutFilterStarter' ...
[DEBUG] 14:03:33.846 org.nutz.ioc.impl.ScopeContext.clear(ScopeContext.java:109) - Depose object '$aop_async' ...
[DEBUG] 14:03:33.846 org.nutz.ioc.impl.ScopeContext.clear(ScopeContext.java:109) - Depose object 'counterService' ...
[DEBUG] 14:03:33.846 org.nutz.ioc.impl.ScopeContext.clear(ScopeContext.java:109) - Depose object 'nbApp' ...
[DEBUG] 14:03:33.846 org.nutz.ioc.impl.ScopeContext.clear(ScopeContext.java:109) - Depose object 'conf' ...
[DEBUG] 14:03:33.847 org.nutz.ioc.impl.ScopeContext.clear(ScopeContext.java:109) - Depose object 'appContext' ...
[DEBUG] 14:03:33.847 org.nutz.ioc.impl.ScopeContext.clear(ScopeContext.java:114) - Depose object 'acl_dataSource' ...
[INFO ] 14:03:33.854 com.alibaba.druid.pool.DruidDataSource.close(DruidDataSource.java:1825) - {dataSource-2} closed
[DEBUG] 14:03:33.854 org.nutz.ioc.impl.ScopeContext.clear(ScopeContext.java:114) - Depose object 'tzd_sys_dataSource' ...
[INFO ] 14:03:33.855 com.alibaba.druid.pool.DruidDataSource.close(DruidDataSource.java:1825) - {dataSource-1} closed
[INFO ] 14:03:33.855 org.nutz.ioc.impl.NutIoc.depose(NutIoc.java:301) - org.nutz.ioc.impl.NutIoc@1161382705 is deposed. startup date [18-08-11 14:01:13.033]

本地环境是可以连接到redis和数据库的。打包项目之前,更改了IP地址、账户、密码。

j2cache的redis参数没配对

我已经检查很久了,除了地址和密码外,其他参数也会影响到吗?

改了redis参数,但没改j2cache下的redis参数?

redis的参数是在ioc目录下的js文件里。
j2cache下的redis参数是在j2cache.properties文件里。
还有就是在shiro.properties文件里的redis也修改了。

还有就是在shiro.properties文件里的redis也修改了。

----这个是在里面指向的shiro.ini文件里的也修改了。

没使用nutzboot的redis ,j2cache的starter?

报错的j2cache,不是其他东西

pom.xml文件关于redis的配置:

<dependency>
            <groupId>org.nutz</groupId>
            <artifactId>nutzboot-starter-j2cache</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-simple</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

<dependency>
            <groupId>org.crazycake</groupId>
            <artifactId>shiro-redis</artifactId>
            <version>2.4.2.1-RELEASE</version>
        </dependency>

报错的是j2cache,不是其他东西

如果用了j2cache的starter,那么配置信息就不会读取j2chcahe.properties

如果用了j2cache的starter,那么配置信息就不会读取j2chcahe.properties
----那么会读取哪里的配置信息呢?

把j2cache.properties里面的配置信息拷贝到application.properties,并逐一加前缀"j2cache."

好的。我试试。

有这样的配置吗?后面=ip:端口号?
j2cache.redis.hosts==ip:端口号

有这样的配置吗?后面=ip:端口号?
j2cache.redis.hosts=ip:端口号

j2cache.properties怎么要求就怎么写

j2cache.properties里面的配置信息已经是这样开头的键:j2cache.redis.port=6379

现在还要在application.properties这个文件里面加上前缀"j2cache."吗?

刚才看了一下配置示例:
nutzboot/nutzboot-demo/nutzboot-demo-simple/nutzboot-demo-simple-j2cache
部分:

#########################################
# Redis Cluster Mode
#
# single -> single redis server
# sentinel -> master-slaves servers
# cluster -> cluster servers (数据库配置无效,使用 database = 0)
# sharded -> sharded servers  (密码、数据库必须在 hosts 中指定,且连接池配置无效 ; redis://user:password@127.0.0.1:6379/0)
#
#########################################

j2cache.redis.mode=single

#redis storage mode (generic|hash)
j2cache.redis.storage=generic

## redis pub/sub channel name
j2cache.redis.channel=j2cache
## redis pub/sub server (using redis.hosts when empty)
j2cache.redis.channel.host=

#cluster name just for sharded
j2cache.redis.cluster_name=j2cache

## redis cache namespace optional, default[j2cache]
j2cache.redis.namespace=

## connection
j2cache.redis.hosts=127.0.0.1:6379
j2cache.redis.timeout=2000
j2cache.redis.password=
j2cache.redis.database=0

我有一个想法,就是jetty跑在,例如1234端口上,那么我连接的redis是在另一个服务器上的,会不会是那个服务器上的内网没有开通这个1234端口的访问权限啊?

不对,昨天已经开放了jetty的端口。

有可能的, telnet试一下就知道

试了,是这样的:
telnet 内网ip 6379
Trying 内网ip...
Connected to 内网ip.
Escape character is '^]'.

嗯。因为和我启动的这个jar应用在同一个机器上的tomcat里面的web应用都能使用内网的方式访问那个机器上的redis.

我觉得你可以本地测试一下, 看看j2cache开头的配置是否生效, 例如特意改错它

真巧,刚试玩本地的,就是想看一下,那一行日志附近本地是什么样子的。这样:

[INFO ] 15:38:41.935 net.oschina.j2cache.CacheProviderHolder.init(CacheProviderHolder.java:53) - Using L1 CacheProvider : net.oschina.j2cache.caffeine.CaffeineProvider
[INFO ] 15:38:41.943 net.oschina.j2cache.redis.RedisCacheProvider.start(RedisCacheProvider.java:81) - Redis client starts with mode(single),db(0),storage(generic),namespace(null),time(4ms)
[INFO ] 15:38:41.944 net.oschina.j2cache.CacheProviderHolder.init(CacheProviderHolder.java:59) - Using L2 CacheProvider : net.oschina.j2cache.redis.RedisCacheProvider
[INFO ] 15:38:42.139 net.oschina.j2cache.redis.RedisPubSubClusterPolicy.connect(RedisPubSubClusterPolicy.java:92) - Connected to redis channel:j2cache, time 187 ms.
[INFO ] 15:38:42.139 net.oschina.j2cache.J2CacheBuilder.initFromConfig(J2CacheBuilder.java:103) - Using cluster policy : net.oschina.j2cache.redis.RedisPubSubClusterPolicy
[INFO ] 15:38:42.185 com.tzding.tzd.BaseSystemLauncher.initDB(BaseSystemLauncher.java:72) - BaseDB 准备完毕

net.oschina.j2cache.redis.RedisClient里面的这一段:

/**
     * 各种模式 Redis 客户端的封装
     * @param mode Redis 服务器运行模式
     * @param hosts Redis 主机连接信息
     * @param password  Redis 密码(如果有的话)
     * @param cluster_name  集群名称
     * @param database 数据库
     * @param poolConfig    连接池配置
     */
    private RedisClient(String mode, String hosts, String password, String cluster_name, int database, JedisPoolConfig poolConfig) {
        this.redisPassword = (password != null && password.trim().length() > 0)? password.trim(): null;
        this.clients = new ThreadLocal<>();
        switch(mode){
            case "sentinel":
                Set<String> nodes = new HashSet<>();
                for(String node : hosts.split(","))
                    nodes.add(node);
                this.sentinel = new JedisSentinelPool(cluster_name, nodes, poolConfig, CONNECT_TIMEOUT, password, database);
                break;
            case "cluster":
                Set<HostAndPort> hps = new HashSet<>();
                for(String node : hosts.split(",")){
                    String[] infos = node.split(":");
                    String host = infos[0];
                    int port = (infos.length > 1)?Integer.parseInt(infos[1]):6379;
                    hps.add(new HostAndPort(host, port));
                }
                this.cluster = new JedisCluster(hps, CONNECT_TIMEOUT, SO_TIMEOUT, MAX_ATTEMPTS, password, poolConfig);
                break;
            case "sharded":
                List<JedisShardInfo> shards = new ArrayList<>();
                try {
                    for(String node : hosts.split(","))
                        shards.add(new JedisShardInfo(new URI(node)));
                } catch (URISyntaxException e) {
                    throw new JedisConnectionException(e);
                }
                this.sharded = new ShardedJedisPool(poolConfig, shards);
                break;
            default:
                for(String node : hosts.split(",")) {
                    String[] infos = node.split(":");
                    String host = infos[0];
                    int port = (infos.length > 1)?Integer.parseInt(infos[1]):6379;
                    this.single = new JedisPool(poolConfig, host, port, CONNECT_TIMEOUT, password, database);
                    break;
                }
                if(!"single".equalsIgnoreCase(mode))
                    log.warn("Redis mode [" + mode + "] not defined. Using 'single'.");
                break;
        }
    }

因为配置的mode是single,所以走到下面这一行就是5秒(CONNECT_TIMEOUT)的连接超时。难道CacheProviderHolder在连接redis时,出现了超过5秒的时间,还没有连上的情况?

new JedisPool(poolConfig, host, port, CONNECT_TIMEOUT, password, database);
private final static int CONNECT_TIMEOUT = 5000;    //Redis连接超时时间

但是在执行这个命令时,差不多是瞬间给出连接成功提示的。

telnet 内网ip 6379

我在本地测试,打上断点,故意停留一会儿再执行下一步。依然能连上,日志如下:

[INFO ] 16:07:05.366 net.oschina.j2cache.util.SerializationUtils.init(SerializationUtils.java:62) - Using Serializer -> [fst:net.oschina.j2cache.util.FSTSerializer]
[INFO ] 16:07:05.375 net.oschina.j2cache.CacheProviderHolder.init(CacheProviderHolder.java:53) - Using L1 CacheProvider : net.oschina.j2cache.caffeine.CaffeineProvider
[INFO ] 16:08:18.063 net.oschina.j2cache.redis.RedisCacheProvider.start(RedisCacheProvider.java:81) - Redis client starts with mode(single),db(0),storage(generic),namespace(null),time(72683ms)
[INFO ] 16:08:18.063 net.oschina.j2cache.CacheProviderHolder.init(CacheProviderHolder.java:59) - Using L2 CacheProvider : net.oschina.j2cache.redis.RedisCacheProvider
[INFO ] 16:08:18.526 net.oschina.j2cache.redis.RedisPubSubClusterPolicy.connect(RedisPubSubClusterPolicy.java:92) - Connected to redis channel:j2cache, time 452 ms.

这样的话,可能是在这块代码里出现问题:
net.oschina.j2cache.redis.RedisPubSubClusterPolicy类中:

/**
     * 加入 Redis 的发布订阅频道
     */
    @Override
    public void connect(Properties props) {
        long ct = System.currentTimeMillis();

        try (Jedis jedis = client.getResource()) {
            jedis.publish(channel, Command.join().json());   //Join Cluster
        }

        new Thread(()-> {
            //当 Redis 重启会导致订阅线程断开连接,需要进行重连
            while(true) {
                try (Jedis jedis = client.getResource()){
                    jedis.subscribe(this, channel);
                    log.info("Disconnect to redis channel:" + channel);
                    break;
                } catch (JedisConnectionException e) {
                    log.error("Failed connect to redis, reconnect it.", e);
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException ie){
                        break;
                    }
                }
            }
        }, "RedisSubscribeThread").start();
        log.info("Connected to redis channel:" + channel + ", time " + (System.currentTimeMillis()-ct) + " ms.");
    }

那么,redis server端是需要什么配置来支持发布订阅功能吗?

本地把j2cache.properties里面的密码改错,然后本地就不能成功启动。

但是提示信息很明确:For the reason: ERR invalid password

复现问题了。把ip地址改错。就出现一样的错误信息。

那就是走j2cache.properties了? 看来是自行初始化j2cache, 那么starter-j2cache没必要了

本地直接跑的那个子项目的main方法,和打包后执行jar,会使用不同位置的配置文件?

好奇怪啊,我明明改了配置文件redis的地址,可是打包的里面的配置文件的地址还是本地开发环境连接的redis地址。

打包也可以本地验证一下啦

给你说一下大概的项目层次:
w
w1
w2

注:w1,w2是w的子模块。其中,w1依赖w2.
现在要打包w1,那个打包命令式在w/w1下面执行的。
本地开发时,w2的配置文件,w1是可以用的。刚才说的故意改错,就是改的w2里面的配置。
但是,打包后的jar文件并没有把w2的配置文件合并过去。

你指的合并是啥? application.properties?

话说,你知道多环境配置吧?可以启动jar的时候,可以选不同的配置文件

java -Dnutz.profiles.active=prod -jar xxx.jar

就会读取application-prod.properties

我指的合并类似于webpack配置文件那种方式。一般是base.js, dev.js, pro.js

之前并没有了解这一块的内容。你说的

java -Dnutz.profiles.active=prod -jar xxx.jar

这个昨天晚上,你看看最简单的项目,看里面的pom.xml和readme,那时发现了好像有这个东西。

现在打包的项目启动成功了。目前是先手动把jar包里面的配置手动改一下。

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