You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by David Shaw <da...@theresistance.net> on 2004/04/22 03:06:35 UTC

Problem with Velocity 1.4 and Tomcat 5.0.19

I'm new to the list, but I searched the archive and didn't see an 
answer to this problem.

I've got a Tomcat 5.0.19 server, as well as a WebLogic 8.1sp3 server.  
I'm trying to deploy the Velocity example servlet_example1 that comes 
with Velocity 1.4.  I followed the instructions included with it.  Here 
is the layout of the app:

webapps/velosample:
     velocity_example.vm
     WEB-INF:
         web.xml
         classes:
             SimpleServlet.class
             SimpleServlet.java
             VelocityExample.class
             VelocityExample.java
         lib:
             velocity-1.4.jar

I added the SimpleServlet code to make sure that regular servlets work 
-- they work fine.

The problem, which exhibits both in WebLogic and in Tomcat, is the 
following error:

2004-04-21 13:56:09 StandardWrapperValve[VelocityExample]: Allocate
exception for servlet VelocityExamplejavax.servlet.ServletException: 
Error allocating a
servlet instance
----- Root Cause -----
java.lang.NoClassDefFoundError: javax/servlet/http/HttpServlet

It's very strange.  Obviously the container knows where HttpServlet is 
since my SimpleServlet inherits from HttpServlet and works fine.  For 
this reason, I suspect velocity.  I tried both the velocity-1.4.jar and 
the velocity-dep-1.4.jar and got the same error in both cases.

My web.xml looks like this:

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
     PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
     "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
     <display-name>Velocity Sample</display-name>
     <description>
         Sample Velocity Template Code
     </description>
     <servlet>
         <servlet-name>VelocityExample</servlet-name>
         <servlet-class>VelocityExample</servlet-class>
     </servlet>
     <servlet-mapping>
         <servlet-name>VelocityExample</servlet-name>
         <url-pattern>/velocity</url-pattern>
     </servlet-mapping>
     <servlet>
         <servlet-name>SimpleServlet</servlet-name>
         <servlet-class>SimpleServlet</servlet-class>
     </servlet>
     <servlet-mapping>
         <servlet-name>SimpleServlet</servlet-name>
         <url-pattern>/simple</url-pattern>
     </servlet-mapping>
</web-app>

I am at a loss.  Does anyone have any suggestions?  Is there a 
complete, ready-to-deploy, simple velocity 1.4 example somewhere I 
could try?


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: Problem with Velocity 1.4 and Tomcat 5.0.19

Posted by David Shaw <da...@theresistance.net>.
Thanks I'll check it out.  I did solve the earlier problem.  It turns 
out I had two copies of the velocity-dep.jar in my classpath and that 
was causing the problem.


On Apr 23, 2004, at 1:22 PM, Marino A. Jonsson wrote:

> If you're going to be using Velocity in a webapp context you should 
> maybe
> check out the Velocity Tools subproject - it deals with using Velocity 
> as a
> view layer in a webapp and contains some simple ready-to-deploy 
> Velocity
> examples.
>
> http://jakarta.apache.org/velocity/tools/index.html


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: Problem with Velocity 1.4 and Tomcat 5.0.19

Posted by "Marino A. Jonsson" <ma...@hotmail.com>.
If you're going to be using Velocity in a webapp context you should maybe
check out the Velocity Tools subproject - it deals with using Velocity as a
view layer in a webapp and contains some simple ready-to-deploy Velocity
examples.

http://jakarta.apache.org/velocity/tools/index.html

cheers,
Marino


"David Shaw" <da...@theresistance.net> wrote in message
news:4CEA53C7-93F9-11D8-AA7B-000A95E3CCC8@theresistance.net...
> I'm new to the list, but I searched the archive and didn't see an
> answer to this problem.
>
> I've got a Tomcat 5.0.19 server, as well as a WebLogic 8.1sp3 server.
> I'm trying to deploy the Velocity example servlet_example1 that comes
> with Velocity 1.4.  I followed the instructions included with it.  Here
> is the layout of the app:
>
> webapps/velosample:
>      velocity_example.vm
>      WEB-INF:
>          web.xml
>          classes:
>              SimpleServlet.class
>              SimpleServlet.java
>              VelocityExample.class
>              VelocityExample.java
>          lib:
>              velocity-1.4.jar
>
> I added the SimpleServlet code to make sure that regular servlets work
> -- they work fine.
>
> The problem, which exhibits both in WebLogic and in Tomcat, is the
> following error:
>
> 2004-04-21 13:56:09 StandardWrapperValve[VelocityExample]: Allocate
> exception for servlet VelocityExamplejavax.servlet.ServletException:
> Error allocating a
> servlet instance
> ----- Root Cause -----
> java.lang.NoClassDefFoundError: javax/servlet/http/HttpServlet
>
> It's very strange.  Obviously the container knows where HttpServlet is
> since my SimpleServlet inherits from HttpServlet and works fine.  For
> this reason, I suspect velocity.  I tried both the velocity-1.4.jar and
> the velocity-dep-1.4.jar and got the same error in both cases.
>
> My web.xml looks like this:
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <!DOCTYPE web-app
>      PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
>      "http://java.sun.com/dtd/web-app_2_3.dtd">
> <web-app>
>      <display-name>Velocity Sample</display-name>
>      <description>
>          Sample Velocity Template Code
>      </description>
>      <servlet>
>          <servlet-name>VelocityExample</servlet-name>
>          <servlet-class>VelocityExample</servlet-class>
>      </servlet>
>      <servlet-mapping>
>          <servlet-name>VelocityExample</servlet-name>
>          <url-pattern>/velocity</url-pattern>
>      </servlet-mapping>
>      <servlet>
>          <servlet-name>SimpleServlet</servlet-name>
>          <servlet-class>SimpleServlet</servlet-class>
>      </servlet>
>      <servlet-mapping>
>          <servlet-name>SimpleServlet</servlet-name>
>          <url-pattern>/simple</url-pattern>
>      </servlet-mapping>
> </web-app>
>
> I am at a loss.  Does anyone have any suggestions?  Is there a
> complete, ready-to-deploy, simple velocity 1.4 example somewhere I
> could try?




---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org