I am setting 

ve.setProperty("file.resource.loader.path",
"C:/Java/eclipse/workspace/DataSource/WebContent/WEB-INF/classes/com/alarius
/datasource/");
        
Where 've' is a valid velocity engine and this line occurs before the

Ve.init();
        
and I can confirm my template is located in that directory,

C:\Java\eclipse\workspace\DataSource\WebContent\WEB-INF\classes\com\alarius\
datasource\Hibernate_cfg_xml.vm

yet it throws a ResourceNotFoundException when I try a 

Velocity.mergeTemplate("Hibernate_cfg_xml.vm",
Velocity.ENCODING_DEFAULT,context, sw);
                
I checked in the debugger and the overriding properties shows the path set
above....ARG!

The debugger also shows the resourceManager has this as one of the paths,
but the template paths are all null.

Michael Oliver
CTO
Alarius Systems LLC
6800 E. Lake Mead Blvd, #1096
Las Vegas, NV 89156
Phone:(702)643-7425
Fax:(702)974-0341
*Note new email changed from [EMAIL PROTECTED]

-----Original Message-----
From: Michael Oliver [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, August 03, 2005 9:15 AM
To: [email protected]
Subject: template path

I would like to set a property in the Velocity Engine so I can load a
template from the classpath.

I have a number of different templates that are related to various packages
and classes and it would be easier if I built my jar file with the templates
in the same path as the classes.

I would then name the templates the same and change the template path to
match the package path of the class it relates to.

Is the following the right way?

/*
 * create a new instance of the engine
 */
VelocityEngine ve = new VelocityEngine();
/*
  * configure the engine. In this case, we are using * ourselves as a
  * logger (see logging examples..)
 */
ve.setProperty(VelocityEngine.RUNTIME_LOG_LOGSYSTEM, this);
ve.setProperty(Velocity.FILE_RESOURCE_LOADER_PATH, myPackagePath);
                

------------------------------------
Alarius Systems LLC
Mike Oliver
CTO
[EMAIL PROTECTED]
[EMAIL PROTECTED]
6800 E. Lake Mead Blvd
Apt 1096
Las Vegas, NV 89156
tel: (702)643-7425
fax: (702)974-0341
mobile: (518)378-6154
IM: [EMAIL PROTECTED]
http://www.alariussystems.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]

Reply via email to