I am using an exploded war file in this.
Nathan Bubna wrote:
>
> The FileResourceLoader is notoriously difficult to configure property
> in a webapp environment, and is impossible to use in a webapp run as
> an unexploded WAR file.
>
> I recommend looking into the WebappLoader that is part of the
> VelocityTools project. You can see the VelocityTools javadoc or
> search these mail archives for more info on it.
>
> On 8/2/07, nageshyakkanti <[EMAIL PROTECTED]> wrote:
>>
>> Hi,
>>
>> I am working on Tomcat 5.0 , linux fedora
>> I am facing the following error
>> javax.servlet.jsp.JspException: Error initializing Velocity:
>> org.apache.velocity.exception.ResourceNotFoundException: Unable to find
>> resource 'menu.vm'
>>
>> my velocity.properties is as follows
>> resource.loader = classpath
>> file.resource.loader.description = File Resource Loader
>> file.resource.loader.class =
>> org.apache.velocity.runtime.resource.loader.FileResourceLoader
>> file.resource.loader.path = /templates
>> file.resource.loader.cache = false
>> file.resource.loader.modificationCheckInterval = 0
>>
>>
>>
>> velocimacro.library = globalMacros.vm
>> velocimacro.library.autoreload = true
>> velocimacro.permissions.allow.inline.to.replace.global = true
>> userdirective=net.sf.navigator.displayer.LocalDirective
>> runtime.log.logsystem.class=org.apache.velocity.runtime.log.SimpleLog4JLogSystem
>> runtime.log=/net/home/nyakkanti/tomcat5/logs/empApp-velocity.log
>>
>>
>> ia m using the following class to load my velocity
>> public class VelocityConfigurator
>> extends ContextExtendedPropertiesLoader
>> {
>> private static Category s_log =
>> Category.getInstance(VelocityConfigurator.class);
>>
>> /**
>> * Configures Velocity using a Properties object that is loaded
>> * when the web application starts up.
>> * @param props The loaded Properties object.
>> * @param sce The servlet context event that initialized the loading.
>> */
>> protected void handleExtendedProperties(ExtendedProperties props,
>> ServletContextEvent sce)
>> {
>> ServletContext sctx = sce.getServletContext();
>> s_log.debug("About to load velocity config file");
>> try {
>> String templatesLocationType = sctx.getInitParameter
>> ("velocity-templates-location-type");
>> String templatesLocation = sctx.getInitParameter
>> ("velocity-templates-location");
>> String realTemplatesLocation;
>> if ((templatesLocationType!=null) &&
>> (templatesLocationType.equalsIgnoreCase("absolute")))
>> {
>> // velocity-templates-location-type equals "absolute"
>> // so trust the path
>> realTemplatesLocation = templatesLocation;
>> }
>> else
>> // velocity-templates-location-type equals "context-relative"
>> // so expand it based on the context deployment location.
>> {
>> realTemplatesLocation = sctx.getRealPath(templatesLocation);
>> }
>> props.addProperty ("file.resource.loader.path",
>> realTemplatesLocation);
>> s_log.debug ("Configuring loader path:" + realTemplatesLocation);
>> Velocity.setExtendedProperties (props);
>> Velocity.init ();
>> s_log.info("Velocity configured");
>> } catch (Exception e) {
>> s_log.error ("Velocity configuration threw exception", e);
>> throw new RuntimeException("An error occurred while configuring
>> Velocity");
>> }
>> }
>>
>> /**
>> * Returns the name of the context parameter that specifies the
>> location
>> * of the velocity properties file.
>> * @return "velocity.properties".
>> */
>> protected String getContextParameter()
>> {
>> return "velocity.properties";
>> }
>>
>> as i see in the logs the
>> Configuring loader path:
>> /net/home/nyakkanti/dev/empappdep/jbpm-demo/build/war/WEB-INF/templates
>>
>> but i am still not bale to find the .vm files.
>>
>> can anybody please guide me on this.
>>
>> I have tried using the logging for velocity but it does not to the lowest
>> level.
>> How to set the logging level of velocity to debug so that i can figure
>> out
>> what path velocity is taking.
>>
>> thanks
>> nagesh
>>
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/javax.servlet.jsp.JspException%3A-Error-initializing-Velocity%3A-org.apache.velocity.exception.ResourceNotFoundException%3A-Unable-to-find-resource-%27menu.vm%27-tf4207570.html#a11969143
>> Sent from the Velocity - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
--
View this message in context:
http://www.nabble.com/javax.servlet.jsp.JspException%3A-Error-initializing-Velocity%3A-org.apache.velocity.exception.ResourceNotFoundException%3A-Unable-to-find-resource-%27menu.vm%27-tf4207570.html#a12021768
Sent from the Velocity - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]