Jetty
  1. Jetty
  2. JETTY-1154

Config error setting reloadInterval from context file

    Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 6.1.21, 6.1.22
    • Fix Version/s: 6.1.27
    • Component/s: Security and SSL
    • Labels:
      None
    • Environment:
      Jetty 6.1.22, Ubuntu 9.04
    • Number of attachments :
      1

      Description

      Attempting to setup a context file with a HashUserRealm which is reloaded at some interval (as described at http://docs.codehaus.org/display/JETTY/Realms), I get the following exception on start

      2009-12-10 11:22:53.758::WARN: Config error at <Set name="reloadInterval">500</Set>
      2009-12-10 11:22:53.758::WARN: Config error at <Set name="userRealm">
      <New class="org.mortbay.jetty.security.HashUserRealm"><Set name="name">Funnelback Administration</Set><Set name="config"><SystemProperty name="funnelback.installdir"/>/conf/realm.properties</Set><Set name="reloadInterval">500</Set></New>
      </Set>
      2009-12-10 11:22:53.759::WARN: Config error at <Get name="securityHandler"><Set name="userRealm">
      <New class="org.mortbay.jetty.security.HashUserRealm"><Set name="name">Funnelback Administration</Set><Set name="config"><SystemProperty name="funnelback.installdir"/>/conf/realm.properties</Set><Set name="reloadInterval">500</Set></New>
      </Set></Get>
      2009-12-10 11:22:53.759::WARN: EXCEPTION
      java.lang.NoSuchMethodException: class org.mortbay.jetty.security.HashUserRealm.setReloadInterval(class java.lang.String)
      at org.mortbay.xml.XmlConfiguration.set(XmlConfiguration.java:424)
      at org.mortbay.xml.XmlConfiguration.configure(XmlConfiguration.java:248)
      at org.mortbay.xml.XmlConfiguration.newObj(XmlConfiguration.java:626)
      at org.mortbay.xml.XmlConfiguration.itemValue(XmlConfiguration.java:915)
      at org.mortbay.xml.XmlConfiguration.value(XmlConfiguration.java:837)
      at org.mortbay.xml.XmlConfiguration.set(XmlConfiguration.java:286)
      at org.mortbay.xml.XmlConfiguration.configure(XmlConfiguration.java:248)
      at org.mortbay.xml.XmlConfiguration.get(XmlConfiguration.java:468)
      at org.mortbay.xml.XmlConfiguration.configure(XmlConfiguration.java:254)
      at org.mortbay.xml.XmlConfiguration.configure(XmlConfiguration.java:214)
      at org.mortbay.jetty.deployer.ContextDeployer.createContext(ContextDeployer.java:369)
      at org.mortbay.jetty.deployer.ContextDeployer.deploy(ContextDeployer.java:263)
      at org.mortbay.jetty.deployer.ContextDeployer.access$000(ContextDeployer.java:67)
      at org.mortbay.jetty.deployer.ContextDeployer$ScannerListener.fileAdded(ContextDeployer.java:89)
      at org.mortbay.util.Scanner.reportAddition(Scanner.java:410)
      at org.mortbay.util.Scanner.reportDifferences(Scanner.java:324)
      at org.mortbay.util.Scanner.scan(Scanner.java:280)
      at org.mortbay.jetty.deployer.ContextDeployer.doStart(ContextDeployer.java:327)
      at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
      at org.mortbay.jetty.Server.doStart(Server.java:201)
      at org.mortbay.setuid.SetUIDServer.doStart(SetUIDServer.java:158)
      at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
      at org.mortbay.xml.XmlConfiguration.main(XmlConfiguration.java:985)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.mortbay.start.Main.invokeMain(Main.java:194)
      at org.mortbay.start.Main.start(Main.java:534)
      at org.mortbay.start.Main.start(Main.java:441)
      at org.mortbay.start.Main.main(Main.java:119)

      My context file looks like...

      <?xml version="1.0" encoding="ISO-8859-1"?>
      <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://j
      etty.mortbay.org/configure.dtd">

      <Configure class="org.mortbay.jetty.webapp.WebAppContext">

      <Set name="contextPath">/search/admin/analytics</Set>
      <Set name="war"><SystemProperty name="installdir" />/web/webapps/analytics.war</Set>

      <Set name="extractWAR">false</Set>
      <Set name="copyWebDir">false</Set>

      <Get name="securityHandler">
      <Set name="userRealm">
      <New class="org.mortbay.jetty.security.HashUserRealm">
      <Set name="name">Funnelback Administration</Set>
      <Set name="config"><SystemProperty name="installdir" />/conf/realm.properties</Set>
      <Set name="reloadInterval">500</Set>
      <Call name="start"></Call>
      </New>
      </Set>
      </Get>

      </Configure>

      But from the exception I get, it seems that XmlConfiguration is expecting a setReloadInterval method which takes a string rather than the one which exists which takes an int.

      Is there any workaround for this or am I doing something obviously wrong? Perhaps my easiest way forward is to modify HashUserRealm to include a setReloadInterval(String) method which parses the string and passes it on.

        Activity

        Jan Bartel made changes -
        Field Original Value New Value
        Assignee Michael Gorovoy [ mgorovoy ]
        Joakim Erdfelt made changes -
        Assignee Michael Gorovoy [ mgorovoy ] Joakim Erdfelt [ joakime ]
        Joakim Erdfelt made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 6.1.25 [ 16415 ]
        Resolution Fixed [ 1 ]
        Matt Sheppard made changes -
        Resolution Fixed [ 1 ]
        Status Resolved [ 5 ] Reopened [ 4 ]
        Jan Bartel made changes -
        Fix Version/s 6.1.26 [ 16660 ]
        Fix Version/s 6.1.25 [ 16415 ]
        P Sturge made changes -
        Attachment JETTY-1154_PATCH.zip [ 51949 ]
        Jesse McConnell made changes -
        Fix Version/s 6.1.27 [ 17238 ]
        Fix Version/s 6.1.26 [ 16660 ]
        Michael Gorovoy made changes -
        Assignee Joakim Erdfelt [ joakime ] Michael Gorovoy [ mgorovoy ]
        Michael Gorovoy made changes -
        Status Reopened [ 4 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            Michael Gorovoy
            Reporter:
            Matt Sheppard
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: