NutzCN Logo
问答 nutzwk打war包
发布于 1600天前 作者 qq_7aad0313 1482 次浏览 复制 上一个帖子 下一个帖子
标签: nutzwk

使用

mvn clean package nutzboot:shade nutzboot:war -Dmaven.javadoc.skip=true -Dmaven.test.skip=true

命令打war包,启动时报

IocBean[myMainLauncher] throw Exception when creating

请问这是什么原因?
这是MyMainLauncher的注解

@IocBean(create = "init", depose = "depose")
@Modules(packages = "cn.wizzer")
@Localization(value = "locales/", defaultLocalizationKey = "zh_CN")
@Encoding(input = "UTF-8", output = "UTF-8")
@ChainBy(args = "chain/nutzwk-mvc-chain.json")
@SessionBy(ShiroSessionProvider.class)
public class MyMainLauncher {}
8 回复

报错信息不完整

@wendal 完整的信息

org.nutz.ioc.IocException: IocBean[myMainLauncher] throw Exception when creating
        at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:153)
        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:214)
        at org.nutz.boot.starter.servlet3.NbServletContextListener.contextInitialized(NbServletContextListener.java:79)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5128)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5653)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:1007)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:983)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:639)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1127)
        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:2019)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NullPointerException: null
        at cn.wizzer.app.web.commons.core.MyMainLauncher.init(MyMainLauncher.java:84)
        at cn.wizzer.app.web.commons.core.MyMainLauncher$FM$init$7313064dadbabb1500416cbf83338bd1.invoke(MyMainLauncher.java)
        at org.nutz.ioc.impl.ObjectMakerImpl$2.trigger(ObjectMakerImpl.java:181)
        at org.nutz.ioc.weaver.DefaultWeaver.onCreate(DefaultWeaver.java:89)
        at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:141)
        ... 18 common frames omitted

MyMainLauncher的84行写了啥

@wendal 是nutzwk的默认配置

Globals.AppBase = Mvcs.getServletContext().getContextPath();

什么版本的,具体

nutzwk-mini 5.2.6
@wendal

需要改造一下

新建一个类MainSetup,把init里的逻辑都搬过去,然后在MainLauncher声明@SetupBy

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