Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-users] Upgrading to Jetty 7

I am upgrading from Jetty 6 to Jetty 7 and am having some trouble configuring a HandlerList for my server. I have boiled it down to the most simple configuration I can think of that should work, the example here: http://wiki.eclipse.org/Jetty/Tutorial/Embedding_Jetty#Configuring_a_File_Server_with_XML

I am configuring my server with this file as follows:

import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.xml.XmlConfiguration;


XmlConfiguration configuration = new XmlConfiguration(configFile.toURL());
configuration.configure(server);

However, I am getting the following error:

[10:15:43] WARN  [jetty.xml.XmlConfiguration] - Config error at <Set name="handlers">

          <Array type="org.eclipse.jetty.server.Handler">
            <Item>
              <New class="org.eclipse.jetty.server.handler.DefaultHandler"/>
            </Item>
          </Array>
        </Set>
[10:15:43] WARN  [jetty.xml.XmlConfiguration] - Config error at <Set name="handler">
      <New class="org.eclipse.jetty.server.handler.HandlerList" id="Handlers">

        <Set name="handlers">

          <Array type="org.eclipse.jetty.server.Handler">
            <Item>
              <New class="org.eclipse.jetty.server.handler.DefaultHandler"/>
            </Item>
          </Array>
        </Set>

      </New>
    </Set>
[10:15:43] ERROR [bigfix.mdm.JettyLauncher] - Error configuring or starting service for jetty.xml:
java.lang.ClassCastException: java.lang.String cannot be cast to org.eclipse.jetty.xml.XmlParser$Node
at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.newArray(XmlConfiguration.java:869)
at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.itemValue(XmlConfiguration.java:1131)
at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.value(XmlConfiguration.java:1030)
at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.set(XmlConfiguration.java:423)
at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(XmlConfiguration.java:385)
at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.newObj(XmlConfiguration.java:814)
at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.itemValue(XmlConfiguration.java:1127)
at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.value(XmlConfiguration.java:1030)
at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.set(XmlConfiguration.java:423)
at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(XmlConfiguration.java:385)
at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(XmlConfiguration.java:326)
at org.eclipse.jetty.xml.XmlConfiguration.configure(XmlConfiguration.java:282)
at com.bigfix.mdm.JettyLauncher.main(JettyLauncher.java:114)

I must be doing something wrong since the main example itself doesn't even work. Strangely, it does not fail with this error if I do not set a HandlerList, but instead just add one handler:

<Set name="handler">
  <New class="org.eclipse.jetty.server.handler.DefaultHandler"></New>
</Set>

Any clues? Thanks.


-- 
Matt Hauck


Back to the top