简体   繁体   English

在 org.apache.velocity.runtime.RuntimeInstance.parse(RuntimeInstance.java:1198) 处获取 NullPointerException

[英]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.

相关问题 Velocity 2.0:NoClassDefFoundError:org / apache / velocity / runtime / log / CommonsLogLogChute - Velocity 2.0: NoClassDefFoundError: org/apache/velocity/runtime/log/CommonsLogLogChute 异常org.apache.jasper.JasperException:java.lang.NullPointerException - Exception org.apache.jasper.JasperException: java.lang.NullPointerException Apache velocity:org.apache.velocity.exception.ResourceNotFoundException - Apache velocity: org.apache.velocity.exception.ResourceNotFoundException org.apache.velocity.exception.ResourceNotFoundException - org.apache.velocity.exception.ResourceNotFoundException 异常 org.apache.jasper.JasperException:java.lang.NullPointerException 根本原因 java.langullException.N - exception org.apache.jasper.JasperException: java.lang.NullPointerException root cause java.lang.NullPointerException 在Java中解析速度变量 - Parse velocity variables within java 通过调用org.apache.lucene.benchmark.byTask.feeds.TrecGov2Parser.parse获取NullPointerException - Get NullPointerException from calling org.apache.lucene.benchmark.byTask.feeds.TrecGov2Parser.parse 在Java中替换Apache Velocity中的标记 - Replace tag in Apache velocity in java org.apache.tiles.access.TilesAccess.getContainer(TilesAccess.java:124)上的java.lang.NullPointerException - java.lang.NullPointerException at org.apache.tiles.access.TilesAccess.getContainer(TilesAccess.java:124) org.apache.poi.xwpf.converter.core.XWPFConverterException:java.lang.NullPointerException(Java) - org.apache.poi.xwpf.converter.core.XWPFConverterException: java.lang.NullPointerException (Java)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM