You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by julia schmitz <ju...@web.de> on 2006/04/30 17:21:55 UTC
FW: can not find velocity template vm
Hello to all Velocity - User,
Can someone help me: Where is the mistake why i get the this Error:
Error: org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource 'displaylist.vm'
I give you some more information about my application.
I have installed Eclipse 3.1.2, Tomcat 5.0.28 and Sysdeo (Tomcat Plugin) 3.1.0. In the %CATALINA_HOME%confweb.xml File i activated the Invoker Servlet.
My Classpath is :
ANT_HOME C:javaant
CATALINA_HOME C:ProgrammeApache Software FoundationTomcat
JAVA_HOME C:javaj2sdk
Then i added a new Tomcat Project into
D:My DocumentsEclipseworkspacePM --> application_root (app_root)
D:My DocumentsEclipseworkspaceIPMWEB-INFlib: here i put the velocity-dep-1.4.jar file
In the WEB-INF i created 2 files: web.xml and velocity.properties:
web.xml:
<web-app xmlns="http://java.sun.com/xml/ns/j2ee [http://java.sun.com/xml/ns/j2ee]"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance [http://www.w3.org/2001/XMLSchema-instance]"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee [http://java.sun.com/xml/ns/j2ee] http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd [http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd]"
version="2.4">
<display-name>Test</display-name>
<description> Test </description>
<servlet>
<servlet-name>Test</servlet-name>
<servlet-class>/Test</servlet-class>
<init-param>
<param-name>properties</param-name>
<param-value>>/WEB-INF/velocity.properties</param-value>
</init-param>
<servlet-mapping>
<servlet-name>Test</servlet-name>
<url-pattern>/Test</url-pattern>
</servlet-mapping>
</servlet>
</web-app>
velocity.properties:
file.resource.loader.path = /
file.resource.loader.cache = true
file.resource.loader.modificationCheckInterval = 1
runtime.log.error.stacktrace = true
runtime.log = /WEB-INF/velocity.log
This is my test Class:
package test;
import java.io.PrintWriter;
import java.util.Vector;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.velocity.*;
import org.apache.velocity.context.Context;
import org.apache.velocity.*;
import org.apache.velocity.app.*;
import org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader;
import org.apache.velocity.servlet.*;
import org.apache.velocity.context.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
import java.io.*;
import org.apache.velocity.servlet.VelocityServlet;
import java.io.*;
public class Test extends VelocityServlet {
public Template handleRequest(HttpServletRequest request,
HttpServletResponse response, Context context)throws Exception {
PrintWriter out = response.getWriter();
Vector v = new Vector();
v.add("one");
v.add("two");
v.add("three");
context.put("list", v);;
Template template = null;
try {
template = Velocity.getTemplate("displaylist.vm");
} catch (Exception e) {
out.println("<html>");
out.println("<head>");
out.println("<title>Error</title>");
out.println("</head>");
out.println("<body>");
out.println("<h1>This is the Error:</h1>");
out.println("Error: " + e);
out.println("</body>");
out.println("</html>");
}
return template;
}
}
I put the displaylist.vm in the app_root.
I hope you can understand what i did and can you see where is the mistake?
Thank you very very much because i tried eveything and the template is not found.
Bye Bye
Julia
SMS schreiben mit WEB.DE FreeMail - einfach, schnell und
kostenguenstig. Jetzt gleich testen! *http://f.web.de/?mc=021192* [http://f.web.de/?mc=021192]
Re: FW: can not find velocity template vm
Posted by Nathan Bubna <nb...@gmail.com>.
Please send Velocity usage questions to the velocity-user list and do
not cross post your messages to both lists. Those of us subscribed to
both lists only need one copy, thanks.
On 4/30/06, julia schmitz <ju...@web.de> wrote:
>
>
>
>
>
>
> Hello to all Velocity - User,
>
> Can someone help me: Where is the mistake why i get the this Error:
>
> Error: org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource 'displaylist.vm'
>
> I give you some more information about my application.
>
> I have installed Eclipse 3.1.2, Tomcat 5.0.28 and Sysdeo (Tomcat Plugin) 3.1.0. In the %CATALINA_HOME%confweb.xml File i activated the Invoker Servlet.
>
> My Classpath is :
>
> ANT_HOME C:javaant
>
> CATALINA_HOME C:ProgrammeApache Software FoundationTomcat
>
> JAVA_HOME C:javaj2sdk
>
>
>
> Then i added a new Tomcat Project into
>
> D:My DocumentsEclipseworkspacePM --> application_root (app_root)
>
> D:My DocumentsEclipseworkspaceIPMWEB-INFlib: here i put the velocity-dep-1.4.jar file
>
> In the WEB-INF i created 2 files: web.xml and velocity.properties:
>
> web.xml:
>
> <web-app xmlns="http://java.sun.com/xml/ns/j2ee [http://java.sun.com/xml/ns/j2ee]"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance [http://www.w3.org/2001/XMLSchema-instance]"
> xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee [http://java.sun.com/xml/ns/j2ee] http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd [http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd]"
> version="2.4">
>
> <display-name>Test</display-name>
> <description> Test </description>
> <servlet>
> <servlet-name>Test</servlet-name>
> <servlet-class>/Test</servlet-class>
> <init-param>
> <param-name>properties</param-name>
> <param-value>>/WEB-INF/velocity.properties</param-value>
> </init-param>
> <servlet-mapping>
> <servlet-name>Test</servlet-name>
> <url-pattern>/Test</url-pattern>
> </servlet-mapping>
> </servlet>
> </web-app>
>
> velocity.properties:
>
> file.resource.loader.path = /
> file.resource.loader.cache = true
> file.resource.loader.modificationCheckInterval = 1
> runtime.log.error.stacktrace = true
> runtime.log = /WEB-INF/velocity.log
>
> This is my test Class:
>
> package test;
>
> import java.io.PrintWriter;
> import java.util.Vector;
> import javax.servlet.http.HttpServletRequest;
> import javax.servlet.http.HttpServletResponse;
> import org.apache.velocity.*;
> import org.apache.velocity.context.Context;
> import org.apache.velocity.*;
> import org.apache.velocity.app.*;
> import org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader;
> import org.apache.velocity.servlet.*;
> import org.apache.velocity.context.*;
> import javax.servlet.*;
> import javax.servlet.http.*;
> import java.util.*;
> import java.io.*;
> import org.apache.velocity.servlet.VelocityServlet;
> import java.io.*;
>
> public class Test extends VelocityServlet {
>
> public Template handleRequest(HttpServletRequest request,
> HttpServletResponse response, Context context)throws Exception {
>
> PrintWriter out = response.getWriter();
> Vector v = new Vector();
> v.add("one");
> v.add("two");
> v.add("three");
> context.put("list", v);;
> Template template = null;
> try {
> template = Velocity.getTemplate("displaylist.vm");
>
> } catch (Exception e) {
>
> out.println("<html>");
> out.println("<head>");
> out.println("<title>Error</title>");
> out.println("</head>");
> out.println("<body>");
> out.println("<h1>This is the Error:</h1>");
> out.println("Error: " + e);
> out.println("</body>");
> out.println("</html>");
> }
> return template;
> }
> }
>
>
>
> I put the displaylist.vm in the app_root.
>
> I hope you can understand what i did and can you see where is the mistake?
>
> Thank you very very much because i tried eveything and the template is not found.
>
> Bye Bye
>
> Julia
>
>
>
>
> SMS schreiben mit WEB.DE FreeMail - einfach, schnell und
> kostenguenstig. Jetzt gleich testen! *http://f.web.de/?mc=021192* [http://f.web.de/?mc=021192]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org
Re: can not find velocity template vm
Posted by Llewellyn Falco <is...@setgame.com>.
ok, so the if you just want to debug, allow these suggestions.
1) not sure if it was a copy/paste, but if it is there is a double >>
> <param-value>>/WEB-INF/velocity.properties</param-value>
2) check that your properties are being loaded.
System.out.println("runtime.log = " + new
VelocityEngine().getProperty("runtime.log"));
3) check that you root path is what you think it is.
System.out.println("default path = " + new
File("/").getAbsolutePath());
other points, not really related....
4) you mentioned you are using eclipse, pay attention to the warnings. it
will show stuff like the double ;; and the imports, which are easy to clean
with an organize imports (ctrl + shift + o)
5) likewise checkout veloeclipse for your templates
Help -> Software Updates -> Find and Install... -> Search for new features
to install -> Add Update Site... ->
Name : Veloeclipse
URL: http://propsorter.sourceforge.net/veloeclipse
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org