Results 1 to 4 of 4

Thread: Velocity Error

  1. #1
    trilochan is offline Member
    Join Date
    Sep 2009
    Posts
    3
    Rep Power
    0

    Question Velocity Error

    Hi, I didnt know where to post this msg. So here it is. I am trying to write a velocity template program using eclipse. Here's the code:
    package velocityExample;

    import java.io.StringWriter;

    import org.apache.velocity.Template;
    import org.apache.velocity.VelocityContext;
    import org.apache.velocity.app.VelocityEngine;

    public class HelloWorld {
    public static void main( String[] args )
    throws Exception {
    VelocityEngine ve = new VelocityEngine();
    ve.init();
    Template t = new Template();
    ve.getTemplate("helloworld.vm");
    VelocityContext context = new VelocityContext();
    context.put("name", "World");
    StringWriter writer = new StringWriter();
    t.merge( context, writer );
    System.out.println( writer.toString() );
    }
    }
    The template file "helloworld.vm" is present in the same folder.
    But still it shows a error
    Exception in thread "main" org.apache.velocity.exception.ResourceNotFoundExce ption: Unable to find resource 'helloworld.vm'
    at org.apache.velocity.runtime.resource.ResourceManag erImpl.loadResource(ResourceManagerImpl.java:458)
    at org.apache.velocity.runtime.resource.ResourceManag erImpl.getResource(ResourceManagerImpl.java:341)
    at org.apache.velocity.runtime.RuntimeInstance.getTem plate(RuntimeInstance.java:831)
    at org.apache.velocity.runtime.RuntimeInstance.getTem plate(RuntimeInstance.java:813)
    at org.apache.velocity.app.VelocityEngine.getTemplate (VelocityEngine.java:470)
    at velocityExample.HelloWorld.main(HelloWorld.java:15 )
    Please help. ( I have tried by giving the absolute path also.)

  2. #2
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    Try using the mailing list refered to at the site from where you downloaded velocity.

  3. #3
    trilochan is offline Member
    Join Date
    Sep 2009
    Posts
    3
    Rep Power
    0

    Default

    Quote Originally Posted by masijade View Post
    Try using the mailing list refered to at the site from where you downloaded velocity.
    Pls could you explain what you meant?? Anyways I didn't download anything. I work at a company. So velocity jars are already downloaded and configured with eclipse environment.

  4. #4
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    Then go to Welcome! - The Apache Software Foundation, navigate to Velocity from there, then find the mailing list or forum from there, and post a question then there.

Similar Threads

  1. Replies: 3
    Last Post: 01-23-2009, 09:53 AM
  2. error 530 error authentication required
    By rgale in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 05-12-2008, 05:28 PM
  3. Velocity / XML response
    By sabatier in forum XML
    Replies: 0
    Last Post: 07-24-2007, 02:13 PM
  4. Velocity, cannot find resource
    By sandor in forum Web Frameworks
    Replies: 1
    Last Post: 05-17-2007, 11:58 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •