You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Kevin Baynes <kb...@seagullsw.com> on 2003/01/28 15:38:50 UTC

ResourceManager.getResource() Exception

The below email details how I added logging and specified ResourceManager
classes.


This worked on WinXP && Tomcat4 && JDK 1.3.0.

However, on OS/390 2.1.0 && WAS 3.5.0 && JDK 1.3.1, I'm geting the below
error.

I'm using velocity-1.3.jar and commons-collection.jar 1.0.

I am pretty much stumped as to the cause or how to address this one. The
JDK's are _almost_ identical, and both platforms are using the same
velocity/commons jars.

~akb


ERROR :
2003-01-28 08:10:36,750 ERROR: ResourceManager.getResource() exception
new: java.util.NoSuchElementException:
'directive.foreach.counter.initial.value' doesn't map to an existing
object
2003-01-28 08:10:36,763 FATAL: Administrator.doGet() Exception in
doAction
java.util.NoSuchElementException:
'directive.foreach.counter.initial.value' doesn't map to an existing
object
 at
org.apache.commons.collections.ExtendedProperties.getInteger(ExtendedPropert
ies.java(Inlined
Compiled Code))
 at
org.apache.commons.collections.ExtendedProperties.getInt(ExtendedProperties.
java(Compiled
Code))
 at
org.apache.velocity.runtime.RuntimeInstance.getInt(RuntimeInstance.java(Inli
ned
Compiled Code))
 at
org.apache.velocity.runtime.directive.Foreach.init(Foreach.java(Inlined
Compiled Code))
 at
org.apache.velocity.runtime.parser.node.ASTDirective.init(ASTDirective.java(
Inlined
Compiled Code))
 at
org.apache.velocity.runtime.parser.node.SimpleNode.init(SimpleNode.java(Inli
ned
Compiled Code))
 at org.apache.velocity.Template.initDocument(Template.java(Inlined
Compiled Code))
 at org.apache.velocity.Template.process(Template.java(Inlined Compiled
Code))
 at
org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(Resour
ceManagerImpl.java(Inlined
Compiled Code))
 at
org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(Resourc
eManagerImpl.java(Inlined
Compiled Code))
 at
org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java
(Inlined
Compiled Code))
 at
org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java
(Inlined
Compiled Code))
 at
org.apache.velocity.app.VelocityEngine.getTemplate(VelocityEngine.java(Inlin
ed
Compiled Code))
 at com.seagullsw.swm.Administrator.doGet(Administrator.java(Compiled
Code))



-----Original Message-----
From: Kevin Baynes [mailto:kbaynes@seagullsw.com]
Sent: Tuesday, January 28, 2003 8:28 AM
To: Velocity Users List
Subject: RE: ResourceManager not found exception



Update:
Adding my logger in properties caused ResourceManager error, which caused me
to have to explicitly name the ResourceManager class and the ResourceCache
class. Is this by design?

~akb

I began with these properties and all worked well :

