You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by "Pugh, Eric" <EP...@MuseumCompany.com> on 2001/08/23 23:10:35 UTC

Error Finding template

Hi all,

I was able to set up the basic Example servlets for Velocity using Tomcat
3.2.3.  However, with the Forumdemo example, I am having problems.  Instead
of using the WAR, I put the source under my webapps folder.

However, when I try and load up the ControllerServlet, I get this error:

ForumDemo : Error processing the request


There was a problem in the request.

The relevant error is :
ForumDemo -> ControllerServlet.handleRequest() : Cannot find template
list.vm


The error occurred at :

java.lang.Exception: handleRequest(Context) returned null - no template
selected! at
org.apache.velocity.servlet.VelocityServlet.handleRequest(VelocityServlet.ja
va:561) at
org.apache.velocity.servlet.VelocityServlet.doRequest(VelocityServlet.java:3
33) at
org.apache.velocity.servlet.VelocityServlet.doGet(VelocityServlet.java:294)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at
javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at
org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405) at
org.apache.tomcat.core.Handler.service(Handler.java:287) at
org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372) at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:81
2) at org.apache.tomcat.core.ContextManager.service(ContextManager.java:758)
at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
onnectionHandler.java:213) at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416) at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
at java.lang.Thread.run(Thread.java:484) 


I put some debugging System.out.println's into the ControllerServlet that
gives me this output:

About to load up servlet
propsFile/WEB-INF/conf/velocity.properties
realPathC:\java\tomcat\webapps\forumdemo\WEB-INF\conf\velocity.properties
Path for file read from properties:{file.resource.loader.path=/template,
runtime.log=/forumdemo_velo
city.log}
Path for file resouces:C:\java\tomcat\webapps\forumdemo\template
Path for log:C:\java\tomcat\webapps\forumdemo\forumdemo_velocity.log
hi, just hit handle request
About to call processRequest for list
I'm About to call getTemplate for list.vm
org.apache.velocity.exception.ResourceNotFoundException: Unable to find
resource 'list.vm'
        at
org.apache.velocity.runtime.resource.ResourceManager.getResource(ResourceMan
ager.java:423
)
        at org.apache.velocity.runtime.Runtime.getTemplate(Runtime.java:686)
        at org.apache.velocity.runtime.Runtime.getTemplate(Runtime.java:668)
        at
org.apache.velocity.servlet.VelocityServlet.getTemplate(VelocityServlet.java
:501)
        at
org.apache.velocity.demo.ControllerServlet.handleRequest(ControllerServlet.j
ava:186)
        at
org.apache.velocity.servlet.VelocityServlet.handleRequest(VelocityServlet.ja
va:551)
        at
org.apache.velocity.servlet.VelocityServlet.doRequest(VelocityServlet.java:3
33)
        at
org.apache.velocity.servlet.VelocityServlet.doGet(VelocityServlet.java:294)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at
org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
        at org.apache.tomcat.core.Handler.service(Handler.java:287)
        at
org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
        at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:81
2)
        at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:758)
        at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
onnectionHand
ler.java:213)
        at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
        at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
        at java.lang.Thread.run(Thread.java:484)
ForumDemo -> ControllerServlet.handleRequest() : Cannot find template
list.vm


Despite the fact that Velocity/Tomcat knows that the template directory is
C:\java\tomcat\webapps\forumdemo\template, when the ResourceManager tries to
check if the resource has data, it gets back a null and then throws the
ResourceNotFoundException.  I tried figuring out what exactly accesses the
file system and tracked it down to Template.process().  But, I don't
understand why he can't seem to find the file on the filesystem...

Any suggestions?

Eric