Why IllegalStateException occurs when configuring http access log in jetty.xml

Solution Unverified - Updated -

Issue

  • When configuring "jetty.xml" for an http access log cxf crashes with an "IllegalStateException"
2014-12-01 11:36:04,663 | ERROR | FelixStartLevel  | WebApplication                   | 168 - org.ops4j.pax.web.pax-web-extender-whiteboard - 3.0.6 | Registration skipped for [ServletWebElement{mapping=DefaultServletMapping{httpContextId=null,urlPatterns=null,initParams={},servlet=org.apache.cxf.transport.servlet.CXFNonSpringServlet@148be2a3, alias=/cxf, servletNamecxf-osgi-transport-servlet}}] due to error during registration
java.lang.IllegalStateException: STARTED
    at org.eclipse.jetty.server.handler.HandlerCollection.setHandlers(HandlerCollection.java:80)[92:org.eclipse.jetty.aggregate.jetty-all-server:8.1.14.v20131031]
    at org.eclipse.jetty.server.handler.HandlerCollection.addHandler(HandlerCollection.java:282)[92:org.eclipse.jetty.aggregate.jetty-all-server:8.1.14.v20131031]
    at org.eclipse.jetty.servlet.ServletContextHandler.<init>(ServletContextHandler.java:150)[92:org.eclipse.jetty.aggregate.jetty-all-server:8.1.14.v20131031]
    at org.eclipse.jetty.servlet.ServletContextHandler.<init>(ServletContextHandler.java:116)[92:org.eclipse.jetty.aggregate.jetty-all-server:8.1.14.v20131031]
.
.
2014-12-01 11:36:06,572 | ERROR | FelixStartLevel  | fabric-redirect                  | 103 - io.fabric8.fabric-redirect - 1.0.0.redhat-379 | [io.fabric8.redirect(44)] The activate method has thrown an exception
java.lang.IllegalStateException: STARTED
    at org.eclipse.jetty.server.handler.HandlerCollection.setHandlers(HandlerCollection.java:80)
    at org.eclipse.jetty.server.handler.HandlerCollection.addHandler(HandlerCollection.java:282)
    at org.eclipse.jetty.servlet.ServletContextHandler.<init>(ServletContextHandler.java:150)
  • Prior to adding the config, cxf is functional but after adding the config, cxf returns a 404 error but eh access log is functional.

  • The "jetty.xml" has the following added entry in it which seems to be causing the issue.

    <Set name="handler">
      <New id="Handlers" class="org.eclipse.jetty.server.handler.HandlerCollection">
         <Set name="handlers">
            <Array type="org.eclipse.jetty.server.Handler">
               <Item>
                 <New id="Contexts" class="org.eclipse.jetty.server.handler.ContextHandlerCollection"/>
                </Item>
                <Item>
                  <New id="DefaultHandler" class="org.eclipse.jetty.server.handler.DefaultHandler"/>
                </Item>
                <Item>
                  <New id="RequestLog" class="org.eclipse.jetty.server.handler.RequestLogHandler"/>
                </Item>
            </Array>
        </Set>
      </New>
    </Set>

    <Ref id="RequestLog">
      <Set name="requestLog">
        <New id="RequestLogImpl" class="org.eclipse.jetty.server.NCSARequestLog">
          <Arg><SystemProperty name="KARAF_HOME" default="./data/log"/>/yyyy_mm_dd.http.log</Arg>
          <Set name="retainDays">90</Set>
          <Set name="append">true</Set>
          <Set name="extended">false</Set>
          <Set name="LogTimeZone">EST</Set>
         </New>
      </Set>
    </Ref>

Environment

  • Red Hat JBoss Fuse
    • 6.1.0

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content