p.setProperty("resource.loader","file");
p.setProperty("file.resource.loader.class","org.apache.velocity.runtime.reso
urce.loader.FileResourceLoader");
p.setProperty("file.resource.loader.path",vmFolder.getPath());
p.setProperty("file.resource.loader.cache","true");
p.setProperty("file.resource.loader.modificationCheckInterval","0");
ve.init(p);


I added the next two properties and got the ResourceManager error below
(logging to my log worked) :

p.setProperty("resource.loader","file");
p.setProperty("file.resource.loader.class","org.apache.velocity.runtime.reso
urce.loader.FileResourceLoader");
p.setProperty("file.resource.loader.path",vmFolder.getPath());
p.setProperty("file.resource.loader.cache","true");
p.setProperty("file.resource.loader.modificationCheckInterval","0");
p.setProperty("runtime.log.logsystem.class","org.apache.velocity.runtime.log
.SimpleLog4JLogSystem");
p.setProperty("runtime.log.logsystem.log4j.category","com.seagullsw.swm.Admi
nistrator");
ve.init(p);


I then added the final two properties and everything started working :

p.setProperty("resource.loader","file");
p.setProperty("file.resource.loader.class","org.apache.velocity.runtime.reso
urce.loader.FileResourceLoader");
p.setProperty("file.resource.loader.path",vmFolder.getPath());
p.setProperty("file.resource.loader.cache","true");
p.setProperty("file.resource.loader.modificationCheckInterval","0");
p.setProperty("runtime.log.logsystem.class","org.apache.velocity.runtime.log
.SimpleLog4JLogSystem");
p.setProperty("runtime.log.logsystem.log4j.category","com.seagullsw.swm.Admi
nistrator");
p.setProperty("resource.manager.class","org.apache.velocity.runtime.resource
.ResourceManagerImpl");
p.setProperty("resource.manager.cache.class","org.apache.velocity.runtime.re
source.ResourceCacheImpl");
ve.init(p);

-----Original Message-----
From: Kevin Baynes [mailto:kbaynes@seagullsw.com]
Sent: Monday, January 27, 2003 5:18 PM
To: Velocity Users List
Subject: ResourceManager not found exception


I'm getting the below error from Velocity.

I believe that my configuration was working fine until I added log4j as the
logger in my properties.

I think the below properties look right... am I missing something?

~akb

PROPERTIES :
    p.setProperty("resource.loader","file");

p.setProperty("file.resource.loader.class","org.apache.velocity.runtime.reso
urce.loader.FileResourceLoader");
    p.setProperty("file.resource.loader.path",vmFolder.getPath());
    p.setProperty("file.resource.loader.cache","true");
    p.setProperty("file.resource.loader.modificationCheckInterval","0");

p.setProperty("runtime.log.logsystem.class","org.apache.velocity.runtime.log
.SimpleLog4JLogSystem");

p.setProperty("runtime.log.logsystem.log4j.category","com.seagullsw.swm.Admi
nistrator");
    ve.init(p);


ERROR :
2003-01-27 14:21:15,655 DEBUG: Administrator.init() VelocityEngine.Init()
Begin
2003-01-27 14:21:15,722 DEBUG: SimpleLog4JLogSystem using category
'com.seagullsw.swm.Administrator'
2003-01-27 14:21:15,722 INFO :
**************************************************************
2003-01-27 14:21:15,722 INFO : Starting Jakarta Velocity v1.3
2003-01-27 14:21:15,722 INFO : RuntimeInstance initializing.
2003-01-27 14:21:15,722 INFO : Default Properties File:
org/apache/velocity/runtime/defaults/velocity.properties
2003-01-27 14:21:15,723 INFO : Trying to use logger class
org.apache.velocity.runtime.log.SimpleLog4JLogSystem
2003-01-27 14:21:15,723 INFO : Using logger class
org.apache.velocity.runtime.log.SimpleLog4JLogSystem
2003-01-27 14:21:15,723 ERROR: It appears that no class was specified as the
ResourceManager.  Please ensure that all configuration information is
correct.
2003-01-27 14:21:15,749 FATAL: Fatal Exception in Administrtor constructor
java.lang.Exception: It appears that no class was specified as the
ResourceManager.  Please ensure that all configuration information is
correct.
	at
org.apache.velocity.runtime.RuntimeInstance.initializeResourceManager(Runtim
eInstance.java(Inlined Compiled Code))
	at
org.apache.velocity.runtime.RuntimeInstance.init(RuntimeInstance.java(Inline
d Compiled Code))
	at
org.apache.velocity.runtime.RuntimeInstance.init(RuntimeInstance.java(Inline
d Compiled Code))
	at org.apache.velocity.app.VelocityEngine.init(VelocityEngine.java(Inlined
Compiled Code))
	at com.seagullsw.swm.Administrator.init(Administrator.java(Compiled Code))


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Velocity in WAS 3.5 not loading default properties

Posted by Kevin Baynes <kb...@seagullsw.com>.
Note:
I started this thread about Velocity in WebSphere 3.5 on OS/390, and am
finishing it for public record. My hope is that it will help another
deveoper in a similar situation. See my other emails for details of errors:
ResourceManager, etc.
--------------------

I was having trouble getting Velocity to run in WebSphere 3.5, and kept
finding that I needed to set additional properties to pass to
VelocityEngine.init(Properties p).

I eventually copied the velocity.properties from the /runtime/defaults/ src
folder into my application and then loaded it myself :
Properties p = new Properties();
p.load(new FileInputStream(propertiesFile));
p.setProperty(....);  // my overrides
ve.init(p);

In WAS 3.5 on OS/390, Velocity cannot load the default properties
(RuntimeInstance.setDefaultProperties() fails). The developer must load them
explicitly. The examples in the developer's guide about using Velocity in
applications assume that Velocity can load the default properties... this
assumption is often correct, but not in WAS 3.5.

~akb


-----Original Message-----
From: Kevin Baynes [mailto:kbaynes@seagullsw.com]
Sent: Tuesday, January 28, 2003 9:39 AM
To: Velocity Users List
Subject: ResourceManager.getResource() Exception



The below email details how I added logging and specified ResourceManager
classes.


This worked on WinXP && Tomcat4 && JDK 1.3.0.

However, on OS/390 2.1.0 && WAS 3.5.0 && JDK 1.3.1, I'm geting the below
error.

I'm using velocity-1.3.jar and commons-collection.jar 1.0.

I am pretty much stumped as to the cause or how to address this one. The
JDK's are _almost_ identical, and both platforms are using the same
velocity/commons jars.

~akb


ERROR :
2003-01-28 08:10:36,750 ERROR: ResourceManager.getResource() exception
new: java.util.NoSuchElementException:
'directive.foreach.counter.initial.value' doesn't map to an existing
object
2003-01-28 08:10:36,763 FATAL: Administrator.doGet() Exception in
doAction
java.util.NoSuchElementException:
'directive.foreach.counter.initial.value' doesn't map to an existing
object
 at
org.apache.commons.collections.ExtendedProperties.getInteger(ExtendedPropert
ies.java(Inlined
Compiled Code))
 at
org.apache.commons.collections.ExtendedProperties.getInt(ExtendedProperties.
java(Compiled
Code))
 at
org.apache.velocity.runtime.RuntimeInstance.getInt(RuntimeInstance.java(Inli
ned
Compiled Code))
 at
org.apache.velocity.runtime.directive.Foreach.init(Foreach.java(Inlined
Compiled Code))
 at
org.apache.velocity.runtime.parser.node.ASTDirective.init(ASTDirective.java(
Inlined
Compiled Code))
 at
org.apache.velocity.runtime.parser.node.SimpleNode.init(SimpleNode.java(Inli
ned
Compiled Code))
 at org.apache.velocity.Template.initDocument(Template.java(Inlined
Compiled Code))
 at org.apache.velocity.Template.process(Template.java(Inlined Compiled
Code))
 at
org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(Resour
ceManagerImpl.java(Inlined
Compiled Code))
 at
org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(Resourc
eManagerImpl.java(Inlined
Compiled Code))
 at
org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java
(Inlined
Compiled Code))
 at
org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java
(Inlined
Compiled Code))
 at
org.apache.velocity.app.VelocityEngine.getTemplate(VelocityEngine.java(Inlin
ed
Compiled Code))
 at com.seagullsw.swm.Administrator.doGet(Administrator.java(Compiled
Code))



-----Original Message-----
From: Kevin Baynes [mailto:kbaynes@seagullsw.com]
Sent: Tuesday, January 28, 2003 8:28 AM
To: Velocity Users List
Subject: RE: ResourceManager not found exception



Update:
Adding my logger in properties caused ResourceManager error, which caused me
to have to explicitly name the ResourceManager class and the ResourceCache
class. Is this by design?

~akb

I began with these properties and all worked well :

p.setProperty("resource.loader","file");
p.setProperty("file.resource.loader.class","org.apache.velocity.runtime.reso
urce.loader.FileResourceLoader");
p.setProperty("file.resource.loader.path",vmFolder.getPath());
p.setProperty("file.resource.loader.cache","true");
p.setProperty("file.resource.loader.modificationCheckInterval","0");
ve.init(p);


I added the next two properties and got the ResourceManager error below
(logging to my log worked) :

p.setProperty("resource.loader","file");
p.setProperty("file.resource.loader.class","org.apache.velocity.runtime.reso
urce.loader.FileResourceLoader");
p.setProperty("file.resource.loader.path",vmFolder.getPath());
p.setProperty("file.resource.loader.cache","true");
p.setProperty("file.resource.loader.modificationCheckInterval","0");
p.setProperty("runtime.log.logsystem.class","org.apache.velocity.runtime.log
.SimpleLog4JLogSystem");
p.setProperty("runtime.log.logsystem.log4j.category","com.seagullsw.swm.Admi
nistrator");
ve.init(p);


I then added the final two properties and everything started working :

p.setProperty("resource.loader","file");
p.setProperty("file.resource.loader.class","org.apache.velocity.runtime.reso
urce.loader.FileResourceLoader");
p.setProperty("file.resource.loader.path",vmFolder.getPath());
p.setProperty("file.resource.loader.cache","true");
p.setProperty("file.resource.loader.modificationCheckInterval","0");
p.setProperty("runtime.log.logsystem.class","org.apache.velocity.runtime.log
.SimpleLog4JLogSystem");
p.setProperty("runtime.log.logsystem.log4j.category","com.seagullsw.swm.Admi
nistrator");
p.setProperty("resource.manager.class","org.apache.velocity.runtime.resource
.ResourceManagerImpl");
p.setProperty("resource.manager.cache.class","org.apache.velocity.runtime.re
source.ResourceCacheImpl");
ve.init(p);

-----Original Message-----
From: Kevin Baynes [mailto:kbaynes@seagullsw.com]
Sent: Monday, January 27, 2003 5:18 PM
To: Velocity Users List
Subject: ResourceManager not found exception


I'm getting the below error from Velocity.

I believe that my configuration was working fine until I added log4j as the
logger in my properties.

I think the below properties look right... am I missing something?

~akb

PROPERTIES :
    p.setProperty("resource.loader","file");

p.setProperty("file.resource.loader.class","org.apache.velocity.runtime.reso
urce.loader.FileResourceLoader");
    p.setProperty("file.resource.loader.path",vmFolder.getPath());
    p.setProperty("file.resource.loader.cache","true");
    p.setProperty("file.resource.loader.modificationCheckInterval","0");

p.setProperty("runtime.log.logsystem.class","org.apache.velocity.runtime.log
.SimpleLog4JLogSystem");

p.setProperty("runtime.log.logsystem.log4j.category","com.seagullsw.swm.Admi
nistrator");
    ve.init(p);


ERROR :
2003-01-27 14:21:15,655 DEBUG: Administrator.init() VelocityEngine.Init()
Begin
2003-01-27 14:21:15,722 DEBUG: SimpleLog4JLogSystem using category
'com.seagullsw.swm.Administrator'
2003-01-27 14:21:15,722 INFO :
**************************************************************
2003-01-27 14:21:15,722 INFO : Starting Jakarta Velocity v1.3
2003-01-27 14:21:15,722 INFO : RuntimeInstance initializing.
2003-01-27 14:21:15,722 INFO : Default Properties File:
org/apache/velocity/runtime/defaults/velocity.properties
2003-01-27 14:21:15,723 INFO : Trying to use logger class
org.apache.velocity.runtime.log.SimpleLog4JLogSystem
2003-01-27 14:21:15,723 INFO : Using logger class
org.apache.velocity.runtime.log.SimpleLog4JLogSystem
2003-01-27 14:21:15,723 ERROR: It appears that no class was specified as the
ResourceManager.  Please ensure that all configuration information is
correct.
2003-01-27 14:21:15,749 FATAL: Fatal Exception in Administrtor constructor
java.lang.Exception: It appears that no class was specified as the
ResourceManager.  Please ensure that all configuration information is
correct.
	at
org.apache.velocity.runtime.RuntimeInstance.initializeResourceManager(Runtim
eInstance.java(Inlined Compiled Code))
	at
org.apache.velocity.runtime.RuntimeInstance.init(RuntimeInstance.java(Inline
d Compiled Code))
	at
org.apache.velocity.runtime.RuntimeInstance.init(RuntimeInstance.java(Inline
d Compiled Code))
	at org.apache.velocity.app.VelocityEngine.init(VelocityEngine.java(Inlined
Compiled Code))
	at com.seagullsw.swm.Administrator.init(Administrator.java(Compiled Code))


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


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