OK, I fixed it, here is the deal

if you velocity jar files are in the %TOMCAT%/lib directory it will
share the singleton Velocity, now if you have your jar files in each
webapp, the Velocity obj will be 1 per class loader (per webapp)

if you have many webapps and want to use many diff properties for each
velocity instance, use the jar file in the %TOMCAT%/lib and use the
VelocityEngine engine = new VelocityEngine(myProperties).


Rodrigo Asensio
[EMAIL PROTECTED]
http://www.rodrigoasensio.com
"To err is human, but to really screw up requires the root password."




---------- Forwarded message ----------
From: Rodrigo Asensio <[EMAIL PROTECTED]>
Date: Wed, Aug 6, 2008 at 3:01 PM
Subject: can't make it work on linux
To: [email protected]


my prod environment
ubuntu 804 server
java 16
velo 15

my code to initialize

Properties props = new Properties();
props.setProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH,
"/usr/share/tomcat6/webapps/my/WEB-INF/classes");
Velocity.init(props);

the code to call the vm

   StringWriter writer = new StringWriter();
   org.apache.velocity.Template template =
Velocity.getTemplate("/myfolder/mytemplate.vm");
   template.merge(this.context, writer);

this throws
org.apache.velocity.exception.ResourceNotFoundException: Unable to
find resource '/usr/share/tomcat6/webapps/my/
WEB-INF/classes/myfolder/mytemplate.vm'
obviously the file is there. :)

also I tried with:

no setting any FILE_RESOURCE_LOADER_PATH , doesn't work
passing the absolute url like '/usr/share/tomcat6/webapps/my/
WEB-INF/classes/myfolder/mytemplate.vm, also doesn't work

all this variations works perfectly in windows

any clue ????
thanks guys

Rodrigo Asensio
[EMAIL PROTECTED]
http://www.rodrigoasensio.com
"To err is human, but to really screw up requires the root password."

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to