[ http://issues.apache.org/jira/browse/VELOCITY-199?page=comments#action_12329762 ]
Will Glass-Husain commented on VELOCITY-199: -------------------------------------------- I suggest we apply Daniel's patch. It sets useful defaults and displays a message indicating there was a problem. > java.lang.ClassCastException: 'cache' doesn't map to a Boolean object > --------------------------------------------------------------------- > > Key: VELOCITY-199 > URL: http://issues.apache.org/jira/browse/VELOCITY-199 > Project: Velocity > Type: Bug > Components: Source > Versions: 1.3.1 > Environment: Operating System: Linux > Platform: PC > Reporter: Kris Nuttycombe > Assignee: Velocity-Dev List > Fix For: 1.5 > Attachments: patch > > 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. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
