title: Unable to load template when URLResourceLoader is used with Velocity
body: <p>I am getting the following error when I try to access access Velocity template using URLResourceLoader.</p>
  
  <p><em>org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource '<a href="http://localhost:8080/myvelocityapp/my-template.vm" rel="nofollow noreferrer">http://localhost:8080/myvelocityapp/my-template.vm</a>'
            at org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(ResourceManagerImpl.java:483)</em></p>
  
  <p>I am able to see the above file if i copy paste the URL into my browser. However the code is not able to access the URL. My templating code seems to be correct because it works fine when i try to use ClassPathResourceLoader. It is just the url resource loader which gives problem.</p>
  
  <p>Thanks.</p>
  
  <p>EDIT---</p>
  
  <p>I wrote a small jUnit to see what the problem is:</p>
  
  <pre><code>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 {
          super.setUp();
      }
  
      public void testVelocity() throws IOException {
          URL url= new URL("http://localhost:8080/myvelocityapp/my-template.vm");
          System.out.println(url.openStream().toString());
  
      }
  
      protected void tearDown() throws Exception {
          super.tearDown();
      }
  
  }
  </code></pre>
  
  <p>And the above code is able to access the URL.</p>