This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Other Application Frameworks and the fly likes Running velocity application in tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Running velocity application in tomcat" Watch "Running velocity application in tomcat" New topic
Author

Running velocity application in tomcat

Suresh Magi
Greenhorn

Joined: Apr 16, 2008
Posts: 19
Hi ,

I am new to velocity and i went through the journal on velocity at http://www.javaranch.com/journal/2004/03/Velocity-AnIntroduction.html.

I understood the article and tried to replicate the same example of Hello Velocity World but i am getting a strage exception like the one given below. I tried using HelloTest extending both VelocityServlet and VelocityViewServlet but both the times i got the same exception.

So kindly help me out in resolving the issue.

Exception ::
javax.servlet.ServletException: Class HelloTest is not a Servlet
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:852)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:613)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:164)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:955)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:139)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:955)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2460)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:133)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:119)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:955)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:127)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:955)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:157)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
at java.lang.Thread.run(Thread.java:534)
Suresh Magi
Greenhorn

Joined: Apr 16, 2008
Posts: 19
Hi ,

I figured out the issue and solved the above said errors but got stuck up with another error.

let me post my HelloTest servlet java file,

public class HelloTest extends VelocityViewServlet {

public Template handleRequest( HttpServletRequest request,
HttpServletResponse response,
Context context ) {

Template template = null;

try {
context.put("name", "Velocity Test");
template = Velocity.getTemplate("hello.vm");
} catch( Exception e ) {
System.err.println("Exception caught: " + e.getMessage());
}

return template;
}
}

the error i get is ,
ResourceManager : unable to find resource 'hello.vm' in any resource loader
Exception caught: Unable to find resource 'hello.vm'
 
 
subject: Running velocity application in tomcat