velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Phillip Gibb" <Phillip.G...@intec.co.za>
Subject RE: render.eval()
Date Tue, 21 Sep 2004 13:27:33 GMT
Hi,
 
I keep getting a null pointer Exception loading template error message.
My templates are in a jar file as a package starting from the root dir
of the jar.
 
the properties file is successfully read :
 
      Properties intecVelocityPropes = new Properties();
      InputStream is =
ClassLoader.getSystemClassLoader().getResource("IntecVelocity.properties
").openStream();
      intecVelocityPropes.load(is);
      Velocity.init(intecVelocityPropes);
 
 
But it keeps producing a null pointer exception on
Velocity.getTemplate("mypackage.templates.templateTest.vm")
[
	at
org.apache.velocity.runtime.resource.loader.JarHolder.getEntries(JarHold
er.java:154)
	at
org.apache.velocity.runtime.resource.loader.JarResourceLoader.loadJar(Ja
rResourceLoader.java:174)
	at
org.apache.velocity.runtime.resource.loader.JarResourceLoader.init(JarRe
sourceLoader.java:142)
	at
org.apache.velocity.runtime.resource.ResourceManagerImpl.initialize(Reso
urceManagerImpl.java:182)
	at
org.apache.velocity.runtime.RuntimeInstance.initializeResourceManager(Ru
ntimeInstance.java:560)
	at
org.apache.velocity.runtime.RuntimeInstance.init(RuntimeInstance.java:26
5)
	at
org.apache.velocity.runtime.RuntimeInstance.init(RuntimeInstance.java:49
9)
	at
org.apache.velocity.runtime.RuntimeSingleton.init(RuntimeSingleton.java:
246)
	at org.apache.velocity.app.Velocity.init(Velocity.java:144)
	at
com.intec.utility.template.TemplateEngine.init(TemplateEngine.java:73)

]
*TemplateEngine is my class , line 73 is
Velocity.init(intecVelocityProps);
please help
 
thanks
 
Phillip
 
my properties file :
 
### Velocity properties that are different from the defaults ###
 
## Runtime log to use
runtime.log.logsystem.class =
org.apache.velocity.runtime.log.SimpleLog4JLogSystem
 
## Log location
runtime.log = Velocity.log
 
### Configuration for the Log4JLogSystem.
## runtime.log.logsystem.class property to be:
org.apache.velocity.runtime.log.Log4JLogSystem
runtime.log.logsystem.log4j.pattern=%d - %m%n
runtime.log.logsystem.log4j.file.size=100000
runtime.log.logsystem.log4j.file.backups=1
 

### use a Jar loader which loads templates from a jar file
resource.loader = jar
jar.resource.loader.description = Velocity Jar Resource Loader
jar.resource.loader.class =
org.apache.velocity.runtime.resource.loader.JarResourceLoader
jar.resource.loader.path = jar:file:IntecUtility.jar
## Cache is false for development but production it should be true
jar.resource.loader.cache = false
## Seconds between checks for modified templates
jar.resource.loader.modificationCheckInterval = 10

---------------------------------------------------------------------
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