开发者社区> 问答> 正文

Rythm设置 home.template 配置项后运行报错 403.10 禁止访问:配置无效 

小白请教~~最近学习Rythm,跟着教程在做例子时报错。教程地址:http://rythmengine.org/doc/tutorial.md#env
代码如下:

import org.rythmengine.Rythm;
import java.util.*;

public class HelloWorld {
    public static void main(String[] args) {
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("home.template", "resources");
        Rythm.init(map);
        System.out.println(Rythm.render("helloworld.html", "World"));
    }
}

请问home.template是在配置文件中存在么,教程中没有提到这个配置在哪里。
报错信息空指针异常,具体如下:

run: [java] java.lang.NullPointerException [java]     at org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava .java:194) [java]     at org.apache.tools.ant.taskdefs.Java.run(Java.java:764) [java]     at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:218)

 [java]     at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:132)

 [java]     at org.apache.tools.ant.taskdefs.Java.execute(Java.java:105)
 [java]     at org.apache.tools.ant.UnknownElement.execute(UnknownElement.ja

va:288) [java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcces sorImpl.java:39) [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMet hodAccessorImpl.java:25) [java] at java.lang.reflect.Method.invoke(Method.java:597) [java] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchU tils.java:106) [java] at org.apache.tools.ant.Task.perform(Task.java:348) [java] at org.apache.tools.ant.Target.execute(Target.java:357) [java] at org.apache.tools.ant.Target.performTasks(Target.java:385) [java] at org.apache.tools.ant.Project.executeSortedTargets(Project.jav a:1337) [java] at org.apache.tools.ant.Project.executeTarget(Project.java:1306)

 [java]     at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(De

faultExecutor.java:41) [java] at org.apache.tools.ant.Project.executeTargets(Project.java:1189 ) [java] at org.apache.tools.ant.Main.runBuild(Main.java:758) [java] at org.apache.tools.ant.Main.startAnt(Main.java:217) [java] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257) [java] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104) [java] Caused by: java.lang.NullPointerException [java] at org.rythmengine.resource.TemplateResourceManager.<init>(Templ ateResourceManager.java:168) [java] at org.rythmengine.RythmEngine.init(RythmEngine.java:636) [java] at org.rythmengine.RythmEngine.<init>(RythmEngine.java:561) [java] at org.rythmengine.Rythm.init(Rythm.java:97) [java] at HelloWord.main(Unknown Source) [java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcces sorImpl.java:39) [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMet hodAccessorImpl.java:25) [java] at java.lang.reflect.Method.invoke(Method.java:597) [java] at org.apache.tools.ant.taskdefs.ExecuteJava.run(ExecuteJava.jav a:217) [java] at org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava .java:152) [java] ... 21 more [java] --- Nested Exception --- [java] java.lang.NullPointerException [java] at org.rythmengine.resource.TemplateResourceManager.<init>(Templ ateResourceManager.java:168) [java] at org.rythmengine.RythmEngine.init(RythmEngine.java:636) [java] at org.rythmengine.RythmEngine.<init>(RythmEngine.java:561) [java] at org.rythmengine.Rythm.init(Rythm.java:97) [java] at HelloWord.main(Unknown Source) [java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcces sorImpl.java:39) [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMet hodAccessorImpl.java:25) [java] at java.lang.reflect.Method.invoke(Method.java:597) [java] at org.apache.tools.ant.taskdefs.ExecuteJava.run(ExecuteJava.jav a:217) [java] at org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava .java:152) [java] at org.apache.tools.ant.taskdefs.Java.run(Java.java:764) [java] at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:218)

 [java]     at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:132)

 [java]     at org.apache.tools.ant.taskdefs.Java.execute(Java.java:105)
 [java]     at org.apache.tools.ant.UnknownElement.execute(UnknownElement.ja

va:288) [java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcces sorImpl.java:39) [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMet hodAccessorImpl.java:25) [java] at java.lang.reflect.Method.invoke(Method.java:597) [java] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchU tils.java:106) [java] at org.apache.tools.ant.Task.perform(Task.java:348) [java] at org.apache.tools.ant.Target.execute(Target.java:357) [java] at org.apache.tools.ant.Target.performTasks(Target.java:385) [java] at org.apache.tools.ant.Project.executeSortedTargets(Project.jav a:1337) [java] at org.apache.tools.ant.Project.executeTarget(Project.java:1306)

 [java]     at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(De

faultExecutor.java:41) [java] at org.apache.tools.ant.Project.executeTargets(Project.java:1189 ) [java] at org.apache.tools.ant.Main.runBuild(Main.java:758) [java] at org.apache.tools.ant.Main.startAnt(Main.java:217) [java] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257) [java] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104) [java] Java Result: -1

 

展开
收起
kun坤 2020-05-27 11:30:06 533 0
1 条回答
写回答
取消 提交回答
  • 我不能重现你这个问题呢?你的Rythm版本是多少?能把你的项目打个包放到网盘上让我看看吗?

    2020-05-27 12:51:26
    赞同 展开评论 打赏
问答地址:
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载