[jetty-user] Multiple ports in karaf ?

Shamik Bandopadhyay <[email protected]> Fri, 22 Jul 2011 14:10:06 -0700
Newsgroups gmane.comp.java.jetty.support
Message-ID <CAG+u80tiks+-SxuyXmXPk+2cWKNcji=NXcXiAG-HQnOWkdC38Q@mail.gmail.com>
Hi,

  Just wondering if its possible to declara multiple ports in karaf ? I'm
using an embedded jetty server and configured jetty.xml to have couple of
connectors listening to 2 different ports. The idea is to use custom
acceptor for each port to restrict the number of request.

Here's my connector entry :

<Set name="connectors">
  <Array type="org.eclipse.jetty.server.Connector">
   <Item>
    <New  class="org.eclipse.jetty.server.nio.SelectChannelConnector">
     <Set name="port">8011</Set>
     <Set name="maxIdleTime">20000</Set>
     <Set name="Acceptors">20</Set>
     <Set name="name">disptach</Set>
    </New>
   </Item>
   <Item>
    <New id="connB"
class="org.eclipse.jetty.server.nio.SelectChannelConnector">
     <Set name="port">8012</Set>
     <Set name="maxIdleTime">20000</Set>
     <Set name="Acceptors">10</Set>
     <Set name="name">persist</Set>
    </New>
   </Item>
  </Array>
 </Set>

As you can see, I've defined couple of ports 8011 and 8012.

In pax web config, I've the following entry to listen to 8011 only.

org.osgi.service.http.port=8011

I can only access my service through port 8011, but not using 8012. I tried
declaring both ports comma separated (not sure if that's the right syntax),
but didn't work out as jetty started throwing some null pointer exception at
the startup.

ERROR: Bundle org.ops4j.pax.web.pax-web-runtime [163] EventDispatcher: Error
during dispatch. (java.lang.NullPointerException)
java.lang.NullPointerException
        at
org.ops4j.pax.web.service.jetty.internal.ServerControllerImpl$Stopped.start(ServerControllerImpl.java:361)
        at
org.ops4j.pax.web.service.jetty.internal.ServerControllerImpl.start(ServerControllerImpl.java:67)

Any pointer will be appreciated.

- Thanks