title: java.lang.ClassNotFoundException: javax.servlet.http.HttpSessionIdListener
body: <p>I have two projects that run correctly by themselves but when I include MailSender in TradingFramework I get this NoClassDefFoundError:</p>
  
  <pre><code>Exception in thread "main" java.lang.NoClassDefFoundError: javax/servlet/http/HttpSessionIdListener
      at org.eclipse.jetty.server.session.SessionHandler.&lt;clinit&gt;(SessionHandler.java:54)
      at org.eclipse.jetty.servlet.ServletContextHandler.newSessionHandler(ServletContextHandler.java:298)
      at org.eclipse.jetty.servlet.ServletContextHandler.getSessionHandler(ServletContextHandler.java:393)
      at org.eclipse.jetty.servlet.ServletContextHandler.relinkHandlers(ServletContextHandler.java:181)
      at org.eclipse.jetty.servlet.ServletContextHandler.&lt;init&gt;(ServletContextHandler.java:168)
      at org.eclipse.jetty.servlet.ServletContextHandler.&lt;init&gt;(ServletContextHandler.java:124)
      at org.eclipse.jetty.servlet.ServletContextHandler.&lt;init&gt;(ServletContextHandler.java:112)
      at com.destek.utils.websocket.WebSocketServer.createWebSocketHandler(WebSocketServer.java:102)
      at com.destek.utils.websocket.WebSocketServer.createContextHandler(WebSocketServer.java:82)
      at com.destek.utils.websocket.WebSocketServer.start(WebSocketServer.java:51)
      at com.destek.onlinetradingfwk.service.websocket.WebSocketServerMain.runServer(WebSocketServerMain.java:25)
      at client.TradeGateway.main(TradeGateway.java:174)
  Caused by: java.lang.ClassNotFoundException: javax.servlet.http.HttpSessionIdListener
      at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
      ... 12 more
  </code></pre>
  
  <p>I have excluded the conflicting jars but still it is the same. Here are the pom.xml files:</p>
  
  <p>Trading Framework:</p>
  
  <pre><code>&lt;dependency&gt;
    &lt;groupId&gt;com.destek&lt;/groupId&gt;
    &lt;artifactId&gt;metaman-java-wrapper&lt;/artifactId&gt;
    &lt;version&gt;2.4&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
    &lt;groupId&gt;com.destek&lt;/groupId&gt;
    &lt;artifactId&gt;json-over-fix-adapter&lt;/artifactId&gt;
    &lt;version&gt;0.1&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
    &lt;groupId&gt;com.destek.tools&lt;/groupId&gt;
    &lt;artifactId&gt;web-socket-server&lt;/artifactId&gt;
    &lt;version&gt;1.0&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
    &lt;groupId&gt;org.apache.commons&lt;/groupId&gt;
    &lt;artifactId&gt;commons-lang3&lt;/artifactId&gt;
    &lt;version&gt;3.4&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
    &lt;groupId&gt;commons-beanutils&lt;/groupId&gt;
    &lt;artifactId&gt;commons-beanutils&lt;/artifactId&gt;
    &lt;version&gt;1.9.2&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
    &lt;groupId&gt;junit&lt;/groupId&gt;
    &lt;artifactId&gt;junit&lt;/artifactId&gt;
    &lt;version&gt;4.12&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
    &lt;groupId&gt;org.mockito&lt;/groupId&gt;
    &lt;artifactId&gt;mockito-core&lt;/artifactId&gt;
    &lt;version&gt;2.0.31-beta&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
    &lt;groupId&gt;com.destek&lt;/groupId&gt;
    &lt;artifactId&gt;quickfixj-all&lt;/artifactId&gt;
    &lt;version&gt;1.4.1&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
    &lt;groupId&gt;org.apache.mina&lt;/groupId&gt;
    &lt;artifactId&gt;mina-core&lt;/artifactId&gt;
    &lt;version&gt;1.1.7&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
    &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
    &lt;artifactId&gt;slf4j-api&lt;/artifactId&gt;
    &lt;version&gt;1.7.7&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
    &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
    &lt;artifactId&gt;slf4j-log4j12&lt;/artifactId&gt;
    &lt;version&gt;1.7.7&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
    &lt;groupId&gt;log4j&lt;/groupId&gt;
    &lt;artifactId&gt;log4j&lt;/artifactId&gt;
    &lt;version&gt;1.2.17&lt;/version&gt;
    &lt;scope&gt;runtime&lt;/scope&gt;
  &lt;/dependency&gt;
  
  &lt;dependency&gt;
    &lt;groupId&gt;log4j&lt;/groupId&gt;
    &lt;artifactId&gt;apache-log4j-extras&lt;/artifactId&gt;
    &lt;version&gt;1.2.17&lt;/version&gt;
  &lt;/dependency&gt;
  
  &lt;dependency&gt;
    &lt;groupId&gt;javax.websocket&lt;/groupId&gt;
    &lt;artifactId&gt;javax.websocket-api&lt;/artifactId&gt;
    &lt;version&gt;1.1&lt;/version&gt;
  &lt;/dependency&gt;
  
  &lt;dependency&gt;
    &lt;groupId&gt;com.nimbusds&lt;/groupId&gt;
    &lt;artifactId&gt;nimbus-jose-jwt&lt;/artifactId&gt;
    &lt;version&gt;4.4&lt;/version&gt;
  &lt;/dependency&gt;
  
  &lt;dependency&gt;
    &lt;groupId&gt;mysql&lt;/groupId&gt;
    &lt;artifactId&gt;mysql-connector-java&lt;/artifactId&gt;
    &lt;version&gt;5.1.6&lt;/version&gt;
  &lt;/dependency&gt;
  
  &lt;dependency&gt;
    &lt;groupId&gt;com.zaxxer&lt;/groupId&gt;
    &lt;artifactId&gt;HikariCP&lt;/artifactId&gt;
    &lt;version&gt;2.4.3&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt; 
      &lt;groupId&gt;com&lt;/groupId&gt; 
      &lt;artifactId&gt;MailSender&lt;/artifactId&gt; 
      &lt;version&gt;1.0&lt;/version&gt; 
      &lt;exclusions&gt;
          &lt;exclusion&gt;
              &lt;groupId&gt;org.ow2.asm&lt;/groupId&gt;
              &lt;artifactId&gt;asm-debug-all&lt;/artifactId&gt;
          &lt;/exclusion&gt;
          &lt;exclusion&gt;
          &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
          &lt;artifactId&gt;slf4j-api&lt;/artifactId&gt;
      &lt;/exclusion&gt;
      &lt;exclusion&gt;
          &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
          &lt;artifactId&gt;slf4j-log4j12&lt;/artifactId&gt;
      &lt;/exclusion&gt;
      &lt;exclusion&gt;
          &lt;groupId&gt;log4j&lt;/groupId&gt;
          &lt;artifactId&gt;log4j&lt;/artifactId&gt;
      &lt;/exclusion&gt;
      &lt;/exclusions&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>MailSender:</p>
  
  <pre><code>    &lt;dependency&gt;
          &lt;groupId&gt;org.glassfish.jersey.containers&lt;/groupId&gt;
          &lt;artifactId&gt;jersey-container-servlet&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.glassfish.jersey.test-framework.providers&lt;/groupId&gt;
          &lt;artifactId&gt;jersey-test-framework-provider-grizzly2&lt;/artifactId&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.glassfish.jersey.media&lt;/groupId&gt;
          &lt;artifactId&gt;jersey-media-multipart&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.glassfish.jersey.media&lt;/groupId&gt;
          &lt;artifactId&gt;jersey-media-json-jackson&lt;/artifactId&gt;
          &lt;version&gt;2.17&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.bouncycastle&lt;/groupId&gt;
          &lt;artifactId&gt;bcprov-jdk16&lt;/artifactId&gt;
          &lt;version&gt;1.46&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax.mail&lt;/groupId&gt;
          &lt;artifactId&gt;mail&lt;/artifactId&gt;
          &lt;version&gt;1.4.7&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;!-- slf4j log --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
          &lt;artifactId&gt;slf4j-api&lt;/artifactId&gt;
          &lt;version&gt;1.7.12&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
          &lt;artifactId&gt;slf4j-log4j12&lt;/artifactId&gt;
          &lt;version&gt;1.7.12&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;log4j&lt;/groupId&gt;
          &lt;artifactId&gt;log4j&lt;/artifactId&gt;
          &lt;version&gt;1.2.17&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;junit&lt;/groupId&gt;
          &lt;artifactId&gt;junit&lt;/artifactId&gt;
          &lt;version&gt;4.10&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;commons-codec&lt;/groupId&gt;
          &lt;artifactId&gt;commons-codec&lt;/artifactId&gt;
          &lt;version&gt;1.6&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.codehaus.jackson&lt;/groupId&gt;
          &lt;artifactId&gt;jackson-mapper-asl&lt;/artifactId&gt;
          &lt;version&gt;1.7.1&lt;/version&gt;
          &lt;type&gt;jar&lt;/type&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax&lt;/groupId&gt;
          &lt;artifactId&gt;javaee-web-api&lt;/artifactId&gt;
          &lt;version&gt;7.0&lt;/version&gt;
          &lt;type&gt;jar&lt;/type&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.json&lt;/groupId&gt;
          &lt;artifactId&gt;json&lt;/artifactId&gt;
          &lt;version&gt;20140107&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;net.lingala.zip4j&lt;/groupId&gt;
          &lt;artifactId&gt;zip4j&lt;/artifactId&gt;
          &lt;version&gt;1.2.3&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.commons&lt;/groupId&gt;
          &lt;artifactId&gt;commons-io&lt;/artifactId&gt;
          &lt;version&gt;1.3.2&lt;/version&gt;
      &lt;/dependency&gt;
  </code></pre>