Uploaded image for project: 'Velocity Tools'
  1. Velocity Tools
  2. VELTOOLS-154

Bad tool causes velocity servlet to fail to initialize, chew 100% CPU

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Cannot Reproduce
    • 2.0
    • None
    • VelocityView
    • None
    • Sun/Oracle Java 1.7.0_09: Java HotSpot(TM) 64-Bit Server VM version 23.5-b02
      Velocity 1.7
      Velocity Tools 2.0 + a few (unrelated) backports from trunk

    Description

      I added a class to my tools.xml which can't be instantiated (because it doesn't have a no-arg constructor). The result when accessing my first velocity template was a nearly endless stack trace like this:

      Caused by: org.apache.velocity.tools.config.ConfigurationException: Couldn't instantiate instance of tool for: Unusable Tool 'forwardBuilder' => [My Tool Class] with 1 properties [key -auto-> forwardBuilder; ](java.lang.InstantiationException: com.chadis.tools.struts.ForwardBuilder)
      at org.apache.velocity.tools.config.ToolConfiguration.validate(ToolConfiguration.java:356)
      at org.apache.velocity.tools.config.CompoundConfiguration.validate(CompoundConfiguration.java:115)
      at org.apache.velocity.tools.config.ToolboxConfiguration.validate(ToolboxConfiguration.java:108)
      at org.apache.velocity.tools.config.CompoundConfiguration.validate(CompoundConfiguration.java:115)
      at org.apache.velocity.tools.config.FactoryConfiguration.validate(FactoryConfiguration.java:232)
      at org.apache.velocity.tools.ToolboxFactory.configure(ToolboxFactory.java:80)
      at org.apache.velocity.tools.ToolManager.configure(ToolManager.java:90)
      at org.apache.velocity.tools.view.ViewToolManager.configure(ViewToolManager.java:213)
      at org.apache.velocity.tools.view.VelocityView.configure(VelocityView.java:508)
      at org.apache.velocity.tools.view.VelocityView.init(VelocityView.java:313)
      at org.apache.velocity.tools.view.VelocityView.<init>(VelocityView.java:213)
      at org.apache.velocity.tools.view.ServletUtils.createView(ServletUtils.java:156)
      at org.apache.velocity.tools.view.ServletUtils.getVelocityView(ServletUtils.java:142)
      at org.apache.velocity.tools.view.ServletUtils.getVelocityView(ServletUtils.java:104)
      at org.apache.velocity.tools.view.VelocityViewServlet.getVelocityView(VelocityViewServlet.java:155)
      at org.apache.velocity.tools.view.VelocityViewServlet.init(VelocityViewServlet.java:122)
      at org.apache.velocity.tools.view.VelocityLayoutServlet.init(VelocityLayoutServlet.java:133)
      at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1266)
      at [...]

      Eventually, the thread somehow recovers but not before generating about 800 of the above "Caused by" stack elements. I was actually expecting a StackOverflowError at some point, but it never came.

      Attachments

        Activity

          People

            cbrisson Claude Brisson
            chris@christopherschultz.net Christopher Schultz
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: