title: java.lang.ClassNotFoundException: javax.ws.rs.client.RxInvokerProvider
body: <p>Im trying to login from a jsp page, using a loginServlet. It redirects to the servlet, but it doesn't make the authentication and throws an error. Here is the code:</p>
  
  <p>JSP file:</p>
  
  <pre><code>&lt;div class="container"&gt;
          &lt;div class="row"&gt;
              &lt;div class="box"&gt;
                  &lt;div class="col-md-6 col-md-offset-4"&gt;
  
                      &lt;h2 class="intro-text"&gt;Welcome! Login here:&lt;/h2&gt;
  
  
                      &lt;form class="form-horizontal" action="LoginServlet" method="POST"&gt;
                          &lt;div class="form-group"&gt;
                              &lt;label class="control-label col-sm-2" for="username"&gt;Username:&lt;/label&gt;
                              &lt;div class="col-sm-4"&gt;
                                  &lt;input type="text" class="form-control" id="username" placeholder="Enter username" name="un"&gt;
                              &lt;/div&gt;
                          &lt;/div&gt;
                          &lt;div class="form-group"&gt;
                              &lt;label class="control-label col-sm-2" for="pwd"&gt;Password:&lt;/label&gt;
                              &lt;div class="col-sm-4"&gt;
                                  &lt;input type="password" class="form-control" id="pwd" placeholder="Enter password" name="pwd"&gt;
                              &lt;/div&gt;
                          &lt;/div&gt;
  
                          &lt;div class="form-group"&gt;
                              &lt;div class="col-sm-offset-2 col-sm-4"&gt;
                                  &lt;div class="checkbox"&gt;
                                      &lt;label&gt;&lt;input type="checkbox" name="remember"&gt; Remember me&lt;/label&gt;
                                  &lt;/div&gt;
                              &lt;/div&gt;
                          &lt;/div&gt;
                          &lt;div class="form-group"&gt;
                              &lt;div class="col-sm-offset-2 col-sm-4"&gt;
                                  &lt;button type="submit" class="btn btn-success"&gt;Submit&lt;/button&gt;
                              &lt;/div&gt;
                          &lt;/div&gt;
                      &lt;/form&gt;
                  &lt;/div&gt;
  
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p>LoginServlet:</p>
  
  <pre><code>@WebServlet("/LoginServlet")
  public class LoginServlet extends HttpServlet {
  
  
  public void doPost(HttpServletRequest request, HttpServletResponse response) 
                         throws ServletException, java.io.IOException {
  
  
  try
  {       
  
       User user = new User();
       user.setUsername(request.getParameter("un"));
       user.setPassword(request.getParameter("pwd"));
  
       PrintWriter writer = response.getWriter();
  
       // build HTML code
       String htmlRespone = "&lt;html&gt;";
       htmlRespone += "&lt;h2&gt;Your username is: " + user.getUsername() + "&lt;br/&gt;";      
       htmlRespone += "Your password is: " + user.getPassword() + "&lt;/h2&gt;";    
       htmlRespone += "&lt;/html&gt;";
  
       writer.println(htmlRespone);
  
       if (authUser(user))
       {
            System.out.println("exists!");
            HttpSession session = request.getSession(true);       
            session.setAttribute("currentSessionUser",user); 
            response.sendRedirect("home.jsp"); //logged-in page           
       }
  
       else {
           System.out.println("not!");
              response.sendRedirect("invalidLogin.jsp"); //error page 
       }
  
  } 
  
  
  catch (Throwable theException)      
  {
       System.out.println(theException); 
  }
         }
  
      public boolean authUser(User user) {
          // TODO Auto-generated method stub
          User userDB = UserDAO.getUserByUsername(user.getUsername());
          System.out.println(userDB.getUsername()+" "+userDB.getPassword());
          System.out.println(user.getUsername()+" "+user.getPassword());
  
          if (userDB != null &amp;&amp; userDB.getUsername().equals(user.getUsername()) &amp;&amp; userDB.getPassword().equals(user.getPassword())) {
              return true;
          } else {
              return false;
          }
      }
  
  }
  </code></pre>
  
  <p>getUserByUsername method from UserDAO:</p>
  
  <pre><code>public static User getUserByUsername(String username) {
  
          Session session = factory.openSession();
          Transaction tx = null;
          List&lt;User&gt; users = null;
  
              tx = session.beginTransaction();
              Query query = session.createQuery("FROM User WHERE username = :username ");
               query.setParameter("username", username);
              List&lt;User&gt; result = query.list();
  
              tx.commit();
  
          return result != null &amp;&amp; !result.isEmpty() ? result.get(0) : null;
  
      }
  </code></pre>
  
  <p>POM file:</p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"&gt;
  
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
      &lt;groupId&gt;org.paul.licenta&lt;/groupId&gt;
      &lt;artifactId&gt;teachApp&lt;/artifactId&gt;
      &lt;packaging&gt;war&lt;/packaging&gt;
      &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
      &lt;name&gt;teachApp&lt;/name&gt;
  
      &lt;build&gt;
          &lt;finalName&gt;teachApp&lt;/finalName&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                  &lt;version&gt;2.5.1&lt;/version&gt;
                  &lt;inherited&gt;true&lt;/inherited&gt;
                  &lt;configuration&gt;
                      &lt;source&gt;1.7&lt;/source&gt;
                      &lt;target&gt;1.7&lt;/target&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  
      &lt;dependencyManagement&gt;
          &lt;dependencies&gt;
              &lt;dependency&gt;
                  &lt;groupId&gt;org.glassfish.jersey&lt;/groupId&gt;
                  &lt;artifactId&gt;jersey-bom&lt;/artifactId&gt;
                  &lt;version&gt;${jersey.version}&lt;/version&gt;
                  &lt;type&gt;pom&lt;/type&gt;
                  &lt;scope&gt;import&lt;/scope&gt;
              &lt;/dependency&gt;
          &lt;/dependencies&gt;
      &lt;/dependencyManagement&gt;
  
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.glassfish.jersey.containers&lt;/groupId&gt;
              &lt;artifactId&gt;jersey-container-servlet-core&lt;/artifactId&gt;
              &lt;!-- use the following artifactId if you don't need servlet 2.x compatibility --&gt;
              &lt;!-- artifactId&gt;jersey-container-servlet&lt;/artifactId --&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-commons-annotations&lt;/artifactId&gt;
              &lt;version&gt;3.0.0.ga&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
                 &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
                 &lt;artifactId&gt;hibernate-annotations&lt;/artifactId&gt;
                 &lt;version&gt;3.3.0.GA&lt;/version&gt;
           &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.ws.rs&lt;/groupId&gt;
              &lt;artifactId&gt;javax.ws.rs-api&lt;/artifactId&gt;
              &lt;version&gt;2.0-m08&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.transaction&lt;/groupId&gt;
              &lt;artifactId&gt;jta&lt;/artifactId&gt;
              &lt;version&gt;1.1&lt;/version&gt;
          &lt;/dependency&gt;
             &lt;dependency&gt;
          &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
          &lt;artifactId&gt;javax.servlet-api&lt;/artifactId&gt;
          &lt;version&gt;3.0.1&lt;/version&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.10&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
           &lt;groupId&gt;commons-logging&lt;/groupId&gt;
           &lt;artifactId&gt;commons-logging&lt;/artifactId&gt;
           &lt;version&gt;1.1.1&lt;/version&gt;
      &lt;/dependency&gt;
  
          &lt;dependency&gt;
          &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
          &lt;artifactId&gt;hibernate-core&lt;/artifactId&gt;
          &lt;version&gt;4.3.10.Final&lt;/version&gt;
      &lt;/dependency&gt;
  
          &lt;dependency&gt;
            &lt;groupId&gt;com.google.guava&lt;/groupId&gt;
            &lt;artifactId&gt;guava&lt;/artifactId&gt;
            &lt;version&gt;22.0&lt;/version&gt;
          &lt;/dependency&gt;
  
  
      &lt;!-- for JPA, use hibernate-entitymanager instead of hibernate-core --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
          &lt;artifactId&gt;hibernate-entitymanager&lt;/artifactId&gt;
          &lt;version&gt;4.3.10.Final&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.34&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
         &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
         &lt;artifactId&gt;hibernate-search-orm&lt;/artifactId&gt;
         &lt;version&gt;5.3.0.Final&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;3.8.1&lt;/version&gt;
        &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
          &lt;dependency&gt;
          &lt;groupId&gt;javax.ws.rs&lt;/groupId&gt;
          &lt;artifactId&gt;javax.ws.rs-api&lt;/artifactId&gt;
          &lt;version&gt;2.0&lt;/version&gt;
      &lt;/dependency&gt;
          &lt;!-- uncomment this to get JSON support
          &lt;dependency&gt;
              &lt;groupId&gt;org.glassfish.jersey.media&lt;/groupId&gt;
              &lt;artifactId&gt;jersey-media-moxy&lt;/artifactId&gt;
          &lt;/dependency&gt;
          --&gt;
      &lt;/dependencies&gt;
      &lt;properties&gt;
          &lt;jersey.version&gt;2.26-b03&lt;/jersey.version&gt;
          &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
      &lt;/properties&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>And here are the errors that I get:</p>
  
  <pre><code>SEVERE: StandardWrapper.Throwable
  java.lang.NoClassDefFoundError: javax/ws/rs/client/RxInvokerProvider
      at org.glassfish.jersey.internal.inject.Providers.getJaxRsProviderInterfaces(Providers.java:114)
      at org.glassfish.jersey.internal.inject.Providers.&lt;clinit&gt;(Providers.java:87)
      at org.glassfish.jersey.model.internal.ComponentBag.modelFor(ComponentBag.java:435)
      at org.glassfish.jersey.model.internal.ComponentBag.lambda$registerModel$5(ComponentBag.java:394)
      at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
      at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
      at org.glassfish.jersey.internal.Errors.process(Errors.java:228)
      at org.glassfish.jersey.model.internal.ComponentBag.registerModel(ComponentBag.java:386)
      at org.glassfish.jersey.model.internal.ComponentBag.register(ComponentBag.java:297)
      at org.glassfish.jersey.model.internal.CommonConfig.register(CommonConfig.java:459)
      at org.glassfish.jersey.server.ResourceConfig.register(ResourceConfig.java:447)
      at org.glassfish.jersey.servlet.WebComponent.&lt;init&gt;(WebComponent.java:332)
      at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:178)
      at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:370)
      at javax.servlet.GenericServlet.init(GenericServlet.java:158)
      at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1269)
      at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1182)
      at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1072)
      at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5368)
      at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5660)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1571)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1561)
      at java.util.concurrent.FutureTask.run(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)
  Caused by: java.lang.ClassNotFoundException: javax.ws.rs.client.RxInvokerProvider
      at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1892)
      at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1735)
      ... 27 more
  
  Aug 06, 2017 11:27:45 AM org.apache.catalina.core.StandardContext loadOnStartup
  SEVERE: Servlet [Jersey Web Application] in web application [/teachApp] threw load() exception
  java.lang.ClassNotFoundException: javax.ws.rs.client.RxInvokerProvider
      at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1892)
      at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1735)
      at org.glassfish.jersey.internal.inject.Providers.getJaxRsProviderInterfaces(Providers.java:114)
      at org.glassfish.jersey.internal.inject.Providers.&lt;clinit&gt;(Providers.java:87)
      at org.glassfish.jersey.model.internal.ComponentBag.modelFor(ComponentBag.java:435)
      at org.glassfish.jersey.model.internal.ComponentBag.lambda$registerModel$5(ComponentBag.java:394)
      at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
      at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
      at org.glassfish.jersey.internal.Errors.process(Errors.java:228)
      at org.glassfish.jersey.model.internal.ComponentBag.registerModel(ComponentBag.java:386)
      at org.glassfish.jersey.model.internal.ComponentBag.register(ComponentBag.java:297)
      at org.glassfish.jersey.model.internal.CommonConfig.register(CommonConfig.java:459)
      at org.glassfish.jersey.server.ResourceConfig.register(ResourceConfig.java:447)
      at org.glassfish.jersey.servlet.WebComponent.&lt;init&gt;(WebComponent.java:332)
      at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:178)
      at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:370)
      at javax.servlet.GenericServlet.init(GenericServlet.java:158)
      at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1269)
      at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1182)
      at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1072)
      at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5368)
      at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5660)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1571)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1561)
      at java.util.concurrent.FutureTask.run(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)
  
  Aug 06, 2017 11:27:45 AM org.apache.coyote.AbstractProtocol start
  INFO: Starting ProtocolHandler ["http-bio-8080"]
  Aug 06, 2017 11:27:45 AM org.apache.coyote.AbstractProtocol start
  INFO: Starting ProtocolHandler ["ajp-bio-8009"]
  Aug 06, 2017 11:27:45 AM org.apache.catalina.startup.Catalina start
  INFO: Server startup in 9144 ms
  java.lang.NoSuchMethodError: org.hibernate.SessionFactory.openSession()Lorg/hibernate/Session;
  </code></pre>
  
  <p>I tried to add other jars suggested on the internet and some other things that I found here but nothing worked so far. I want it do redirect me to the specified pages after authentication. Any ideas?</p>
  
  <p>Thank you very much!</p>