spring中做成bean,可以使用property"resourceLoaderPath"指定工程中的路径

<bean id="velocityEngine" class="org.springframework.ui.velocity.VelocityEngineFactoryBean">
<property name="resourceLoaderPath" value="/WEB-INF/classes/templet" />
<property name="velocityProperties">
<props>
<prop key="velocimacro.library">*.vm</prop>
<prop key="default.contentType">text/html; charset=utf-8</prop>
<prop key="output.encoding">utf-8</prop>
<prop key="input.encoding">utf-8</prop>
</props>
</property>
</bean>
如果是new velocityEngine的实例,例如用在test中
可以这样指定路径
VelocityEngine velocityEngine = new VelocityEngine();
Properties p = new Properties();
p.setProperty(Velocity.FILE_RESOURCE_LOADER_PATH, "E:/reyo/project/WEB-INF/classes/templet");
velocityEngine.init(p);

解决org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource的更多相关文章

  1. Caused by: org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getUser' in class org.uncommons.reportng.ReportMetadata threw exception class java.net.UnknownHostException :

    Running TestSuite [TestNG] [WARN] Ignoring duplicate listener : org.uncommons.reportng.HTMLReporter ...

  2. velecity报错:Caused by: org.apache.velocity.exception.ParseErrorException: Lexical error, Encountered: <EOF> after : "\'/order/pay?activity=\" + activityId);\r\n }*/\r\n</script>\r\n#end\r\n" at /a

    Caused by: org.apache.velocity.exception.ParseErrorException: Lexical error, Encountered: <EOF> ...

  3. unable to find resource 'xxx\xx\overview.vm' in any resource loader.

    ResourceManager : unable to find resource 'C:\Test\TestConfig\overview.vm' in any resource loader.or ...

  4. 遇到的错误之"Exception in thread “main“ java.lang.NoClassDefFoundError: org/apache/velocity/context/Context at"

    问题 Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/velocity/context/ ...

  5. phoenix连接hbase数据库,创建二级索引报错:Error: org.apache.phoenix.exception.PhoenixIOException: Failed after attempts=36, exceptions: Tue Mar 06 10:32:02 CST 2018, null, java.net.SocketTimeoutException: callTimeou

    v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VM ...

  6. 《Apache Velocity用户指南》官方文档

    http://ifeve.com/apache-velocity-dev/ <Apache Velocity用户指南>官方文档 原文链接   译文连接 译者:小村长  校对:方腾飞 Qui ...

  7. Apache Spark Exception in thread “main” java.lang.NoClassDefFoundError: scala/collection/GenTraversableOnce$class

    问题: 今天用Maven搭建了一个Spark的Scala项目,运行后遇到下面异常: Apache Spark Exception in thread “main” java.lang.NoClassD ...

  8. [错误]Caused by: org.apache.spark.memory.SparkOutOfMemoryError: Unable to acquire 65536 bytes of memory, got 0

    今天,在运行Spark SQL代码的时候,遇到了以下错误: Caused by: org.apache.spark.SparkException: Job aborted due to stage f ...

  9. Caused by: org.I0Itec.zkclient.exception.ZkTimeoutException: Unable to connect to zookeeper server within timeout: 5000

    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'brandControl ...

随机推荐

  1. CentOS 下的邮件通知

    利用Shell邮件通知 echo "邮件内容" |mail -s 邮件主题 收件人地址 echo "This is Test mail."|mail -s &q ...

  2. matlab中等间距坐标距离表示不等间距数据值,以及延伸

    1.问题 平时只是用了一下plot的简单画图. x轴或者y轴的大小比例都是按照系统自动的生成. 但是如果出现巨大的比例的时候,如何保证在另一个轴上可以同等机会展示结果呢? 2.程序 这里是自己书写的程 ...

  3. 002.RAID创建

    一 创建相应的分区 [root@kauai ~]# fdisk /dev/sdb 最终创建多个用于做RAID的分区,如下: Device Boot Start End Blocks Id System ...

  4. [漏洞分析]phpyun系统重装安全隐患#影响从phpyun4.2部分,4.3到4.5全版本

    0x00 之前在t00ls上看到的,漏洞原理很简单,但是都是细节问题,很值得去学习. 感谢bypass师傅. 也发了邮件给官方,但没有任何回复,估计是漏洞作者bypass师傅报备了吧.   0x01 ...

  5. SDOI2013 R1 Day1

    目录 2018.3.22 Test 总结 T1 BZOJ.3122.[SDOI2013]随机数生成器(BSGS 等比数列) T2 BZOJ.3123.[SDOI2013]森林(主席树 启发式合并) T ...

  6. [HDU2138]How many prime numbers

    来源: HDU 2007-11 Programming Contest_WarmUp 题目大意:素数判定. 思路: 事实上暴力判定也可以过,但我还是用了Miller-Rabin算法. 核心思想:利用费 ...

  7. Java_Certificates does not conform to algorithm constraints

    java.security.cert.CertificateException: Certificates does not conform to algorithm constraints SSL证 ...

  8. 华为交换机VRRP配置实例收集(转)

    示例图: 其实说白了就是做线路冗余,达到热备切换. 组网需求: 楼层1和楼层2分别通过两条线路做冗余接入交换机(本示例只考虑vrrp,暂不考虑其他方面).当其中一段链路故障时,能通过另外一条链路传输. ...

  9. 【转】topcoder插件配置(傻瓜教程-图文版)

    地址:http://whucc2009luochen.blog.163.com/blog/static/1305715602010827102342860/ 1.插件下载地址:http://www.t ...

  10. HDU 4751 Divide Groups (2013南京网络赛1004题,判断二分图)

    Divide Groups Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Tot ...