I get the next error after i attempt to access access Velocity template using URLResourceLoader.

org.apache.velocity.exception.ResourceNotFoundException: Not able to locate resource 'http://localhost:8080/myvelocityapp/my-template.vm' at org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(ResourceManagerImpl.java:483)

I can begin to see the above file basically copy paste the URL into my browser. Nevertheless the code can't access the URL. My templating code appears to become correct since it works fine after i use ClassPathResourceLoader. It is only the url resource loader which provides problem.



I authored a little jUnit to determine what the issue is:

import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;

import junit.framework.TestCase;

public class TestUrl extends TestCase {

    protected void setUp() throws Exception {

    public void testVelocity() throws IOException {
        URL url= new URL("http://localhost:8080/myvelocityapp/my-template.vm");


    protected void tearDown() throws Exception {


And also the above code has the capacity to access the URL.

Finally found the problem.

The issue was that "url.resource.loader.root" wasn't specified.