title: Can't Configure Apache Shiro with MySQL, SHA256 Password Hashing Algorithm, Salting in Base64 String
body: <p>I am trying to configure Apache Shiro using shiro.ini in order to authenticate users against MySQL Database where all credentials are saved.  Passwords are hashed using sha256 algorithm and a salt per user is used and saved/recovered from MySQL database. I would like to avoid creating custom Realm and custom SaltedAuthentificationInfo which i believe is possible through shiro.ini proper configuration
  <strong>Or not??</strong> Is this possible?
  Can i avoid using custom Realm and SaltedAuthentificationInfo??</p>
  
  <p>To register users i implemented the following function </p>
  
  <pre><code>    @POST
      @Path("new")
      @Consumes(MediaType.APPLICATION_JSON)
      @Produces(MediaType.APPLICATION_JSON)
      public String create(User requestBody) {
  
          System.err.println("NEW User");
  
          User user = new User();
          user.setFirstName(requestBody.getFirstName());
          user.setLastName(requestBody.getLastName());
          user.setEmail(requestBody.getEmail());
  
  //             Do Something With Salt Per User Random Generation or Something like it
  //================================================================================================================
          RandomNumberGenerator rng = new SecureRandomNumberGenerator();
          String salt = rng.nextBytes().toBase64();
          String hashedPasswordBase64 = new Sha256Hash(requestBody.getPassword(), salt, 1024).toBase64();
          user.setSalt(salt);
          user.setPassword(hashedPasswordBase64);
  
          boolean result = userDAO.persist(user);
          userDAO.closeEntityManager();
  
          if (result) {
              return ReturnResults.results(new ArrayList&lt;User&gt;(asList(user)));
          }
          return "{}";
      }
  </code></pre>
  
  <p>My shiro.ini:</p>
  
  <pre><code>[main]
  ds = com.mysql.cj.jdbc.MysqlDataSource
  ds.serverName = 127.0.0.1
  ds.user = **********
  ds.password = **********
  ds.databaseName = **********
  
  jdbcRealm = org.apache.shiro.realm.jdbc.JdbcRealm
  jdbcRealm.dataSource = $ds
  jdbcRealm.permissionsLookupEnabled = false
  
  jdbcRealm.authenticationQuery = "SELECT password, salt FROM User WHERE email = ?"
  jdbcRealm.userRolesQuery = "SELECT role_name FROM UserRole WHERE email = ?"
  # jdbcRealm.permissionsQuery = "SELECT permission FROM RolesPermissions WHERE role_name = ?"
  
  authc.usernameParam = email
  authc.passwordParam = password
  authc.failureKeyAttribute = shiroLoginFailure
  
  credentialsMatcher = org.apache.shiro.authc.credential.Sha256CredentialsMatcher
  #credentialsMatcher = org.apache.shiro.authc.credential.HashedCredentialsMatcher
  credentialsMatcher.storedCredentialsHexEncoded = false
  # credentialsMatcher.hashAlgorithmName = SHA-256
  credentialsMatcher.hashIterations = 1024
  jdbcRealm.credentialsMatcher = $credentialsMatcher
  
  passwordService = org.apache.shiro.authc.credential.DefaultPasswordService
  passwordMatcher = org.apache.shiro.authc.credential.PasswordMatcher
  passwordMatcher.passwordService = $passwordService
  
  
  shiro.loginUrl = /authentication/login
  
  cacheManager = org.apache.shiro.cache.MemoryConstrainedCacheManager
  securityManager.cacheManager = $cacheManager
  
  sessionManager = org.apache.shiro.web.session.mgt.DefaultWebSessionManager
  securityManager.sessionManager = $sessionManager
  securityManager.sessionManager.sessionIdCookieEnabled = false
  
  ssl.enabled = false
  
  securityManager.realms = $jdbcRealm
  strategy = org.apache.shiro.authc.pam.FirstSuccessfulStrategy
  securityManager.authenticator.authenticationStrategy = $strategy
  
  [users]
  
  [roles]
  
  [urls]
  /authentication/login = authc
  /authentication/logout = logout
  
  /doctors/* = authc
  
  /users/new = anon
  /users/details/* = anon
  /users/* = authc
  </code></pre>
  
  <p><em>My DB Schema</em>:</p>
  
  <p><a href="https://i.stack.imgur.com/QPSQH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QPSQH.png" alt="DB Schema"></a></p>
  
  <p>My Implemented Transfer Objects:</p>
  
  <p>User</p>
  
  <pre><code>package gr.histopath.platform.model.TransferObjects;
  
  import org.hibernate.annotations.CacheConcurrencyStrategy;
  
  import javax.persistence.*;
  import java.util.Objects;
  
  @Entity
  @Cacheable
  @org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.READ_WRITE, region = "EntityCache")
  public class User {
      private long id;
      private String email;
      private String firstName;
      private String lastName;
      private String password;
      private String salt;
      private boolean activated;
  
      @Id
      @Column(name = "id")
      public long getId() {
          return id;
      }
  
      public void setId(long id) {
          this.id = id;
      }
  
      @Basic
      @Column(name = "email")
      public String getEmail() {
          return email;
      }
  
      public void setEmail(String email) {
          this.email = email;
      }
  
      @Basic
      @Column(name = "firstName")
      public String getFirstName() {
          return firstName;
      }
  
      public void setFirstName(String firstName) {
          this.firstName = firstName;
      }
  
      @Basic
      @Column(name = "lastName")
      public String getLastName() {
          return lastName;
      }
  
      public void setLastName(String lastName) {
          this.lastName = lastName;
      }
  
      @Basic
      @Column(name = "password")
      public String getPassword() {
          return password;
      }
  
      public void setPassword(String password) {
          this.password = password;
      }
  
      @Basic
      @Column(name = "salt")
      public String getSalt() {
          return salt;
      }
  
      public void setSalt(String salt) {
          this.salt = salt;
      }
  
      @Basic
      @Column(name = "activated")
      public boolean getActivated() {
          return this.activated;
      }
  
      public void setActivated(boolean activated){
          this.activated = activated;
      }
  
      @Override
      public boolean equals(Object o) {
          if (this == o) return true;
          if (o == null || getClass() != o.getClass()) return false;
          User user = (User) o;
          return id == user.id &amp;&amp;
                  Objects.equals(email, user.email) &amp;&amp;
                  Objects.equals(firstName, user.firstName) &amp;&amp;
                  Objects.equals(lastName, user.lastName) &amp;&amp;
                  Objects.equals(password, user.password) &amp;&amp;
                  Objects.equals(salt, user.salt) &amp;&amp;
                  Objects.equals(activated, user.activated);
      }
  
      @Override
      public int hashCode() {
          return Objects.hash(id, email, firstName, lastName, password, salt, activated);
      }
  }
  </code></pre>
  
  <p>UserRole Transfer Object:</p>
  
  <pre><code>package gr.histopath.platform.model.TransferObjects;
  
  import org.hibernate.annotations.CacheConcurrencyStrategy;
  
  import javax.persistence.*;
  import java.util.Objects;
  
  @Entity
  @Cacheable
  @org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.READ_WRITE, region = "EntityCache")
  public class UserRole {
      private int id;
      private String roleName;
      private String email;
  
      @Id
      public int getId() {
          return id;
      }
  
      public void setId(int id) {
          this.id = id;
      }
  
      @Basic
      @Column(name = "roleName")
      public String getRoleName() {
          return roleName;
      }
  
      public void setRoleName(String roleName) {
          this.roleName = roleName;
      }
  
      @Basic
      @Column(name = "email")
      public String getEmail() {
          return email;
      }
  
      public void setEmail(String email) {
          this.email = email;
      }
  
      @Override
      public boolean equals(Object o) {
          if (this == o) return true;
          if (o == null || getClass() != o.getClass()) return false;
          UserRole userRole = (UserRole) o;
          return id == userRole.id &amp;&amp;
                  Objects.equals(email, userRole.email) &amp;&amp;
                  Objects.equals(roleName, userRole.roleName) &amp;&amp;
                  Objects.equals(email, userRole.email);
      }
  
      @Override
      public int hashCode() {
          return Objects.hash(id, email, roleName);
      }
  }
  </code></pre>
  
  <p>Finally my login() function:</p>
  
  <pre><code> @POST
      @Path("login")
      @Produces(MediaType.TEXT_PLAIN)
      public boolean login(Authentication authData) {
          System.out.println("Param email: " + authData.getEmail());
          System.out.println("Param password: " + authData.getPassword());
          UsernamePasswordToken token = new UsernamePasswordToken(authData.getEmail(), new Sha256Hash(authData.getPassword()).toBase64());
          if (!subject.isAuthenticated()) {
              try {
                  System.out.println("Trying to authenticate with token");
                  subject.login(token);
                  System.out.println("User [" + subject.getPrincipal().toString() + "] logged in successfully.");
                  return true;
              } catch (UnknownAccountException uae) {
                  log.error("Username Not Found!", uae);
                  System.out.println("Username Not Found!");
              } catch (IncorrectCredentialsException ice) {
                  log.error("Invalid Credentials!", ice);
                  System.out.println("Invalid Credentials!");
              } catch (LockedAccountException lae) {
                  log.error("Your Account is Locked!", lae);
                  System.out.println("Your Account is Locked!");
              } catch (AuthenticationException ae) {
                  log.error("Unexpected Error!", ae);
                  System.err.println("Unexpected Error!");
              } catch (Exception ex) {
                  System.out.println(ex.getMessage());
                  ex.printStackTrace();
              }
          } else {
              return true;
          }
  
          return false;
      }
  </code></pre>
  
  <p>After calling <code>subject.login(token)</code> i get shiro error "Unexpected Error!"
  Stack Trace:</p>
  
  <pre><code>Unexpected Error!
  org.apache.shiro.authc.AuthenticationException: There was a SQL error while authenticating user [mixtou@gmail.com]
      at org.apache.shiro.realm.jdbc.JdbcRealm.doGetAuthenticationInfo(JdbcRealm.java:254)
      at org.apache.shiro.realm.AuthenticatingRealm.getAuthenticationInfo(AuthenticatingRealm.java:568)
      at org.apache.shiro.authc.pam.ModularRealmAuthenticator.doSingleRealmAuthentication(ModularRealmAuthenticator.java:180)
      at org.apache.shiro.authc.pam.ModularRealmAuthenticator.doAuthenticate(ModularRealmAuthenticator.java:267)
      at org.apache.shiro.authc.AbstractAuthenticator.authenticate(AbstractAuthenticator.java:198)
      at org.apache.shiro.mgt.AuthenticatingSecurityManager.authenticate(AuthenticatingSecurityManager.java:106)
      at org.apache.shiro.mgt.DefaultSecurityManager.login(DefaultSecurityManager.java:270)
      at org.apache.shiro.subject.support.DelegatingSubject.login(DelegatingSubject.java:256)
      at gr.histopath.platform.controllers.authentication.AuthenticationController.login(AuthenticationController.java:40)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:497)
      at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory.lambda$static$0(ResourceMethodInvocationHandlerFactory.java:76)
      at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:148)
      at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:191)
      at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$TypeOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:243)
      at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:103)
      at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:493)
      at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:415)
      at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:104)
      at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:277)
      at org.glassfish.jersey.internal.Errors$1.call(Errors.java:272)
      at org.glassfish.jersey.internal.Errors$1.call(Errors.java:268)
      at org.glassfish.jersey.internal.Errors.process(Errors.java:316)
      at org.glassfish.jersey.internal.Errors.process(Errors.java:298)
      at org.glassfish.jersey.internal.Errors.process(Errors.java:268)
      at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:289)
      at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:256)
      at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:703)
      at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:416)
      at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:370)
      at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:389)
      at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:342)
      at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:229)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
      at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
      at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61)
      at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
      at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
      at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
      at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
      at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
      at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
      at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
      at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
      at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
      at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
      at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:491)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
      at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:668)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
      at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408)
      at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
      at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:764)
      at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1388)
      at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
      at java.lang.Thread.run(Thread.java:745)
  Caused by: java.sql.SQLException: Parameter index out of range (1 &gt; number of parameters, which is 0).
      at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:545)
      at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:513)
      at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:505)
      at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:479)
      at com.mysql.cj.jdbc.PreparedStatement.checkBounds(PreparedStatement.java:3246)
      at com.mysql.cj.jdbc.PreparedStatement.setInternal(PreparedStatement.java:3230)
      at com.mysql.cj.jdbc.PreparedStatement.setString(PreparedStatement.java:4025)
      at org.apache.shiro.realm.jdbc.JdbcRealm.getPasswordForUser(JdbcRealm.java:281)
      at org.apache.shiro.realm.jdbc.JdbcRealm.doGetAuthenticationInfo(JdbcRealm.java:221)
      ... 70 more
  </code></pre>
  
  <p>Any Ideas what i am missing or doing wrong??
  Is my <code>shiro.ini</code> ok??
  Is this possible without implementing custom classes for <code>Realm</code> and <code>SaltedAuthentificationInfo</code> ?? Most of the examples i have seen so far are implementing custom classes. However i haven't found any recent example using shiro 1.4</p>
  
  <p>Any advice is very appreciated. I am banging my head two days now...</p>
  
  <p>I don't know if there is any problem with dependencies, so i upload my pom.xml also.
  <strong>pom.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &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/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
      &lt;properties&gt;
          &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
      &lt;/properties&gt;
  
      &lt;groupId&gt;gr.histopath.platform&lt;/groupId&gt;
      &lt;artifactId&gt;HistopathPlatform&lt;/artifactId&gt;
      &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
  
      &lt;dependencies&gt;
  
          &lt;!-- https://mvnrepository.com/artifact/javax.ws.rs/javax.ws.rs-api --&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.1&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- Logging API + implementation: --&gt;
          &lt;!--&lt;dependency&gt;--&gt;
              &lt;!--&lt;groupId&gt;org.slf4j&lt;/groupId&gt;--&gt;
              &lt;!--&lt;artifactId&gt;slf4j-simple&lt;/artifactId&gt;--&gt;
              &lt;!--&lt;version&gt;1.7.25&lt;/version&gt;--&gt;
              &lt;!--&lt;scope&gt;test&lt;/scope&gt;--&gt;
          &lt;!--&lt;/dependency&gt;--&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
              &lt;artifactId&gt;slf4j-api&lt;/artifactId&gt;
              &lt;version&gt;1.6.4&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.logging.log4j&lt;/groupId&gt;
              &lt;artifactId&gt;log4j-core&lt;/artifactId&gt;
              &lt;version&gt;2.11.0&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-log4j12 --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
              &lt;artifactId&gt;slf4j-log4j12&lt;/artifactId&gt;
              &lt;version&gt;1.6.4&lt;/version&gt;
              &lt;scope&gt;provided&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
              &lt;artifactId&gt;jcl-over-slf4j&lt;/artifactId&gt;
              &lt;version&gt;1.6.4&lt;/version&gt;
              &lt;scope&gt;runtime&lt;/scope&gt;
          &lt;/dependency&gt;
  
           &lt;!--https://mvnrepository.com/artifact/org.apache.shiro/shiro-core--&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.shiro&lt;/groupId&gt;
              &lt;artifactId&gt;shiro-core&lt;/artifactId&gt;
              &lt;version&gt;1.3.2&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- https://mvnrepository.com/artifact/org.apache.shiro/shiro-web --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.shiro&lt;/groupId&gt;
              &lt;artifactId&gt;shiro-web&lt;/artifactId&gt;
              &lt;version&gt;1.3.2&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- https://mvnrepository.com/artifact/commons-beanutils/commons-beanutils --&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.3&lt;/version&gt;
          &lt;/dependency&gt;
  
  
          &lt;!-- https://mvnrepository.com/artifact/org.apache.shiro/shiro-lang --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.shiro&lt;/groupId&gt;
              &lt;artifactId&gt;shiro-lang&lt;/artifactId&gt;
              &lt;version&gt;1.4.0&lt;/version&gt;
          &lt;/dependency&gt;
  
  
          &lt;!-- https://mvnrepository.com/artifact/org.apache.shiro/shiro-crypto-cipher --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.shiro&lt;/groupId&gt;
              &lt;artifactId&gt;shiro-crypto-cipher&lt;/artifactId&gt;
              &lt;version&gt;1.4.0&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- https://mvnrepository.com/artifact/org.apache.shiro/shiro-crypto-hash --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.shiro&lt;/groupId&gt;
              &lt;artifactId&gt;shiro-crypto-hash&lt;/artifactId&gt;
              &lt;version&gt;1.4.0&lt;/version&gt;
          &lt;/dependency&gt;
  
  
  
          &lt;!--&lt;dependency&gt;--&gt;
              &lt;!--&lt;groupId&gt;org.secnod.shiro&lt;/groupId&gt;--&gt;
              &lt;!--&lt;artifactId&gt;shiro-jersey&lt;/artifactId&gt;--&gt;
              &lt;!--&lt;version&gt;0.2.0&lt;/version&gt;--&gt;
          &lt;!--&lt;/dependency&gt;--&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.glassfish.jersey.media&lt;/groupId&gt;
              &lt;artifactId&gt;jersey-media-json-processing&lt;/artifactId&gt;
              &lt;version&gt;2.27&lt;/version&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;version&gt;2.27&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.glassfish.jersey.media&lt;/groupId&gt;
              &lt;artifactId&gt;jersey-media-sse&lt;/artifactId&gt;
              &lt;version&gt;2.27&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.glassfish.jersey.media&lt;/groupId&gt;
              &lt;artifactId&gt;jersey-media-moxy&lt;/artifactId&gt;
              &lt;version&gt;2.27&lt;/version&gt;
          &lt;/dependency&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;version&gt;2.27&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.glassfish.jersey.inject&lt;/groupId&gt;
              &lt;artifactId&gt;jersey-hk2&lt;/artifactId&gt;
              &lt;version&gt;2.27&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;6.0.5&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;5.3.3.Final&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-validator&lt;/artifactId&gt;
              &lt;version&gt;6.0.11.Final&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate.javax.persistence&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-jpa-2.1-api&lt;/artifactId&gt;
              &lt;version&gt;1.0.2.Final&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate.common&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-commons-annotations&lt;/artifactId&gt;
              &lt;version&gt;5.0.4.Final&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt;
              &lt;artifactId&gt;jackson-annotations&lt;/artifactId&gt;
              &lt;version&gt;2.9.6&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt;
              &lt;artifactId&gt;jackson-core&lt;/artifactId&gt;
              &lt;version&gt;2.9.6&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt;
              &lt;artifactId&gt;jackson-databind&lt;/artifactId&gt;
              &lt;version&gt;2.9.6&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-c3p0 --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-c3p0&lt;/artifactId&gt;
              &lt;version&gt;5.3.3.Final&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!--2nd Level Cache--&gt;
          &lt;!-- https://mvnrepository.com/artifact/net.sf.ehcache/ehcache --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;net.sf.ehcache&lt;/groupId&gt;
              &lt;artifactId&gt;ehcache&lt;/artifactId&gt;
              &lt;version&gt;2.10.5&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-ehcache&lt;/artifactId&gt;
              &lt;version&gt;5.3.3.Final&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-jpamodelgen --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-jpamodelgen&lt;/artifactId&gt;
              &lt;version&gt;5.3.3.Final&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;com.itextpdf&lt;/groupId&gt;
              &lt;artifactId&gt;kernel&lt;/artifactId&gt;
              &lt;version&gt;7.1.1&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;com.itextpdf&lt;/groupId&gt;
              &lt;artifactId&gt;io&lt;/artifactId&gt;
              &lt;version&gt;7.1.1&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;com.itextpdf&lt;/groupId&gt;
              &lt;artifactId&gt;layout&lt;/artifactId&gt;
              &lt;version&gt;7.1.1&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;com.itextpdf&lt;/groupId&gt;
              &lt;artifactId&gt;pdfa&lt;/artifactId&gt;
              &lt;version&gt;7.1.1&lt;/version&gt;
          &lt;/dependency&gt;
  
      &lt;/dependencies&gt;
  
      &lt;build&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;3.7.0&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;source&gt;1.8&lt;/source&gt;
                      &lt;target&gt;1.8&lt;/target&gt;
                      &lt;compilerArguments&gt;
                          &lt;processor&gt;org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor&lt;/processor&gt;
                      &lt;/compilerArguments&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
  
          &lt;/plugins&gt;
      &lt;/build&gt;
  
  &lt;/project&gt;
  </code></pre>
  
  <p>Could the problem be in my user registration code or with the mysql jdbc driver or with web.xml??</p>