title: Configuring Jetty component in Camel 2.15
body: <p>I'm trying to start using Jetty with Camel.
  I have added the dependency to my pom:</p>
  
  <pre><code>    &lt;dependency&gt;
          &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
          &lt;artifactId&gt;camel-jetty&lt;/artifactId&gt;
          &lt;version&gt;2.15.5&lt;/version&gt;
      &lt;/dependency&gt;
  </code></pre>
  
  <p>My CamelContext is initialized as follows:</p>
  
  <pre><code>public void startCamelContext() throws Exception {
      CamelContext camelContext = new DefaultCamelContext(); 
      camelContext.addComponent("jetty", new JettyHttpComponent8());
      camelContext.start();
  }
  </code></pre>
  
  <p>When I try to start up my service, which has a route with endpoint defined as:</p>
  
  <pre><code>jetty:http://0.0.0.0:9000/httpInput
  </code></pre>
  
  <p>I get an exception:</p>
  
  <pre><code>java.lang.NullPointerException: null
  at org.apache.camel.component.jetty8.JettyHttpComponent8.createConnectorJettyInternal(JettyHttpComponent8.java:48)
  at org.apache.camel.component.jetty.JettyHttpComponent.createConnector(JettyHttpComponent.java:585)
  at org.apache.camel.component.jetty.JettyHttpComponent.getSocketConnector(JettyHttpComponent.java:527)
  at org.apache.camel.component.jetty.JettyHttpComponent.getConnector(JettyHttpComponent.java:517)
  at org.apache.camel.component.jetty.JettyHttpComponent.connect(JettyHttpComponent.java:320)
  at org.apache.camel.component.http.HttpEndpoint.connect(HttpEndpoint.java:185)
  at org.apache.camel.component.http.HttpConsumer.doStart(HttpConsumer.java:53)
  at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
  at org.apache.camel.impl.DefaultCamelContext.startService(DefaultCamelContext.java:2885)
  at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRouteConsumers(DefaultCamelContext.java:3179)
  at org.apache.camel.impl.DefaultCamelContext.doStartRouteConsumers(DefaultCamelContext.java:3115)
  at org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:3045)
  at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:2813)
  at org.apache.camel.impl.DefaultCamelContext.startAllRoutes(DefaultCamelContext.java:865)
  </code></pre>
  
  <p>The documentation on how to set up the Jetty component is lacking at best. I found a mailing-list entry where it was said that JettyHttpComponent has been made abstract since Camel 2.15 and now that component has to be configured using JettyHttpComponent8 or 9. <a href="https://mail-archives.apache.org/mod_mbox/camel-users/201505.mbox/%3CetPan.556a6910.643c9869.1f6@Willems-MacBook-Pro.local%3E" rel="nofollow noreferrer">link</a></p>
  
  <p>In my case, I'm using Camel 2.15.5 and the JettyHttpComponent9 isn't available in the classpath, and using 8 gives the exception described above.
  I also found related discussion <a href="https://stackoverflow.com/questions/32227336/apache-camel-2-15-2-not-able-to-create-jetty-instance">here</a> with no information on how to actually use that component.</p>