[英]Getting NullPointerException at org.apache.velocity.runtime.RuntimeInstance.parse(RuntimeInstance.java:1198)
Migrated from迁移自
<groupId>org.apache.velocity</groupId>
<artifactId>velocity</artifactId>
<version>1.5</version>
to到
<groupId>org.apache.velocity</groupId>
<artifactId>velocity</artifactId>
<version>1.7</version>
Upon the execution of following instruction在执行以下指令时
VelocityContext vc = getVelocityContext(valuesMap);
StringWriter writer = new StringWriter();
Velocity.evaluate(vc, writer, "[generate email processor - event id = " + event.getId() + "]", bodyTemplate);
I am getting我得到
java.lang.NullPointerException
at org.apache.velocity.runtime.RuntimeInstance.parse(RuntimeInstance.java:1198)
at org.apache.velocity.runtime.RuntimeInstance.parse(RuntimeInstance.java:1181)
at org.apache.velocity.runtime.RuntimeInstance.evaluate(RuntimeInstance.java:1297)
at org.apache.velocity.runtime.RuntimeInstance.evaluate(RuntimeInstance.java:1265)
at org.apache.velocity.app.Velocity.evaluate(Velocity.java:180)
at net.nationalpayment.core.backend.GenerateMessageProcessor$EventProcessor.generateMessage(GenerateMessageProcessor.java:1361)
at net.nationalpayment.core.backend.GenerateMessageProcessor$EventProcessor.run(GenerateMessageProcessor.java:1155)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
java.lang.NullPointerException
at org.apache.velocity.runtime.RuntimeInstance.parse(RuntimeInstance.java:1198)
at org.apache.velocity.runtime.RuntimeInstance.parse(RuntimeInstance.java:1181)
at org.apache.velocity.runtime.RuntimeInstance.evaluate(RuntimeInstance.java:1297)
at org.apache.velocity.runtime.RuntimeInstance.evaluate(RuntimeInstance.java:1265)
at org.apache.velocity.app.Velocity.evaluate(Velocity.java:180)
at net.nationalpayment.core.backend.GenerateMessageProcessor$EventProcessor.generateMessage(GenerateMessageProcessor.java:1361)
at net.nationalpayment.core.backend.GenerateMessageProcessor$EventProcessor.run(GenerateMessageProcessor.java:1155)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
I am initializing the RuntimeSingleton once during the execution of application as below.我在应用程序执行期间初始化 RuntimeSingleton 一次,如下所示。
if(!RuntimeSingleton.isInitialized()) {
RuntimeSingleton.init();
}
Why am i getting the NullPointerException ?为什么我得到 NullPointerException ?
In velocity (version 1.7).在速度(版本 1.7)。 Properties have been externalize to a property file named velocity.property.
属性已被外部化为名为velocity.property 的属性文件。
After specifying the below mentioned properties leaving all others with default values as per my requirement.The issue got resolved.根据我的要求指定下面提到的属性后,所有其他属性都使用默认值。问题得到解决。
runtime.log = /tmp/velocity.log runtime.log = /tmp/velocity.log
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.