Uploaded image for project: 'Velocity'
  1. Velocity
  2. VELOCITY-199

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

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.3.1
    • 1.5
    • Engine
    • None
    • Operating System: Linux
      Platform: PC
    • 22595

    Description

      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.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            kris.nuttycombe@noaa.gov Kris Nuttycombe
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment