You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Jeff Duska <Je...@noaa.gov> on 2002/06/25 20:24:04 UTC

VelocityViewServlet problem....

Howdy folks...

I'm not sure what I've done wrong, but I'm my velocity files are not 
getting rendered with VelocityViewServlet. Please forgive me if this is 
something simple. I'm new to Velocity.

Here is what I did I have a Tomcat project in Eclipse.

I copied the lib directory, web.xml, toolbox.xml from the 
velocity-tools\view\examples\simple\WEB-INF. I removed the following 
section out of the web.xml file, since I'm not using tooltoy.class.

  <init-param>
       <param-name>toolbox</param-name>
       <param-value>/WEB-INF/toolbox.xml</param-value>
    </init-param>

    <load-on-startup>10</load-on-startup>

I figured I try my beans after I showed that simple foreach loop worked. 
   I renamed the index.vm to test.vm. I removed the toytool.getMessage 
code from the test.vm.

When I go to my site in Tomcat, I see the velocity code

#foreach($i in [1..5])i$ #end

not the

Lets count 1 2 3 4 5

I check my log file I says the my web.xml is not found. I don't 
understand, since it is sitting right in the WEB-INF directory. I 
checked my server.xml file the context looks correct

<Context path="/UserServlet" docBase="c:\workspace\UserServlet\WEB-INF" 
workDir="c:\workspace\UserServlet\WEB-INF\work\org\apache\jsp" />

c:\workspace\UserServlet\WEB-INF is where my web.xml file is. I would 
expect a different error, if I had corrupted the web.xml file when I 
edited it.

Help. Can you give me pointers on how to track this down? I like 
Eclipse, but I'm wondering if I might better off using Ant build. This 
way I could create a war file automaticly as part of the process. I wish 
that Exlipse just used Ant instead of its stupid .project file, but that 
is a subject for another group.

Regards,


Jeffrey Duska
IMC
Applications Programmer
jeff.duska@noaa.gov

NCDC
151 Patton Avenue
Suite 468
Asheville, NC 28801
(828)271-4485 Office
(828)273-7441 Cell



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: VelocityViewServlet problem.... (solved)

Posted by Jeff Duska <Je...@noaa.gov>.
Tim

Thanks for the help. I had my template in the wrong directory. I 
co-worker pointed out my mistake. It works fine now.

Regards,

Jeff


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: VelocityViewServlet problem....

Posted by Jeff Duska <Je...@noaa.gov>.
> What's your directory tree look like? Where's test.vm live?
> 
> 
> Tim
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 
> 

I figured it was pretty standard except that it lives in the Eclipse 
workspace instead of Tomcat's webapp directory.

Here it is

workspace (dir)
	UserServer (dir)
		WEB-INF
			classes (dir)
			lib (dir)
			src (dir)
			work (Eclipse working directory)
			build.xml
			test.vm
			toolbox.xml
			web.xml
		work (Eclipse working directory)
		.classpath	(Eclipse files)
		.project
		.tomcatplugin

It is pretty standard stuff.



Jeffrey Duska
IMC
Applications Programmer
jeff.duska@noaa.gov

NCDC
151 Patton Avenue
Suite 468
Asheville, NC 28801
(828)271-4485 Office
(828)273-7441 Cell



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: VelocityViewServlet problem....

Posted by Tim Colson <tc...@cisco.com>.
> When I change the path to this I get the following exception, 
> which says  it can't find the test.vm. 
Ok - different problem. At least now the webapp is running. :-)

> VelocityServlet : Error processing the template
> org.apache.velocity.exception.ResourceNotFoundException: 
> Unable to find resource '/test.vm'

What's your directory tree look like? Where's test.vm live?


Tim


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: VelocityViewServlet problem....

Posted by Jeff Duska <Je...@noaa.gov>.
Tim Colson wrote:
> Jeff -
> 
> 
>>I check my log file I says the my web.xml is not found.
> 
> 
> I'd guess it's telling the truth. ;-)
> 
> 
>>I checked my server.xml file the context looks correct
>><Context path="/UserServlet" 
>>docBase="c:\workspace\UserServlet\WEB-INF" 
>>workDir="c:\workspace\UserServlet\WEB-INF\work\org\apache\jsp" />


When I change the path to this I get the following exception, which says 
it can't find the test.vm. I figured that it wasn't setup right. This is 
why I moved the docBase to WEB-INF directory.

VelocityServlet : Error processing the template

org.apache.velocity.exception.ResourceNotFoundException: Unable to find 
resource '/test.vm'
org.apache.velocity.exception.ResourceNotFoundException: Unable to find 
resource '/test.vm'
	at 
org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(ResourceManagerImpl.java:502)
	at 
org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(ResourceManagerImpl.java:386)
	at 
org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:812)
	at 
org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:794)
	at 
org.apache.velocity.runtime.RuntimeSingleton.getTemplate(RuntimeSingleton.java:337)
	at 
org.apache.velocity.servlet.VelocityServlet.getTemplate(VelocityServlet.java:524)
	at 
org.apache.velocity.tools.view.servlet.VelocityViewServlet.handleRequest(VelocityViewServlet.java:282)
	at 
org.apache.velocity.servlet.VelocityServlet.doRequest(VelocityServlet.java:356)
	at 
org.apache.velocity.servlet.VelocityServlet.doGet(VelocityServlet.java:317)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
	at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
	at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
	at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
	at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
	at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
	at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
	at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
	at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2343)
	at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
	at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
	at 
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
	at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
	at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
	at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
	at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
	at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
	at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
	at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
	at 
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
	at 
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1012)
	at 
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1107)
	at java.lang.Thread.run(Thread.java:479)



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: VelocityViewServlet problem....

Posted by Tim Colson <tc...@cisco.com>.
Jeff -

> I check my log file I says the my web.xml is not found.

I'd guess it's telling the truth. ;-)

> I checked my server.xml file the context looks correct
> <Context path="/UserServlet" 
> docBase="c:\workspace\UserServlet\WEB-INF" 
> workDir="c:\workspace\UserServlet\WEB-INF\work\org\apache\jsp" />

I think that's your problem - try changing that docBase to be one level
'up'.

Ergo:
<Context path="/UserServlet"  docBase="c:\workspace\UserServlet\" 

Cheers,
Tim


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>