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. 移动端调试利器之vconsole

    说明 由于移动端项目在手机中调试时不能使用chrome的控制台,而vconsole是对pc端console的改写 使用方法 使用 npm 安装: npm install vconsole 使用webp ...

  2. jQuery下的onChange事件在某些情况下无效

    onChage无效的原因: 虽然表面上感觉是当内容发生变化时,就会触发onchange事件,但是那只能在页面上操作.而如果通过dom对象去修改它的value则什么事也不会发生. onchange触发原 ...

  3. 我的CSS命名规则

    常见class关键词: 布局类:header, footer, container, main, content, aside, page, section 包裹类:wrap, inner 区块类:r ...

  4. R语言学习笔记:使用tcltk包显示进度条

    一般在跑耗时较长的程序时,我们不知道程序到底有没有正常跑着,或者在爬虫的时候不知道爬到什么时候断了.因此可以添加进度条来显示当前进度,观察进度是否有进展.当进度条卡住的时候,可以判断程序断线,从而可以 ...

  5. Boost学习资源

    http://blog.csdn.net/huang_xw/article/details/8758212

  6. springmvc中使用MockMvc测试controller

    示例代码 import com.alibaba.fastjson.JSONObject; import org.junit.Before; import org.junit.Test; import ...

  7. 10BASE

    10BASE-T,10BASE-5,10BASE-2,以太网的技术标准,10Base-2.10Base-5.10Base-T都是以太网的技术标准,传输速率为10Mbps.   10Base-2技术以细 ...

  8. Java NIO-3

    http://itindex.net/detail/55603-java-nio-%E6%8A%80%E6%9C%AF

  9. Servlet接口、GenericServlet类、HttpServlet类

    Servlet是最顶层的接口,其提供的方法有: init(ServletConfig config):void // 初始化 getServletConfig():ServletConfig // 取 ...

  10. GBDT算法

    GBDT通过多轮迭代,每轮迭代产生一个弱分类器,其中弱分类器通常选择为CART树,每个分类器在上一轮分类器的残差基础上进行训练. 对于GBDT算法,其中重要的知识点为: 1.GBDT是梯度下降法从参数 ...