velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Oliver" <ol...@alariussystems.com>
Subject RE: ClasspathResourceLoader no worky
Date Fri, 05 Aug 2005 12:49:44 GMT
Well no, since I am using the ClasspathResourceLoader I am not overriding
the file.resource.loader.path.

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 oliverm@matrix-media.com
-----Original Message-----
From: Jean Francois Chamard [mailto:jfchamard@interstructure.ca] 
Sent: Thursday, August 04, 2005 3:12 PM
To: Velocity Users List
Subject: Re: ClasspathResourceLoader no worky

Did you try to set the

"file.resource.loader.path"
velocity property?

By default, it checks in .

>From the dev guide:
*Default Configuration : * As the name says, there is nothing
you have to do or configure to get the default configuration.  This
configuration
uses the FileResourceLoader with the current directory as the default
resource
path, and caching is off.

You can set more than one directory with this property.

Jeff


Michael Oliver wrote:

>Ok found part of the solution
>
>I changed 
>
>ve.init();
>sw = new StringWriter();
>Velocity.mergeTemplate("Hibernate_cfg_xml.vm",
>
>To 
>
>ve.init();
>sw = new StringWriter();
>ve.mergeTemplate("Hibernate_cfg_xml.vm",
>
>but the only copy of the template it is finding is the one stored at the
>root of the jar and not the one down in the package.
>
>I have /Hibernate_cfg_xml.vm and
>/com/alarius/datasource/Hibernate_cfg_xml.vm 
>
>and I have tried 
>
>ve.mergeTemplate("Hibernate_cfg_xml.vm",
>ve.mergeTemplate("/com/alarius/datasource/Hibernate_cfg_xml.vm",
>
>and even
>
>ve.mergeTemplate("com.alarius.datasource.Hibernate_cfg_xml.vm",
>
>
>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 oliverm@matrix-media.com
>
>-----Original Message-----
>From: Michael Oliver [mailto:ollie@alariussystems.com] 
>Sent: Thursday, August 04, 2005 1:49 PM
>To: 'Velocity Users List'
>Subject: ClasspathResourceLoader no worky
>
>
>I have a JUnit test that I can't seem to get working tieh
>ClasspathResourceLoader.
>
>VelocityEngine ve = new VelocityEngine();
>
>ve.setProperty(VelocityEngine.RUNTIME_LOG_LOGSYSTEM, this);
>ve.setProperty(Velocity.RESOURCE_LOADER, "class");
>ve.setProperty("class.resource.loader.class","org.apache.velocity.runtime.r
e
>source.loader.ClasspathResourceLoader");
>		
>VelocityContext context = new VelocityContext();
>context.put("username", new String("root"));
>context.put("password", new String("letmein"));
>		
>StringWriter sw = null;
>try {
>	ve.init();
>	sw = new StringWriter();
>	Velocity.mergeTemplate("Hibernate_cfg_xml.vm",
>Velocity.ENCODING_DEFAULT,context, sw);
>} catch (ResourceNotFoundException e) {
>	e.printStackTrace();
>}
>
>I am running Eclipse 3.0 with JUnit 3.8 and I have the debug runtime
>classpath including a jar with the Hibernate_cfg_xml.vm file in several
>locations, but whenever I run this test it throws the
>ResourceNotFoundException.
>
>I have the template located in the jar at the root and in a couple of
>package directories.
>
>I cannot get it to find it.
>
>Is this a problem with the JUnit class loader?
>
>I looked in the debugger and the resourceLoader IS the
>ClasspathResourceLoader so I know that part is at least working.
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>  
>

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



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


Mime
View raw message