You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by bu...@apache.org on 2003/08/20 20:37:52 UTC

DO NOT REPLY [Bug 22595] New: - java.lang.ClassCastException: 'cache' doesn't map to a Boolean object

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22595>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22595

java.lang.ClassCastException: 'cache' doesn't map to a Boolean object

           Summary: java.lang.ClassCastException: 'cache' doesn't map to a
                    Boolean object
           Product: Velocity
           Version: 1.3.1
          Platform: PC
               URL: http://216.239.37.104/search?q=cache:swlDhCygFHoJ:www.di
                    sastertravel.com/computers/java/velocity/example_servlet
                    .php+velocity+java.lang.ClassCastException:+%27cache%27+
                    doesn%27t+map+to+a+Boolean+object&hl=en&ie=UTF-8
        OS/Version: Linux
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Tools
        AssignedTo: velocity-dev@jakarta.apache.org
        ReportedBy: kris.nuttycombe@noaa.gov


The initialization fails entirely due to what appears to be a problem
configuring the logsystem. I found a single reference to someone else
encountering this problem in the Google cache at the URL listed above
(http://216.239.37.104/search?q=cache:swlDhCygFHoJ:www.disastertravel.com/computers/java/velocity/example_servlet.php+velocity+java.lang.ClassCastException:+%27cache%27+doesn%27t+map+to+a+Boolean+object&hl=en&ie=UTF-8)

In our case, the error occurs when initializing the standalone Velocity parser
with the following code:

Velocity.setProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM_CLASS,
"org.apache.velocity.runtime.log.SimpleLog4JLogSystem");
Velocity.setProperty("runtime.log.logsystem.log4j.category", "velocity");
Velocity.init();

The "velocity" category is configured in the log4j_conf.xml file as:

<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
    <appender name="velocity_app" class="org.apache.log4j.FileAppender">
        <param name="File"  
value="/www/sites/tomcat/webapps/nndc/logs/idb_velocity.log" />
        <param name="Append" value="true" />	    	
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="%t %-5p %c{2} - %m%n"/>
        </layout>	    
    </appender>

    <category name="velocity">
	<priority value="warn" />
  	<appender-ref ref="velocity_app" />
    </category>

    <!-- Root & other categories snipped -->

</log4j:configuration>


Stack trace:

java.lang.ClassCastException: 'cache' doesn't map to a Boolean object
at org.apache.commons.collections.ExtendedProperties.getBoolean(Unknown Source)
at org.apache.commons.collections.ExtendedProperties.getBoolean(Unknown Source)
at
org.apache.velocity.runtime.resource.loader.ResourceLoader.commonInit(ResourceLoader.java:116)
at
org.apache.velocity.runtime.resource.ResourceManagerImpl.initialize(ResourceManagerImpl.java:186)
at
org.apache.velocity.runtime.RuntimeInstance.initializeResourceManager(RuntimeInstance.java:502)
at org.apache.velocity.runtime.RuntimeInstance.init(RuntimeInstance.java:268)
at org.apache.velocity.runtime.RuntimeSingleton.init(RuntimeSingleton.java:169)
at org.apache.velocity.app.Velocity.init(Velocity.java:123)
at gov.noaa.nndc.idb.IdbTemplateParser.initVelocity(IdbTemplateParser.java:145)

The handling of configuring the logsystem needs to be improved such that this is
not a fatal error. However, this bug may be somewhat difficult to pin down as I
am unable to reproduce the problem on my local system, but it occurs in the
remote deployment. In any case, I suspect it to be related to problems writing
the logfiles in the designated place that starts the chain of events that
results in the (seemingly unrelated) error.

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