NutzCN Logo
问答 nutzwk mini版本 war运行问题
发布于 13天前 作者 码农 92 次浏览 复制 上一个帖子 下一个帖子
标签: nutzwk

检查到MyMainLauncher类中78行,然后找到AppBase

[ERROR] 17:04:09.200 [localhost-startStop-1] org.nutz.boot.NbApp - something happen!!
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:4853)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5314)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:753)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:729)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:940)
        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1816)
        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:98)
        at cn.wizzer.app.web.commons.core.MyMainLauncher$FM$init$04cccf21157b699770a08f9921b45d55.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
    public void init() {
        Mvcs.X_POWERED_BY = "NutzWk-Mini 1.0.0 <wizzer.cn>";
        Globals.AppBase = Mvcs.getServletContext().getContextPath();
        Globals.AppRoot = Mvcs.getServletContext().getRealPath("/");
        //注册自定义标签
        groupTemplate.registerTagFactory("cms_channel_list", () -> ioc.get(CmsChannelListTag.class));
        groupTemplate.registerTagFactory("cms_channel", () -> ioc.get(CmsChannelTag.class));
        groupTemplate.registerTagFactory("cms_article_list", () -> ioc.get(CmsArticleListTag.class));
        groupTemplate.registerTagFactory("cms_article", () -> ioc.get(CmsArticleTag.class));
        groupTemplate.registerTagFactory("cms_link_list", () -> ioc.get(CmsLinkListTag.class));
        init_sys();
        init_task();
        ioc.get(Globals.class);
    }
  //项目路径
    public static String AppRoot = "";
    //项目目录
    public static String AppBase = "";
    //项目名称
    public static String AppName = "NutzWk 开发框架";
    //项目短名称
    public static String AppShrotName = "NutzWk";
    //项目域名
    public static String AppDomain = "http://127.0.0.1";
13 回复

127.0.0.1:8080 地址访问,难道有哪些需要修改路径的吗?jar包在本地是可以正常运行正常访问

哦,说错,98行,我这边一路寻过去是指到AppBase

at cn.wizzer.app.web.commons.core.MyMainLauncher.init(MyMainLauncher.java:98)

用的不是最新代码, 因为需要这个方法

    public static NbApp warMain(ServletContext sc) {
        NbApp nb = new NbApp().setPrintProcDoc(true);
        nb.getAppContext().setMainPackage("cn.wizzer");

        return nb;
    }

这个方法有

   public static void main(String[] args) throws Exception {
        NbApp nb = new NbApp().setArgs(args).setPrintProcDoc(true);
        nb.getAppContext().setMainPackage("cn.wizzer");
        nb.run();
    }

    public static NbApp warMain(ServletContext sc) {
        NbApp nb = new NbApp().setPrintProcDoc(true);
        nb.getAppContext().setMainPackage("cn.wizzer");

        return nb;
    }

先更新到最新代码吧

尴尬,业务代码已经写好了,就等着部署了,代码是8月份中旬的,应该算是比较新的了吧

现在很尴尬,jar在本地能运行,放到linux服务器上就不能好好玩了,然后想试一下war包,war在本地都没法玩啊,

@wendal 兽总,江湖救急啊,还有别的解决办法吗?linux上运行jar不能完美运行啊

把那先用jar部署嘛

不然肯定会执行呀

我觉得你还是用jar部署啦,没那么多事情呀

linux上用jar部署失败了,现在用war可以正常部署了,

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