You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Martin Gilday <ma...@imap.cc> on 2007/09/24 14:18:24 UTC
Velocity dependency
I am porting a WebWork application over to Struts2. I have added a
dependency to struts2-core to my Maven POM.
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-core</artifactId>
<version>2.0.9</version>
</dependency>
In my struts.xml I extend struts-default. When I try and start my
application I get a ClassDefNotFoundException. Is Velocity required
when extending struts-default? This was not the case in WW where
Freemaker was always the default. If it is required is there a reason
it is not a dependency in the struts-core POM?
2007-09-24 13:14:06.993::WARN: Error starting handlers
java.lang.NoClassDefFoundError: org/apache/velocity/app/VelocityEngine
at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Class.java:2291)
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Velocity dependency
Posted by Martin Gilday <ma...@imap.cc>.
Hi Leon,
Sorry I think I wasn't clear. I do not wish to use Velocity, all my
views are Freemarker or JSP based. I have found that it seems to be the
Struts2 Sitemesh plugin that causes problems. As soon as I declare it
then I get NoClassDefFound problems until I manually add the Velocity
dependencies? Are they needed to run the Sitemesh plugin? They are
marked as optional in the plugin POM and I would rather not have to
include them.
Thanks,
Martin.
----- Original message -----
From: "Leonidas Papadakis" <it...@creteonline.gr>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Date: Mon, 24 Sep 2007 17:38:16 +0300
Subject: Re: Velocity dependency
Hi there,
i had to do the following things in order to add full velocity support.
The issue is that in struts2 even if you have to parse a velocity file,
it has to be a result of an action. So in order to be able to parse
velocity files even if they are not result of an action :
Add the following to web.xml:
<servlet>
<servlet-name>velocity</servlet-name>
<servlet-class>org.apache.velocity.tools.view.servlet.VelocityViewServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- if you want another file mapping -->
<servlet-mapping>
<servlet-name>velocity</servlet-name>
<url-pattern>*.shtml</url-pattern>
</servlet-mapping>
Add the following jar files to lib folder :
velocity-dep-1.4.jar
velocity-tools-1.1.jar
Regards,
Leon
Martin Gilday wrote:
> I am porting a WebWork application over to Struts2. I have added a
> dependency to struts2-core to my Maven POM.
> <dependency>
> <groupId>org.apache.struts</groupId>
> <artifactId>struts2-core</artifactId>
> <version>2.0.9</version>
> </dependency>
>
> In my struts.xml I extend struts-default. When I try and start my
> application I get a ClassDefNotFoundException. Is Velocity required
> when extending struts-default? This was not the case in WW where
> Freemaker was always the default. If it is required is there a reason
> it is not a dependency in the struts-core POM?
>
> 2007-09-24 13:14:06.993::WARN: Error starting handlers
> java.lang.NoClassDefFoundError: org/apache/velocity/app/VelocityEngine
> at java.lang.Class.getDeclaredFields0(Native Method)
> at java.lang.Class.privateGetDeclaredFields(Class.java:2291)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Velocity dependency
Posted by Leonidas Papadakis <it...@creteonline.gr>.
Hi there,
i had to do the following things in order to add full velocity support.
The issue is that in struts2 even if you have to parse a velocity file,
it has to be a result of an action. So in order to be able to parse
velocity files even if they are not result of an action :
Add the following to web.xml:
<servlet>
<servlet-name>velocity</servlet-name>
<servlet-class>org.apache.velocity.tools.view.servlet.VelocityViewServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- if you want another file mapping -->
<servlet-mapping>
<servlet-name>velocity</servlet-name>
<url-pattern>*.shtml</url-pattern>
</servlet-mapping>
Add the following jar files to lib folder :
velocity-dep-1.4.jar
velocity-tools-1.1.jar
Regards,
Leon
Martin Gilday wrote:
> I am porting a WebWork application over to Struts2. I have added a
> dependency to struts2-core to my Maven POM.
> <dependency>
> <groupId>org.apache.struts</groupId>
> <artifactId>struts2-core</artifactId>
> <version>2.0.9</version>
> </dependency>
>
> In my struts.xml I extend struts-default. When I try and start my
> application I get a ClassDefNotFoundException. Is Velocity required
> when extending struts-default? This was not the case in WW where
> Freemaker was always the default. If it is required is there a reason
> it is not a dependency in the struts-core POM?
>
> 2007-09-24 13:14:06.993::WARN: Error starting handlers
> java.lang.NoClassDefFoundError: org/apache/velocity/app/VelocityEngine
> at java.lang.Class.getDeclaredFields0(Native Method)
> at java.lang.Class.privateGetDeclaredFields(Class.java:2291)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org