I'm not sure why this is happening, but if i had to guess, this is some sort of ClassLoader issue. You might try using VelocityEngine instead of the Velocity singleton, at least for your tests. Then you can be sure that you aren't double-initing the singleton or something.
On Fri, Mar 13, 2009 at 6:54 AM, Gregor Grambow <[email protected]> wrote: > Hi everyone! > > I am integrating velocity into our project and everything seems to work fine. > now i'm trying to write tests. There i have the problem that i cannot find my > velocity templates. > the project is no web app. it just generates text files. > > i use the same process as in the real app: > > p.setProperty("file.resource.loader.path", templateDir); > Velocity.init(p); > > in the app it works fine, but in the test the template is not found. > i tried different combinations of strings, relative, absolute, with "/" and > "\". > i checked if the starting path is the same in both cases (in both cases > project root). > > then i checked via: > > String test = (String) Velocity.getProperty("file.resource.loader.path"); > > if the property is set. for the real app it returns: > ".\src\main\resources\templates" > and for the test it returns: > "." > > if i move the templates to project root, it works fine, but that is no option > because there will be many templates. > > could anyone tell me what i've done wrong? velocity version is 1.6. > or is it possibly a bug? > > thanks in advance! > > greetings > greg > > --------------------------------------------------------------------- > 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]
