title: JDBCRealm correctly configured but no successful connection
body: <p>I post this question after having searched thoroughly in Internet with no situation alike found. I'm trying to use a JDBCRealm to authenticate users in a simple test web application deployed with Tomat 7.0.42 and MariaDB 5.5 in a development environment. I've followed all the steps explained at <a href="http://tomcat.apache.org/tomcat-7.0-doc/realm-howto.html" rel="nofollow">Tomcat's How-To</a> and this is what I have:</p>
  
  <p><strong>My app&apos;s deployment descriptor:</strong></p>
  
  <pre><code>&lt;error-page&gt;
      &lt;error-code&gt;403&lt;/error-code&gt;
      &lt;location&gt;/WEB-INF/jsp/desautorizado.jsp&lt;/location&gt;
  &lt;/error-page&gt;
  
  &lt;security-constraint&gt;
      &lt;web-resource-collection&gt;
          &lt;web-resource-name&gt;Acciones&lt;/web-resource-name&gt;
          &lt;url-pattern&gt;/actions/*&lt;/url-pattern&gt;           
      &lt;/web-resource-collection&gt;
  
      &lt;web-resource-collection&gt;
          &lt;web-resource-name&gt;Paginas&lt;/web-resource-name&gt;
          &lt;url-pattern&gt;/sel_tipo_tabla.jsp&lt;/url-pattern&gt;          
      &lt;/web-resource-collection&gt;
  
      &lt;auth-constraint&gt;
          &lt;role-name&gt;estandar&lt;/role-name&gt;
      &lt;/auth-constraint&gt;
  
      &lt;user-data-constraint&gt;
          &lt;transport-guarantee&gt;CONFIDENTIAL&lt;/transport-guarantee&gt;
      &lt;/user-data-constraint&gt;
  &lt;/security-constraint&gt;
  
  &lt;security-role&gt;
      &lt;role-name&gt;estandar&lt;/role-name&gt;
  &lt;/security-role&gt;    
  
  &lt;login-config&gt;
      &lt;auth-method&gt;FORM&lt;/auth-method&gt;
      &lt;form-login-config&gt;
          &lt;form-login-page&gt;/WEB-INF/jsp/login.jsp&lt;/form-login-page&gt;
          &lt;form-error-page&gt;/WEB-INF/jsp/desautorizado.jsp&lt;/form-error-page&gt;
      &lt;/form-login-config&gt;        
  &lt;/login-config&gt;
  </code></pre>
  
  <p><strong>Tomcat's conf/server.xml:</strong></p>
  
  <pre><code>&lt;Engine defaultHost="localhost" name="Catalina"&gt;
     &lt;Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true"&gt;
        &lt;Context docBase="MyAppStruts" path="/MyAppStruts" reloadable="true" source="org.eclipse.jst.jee.server:MyAppStruts"&gt;
           &lt;Realm className="org.apache.catalina.realm.LockOutRealm"&gt;
              &lt;Realm className="org.apache.catalina.realm.JDBCRealm"
                 driverName="org.mariadb.jdbc.Driver"
                 connectionURL="jdbc:mariadb://localhost:3306/desa"
                 connectionName="ruben"
                 connectionPassword="acceso"
                 userTable="usuarios"
                 userNameCol="usuario"
                 userCredCol="password"
                 userRoleTable="roles"
                 roleNameCol="rol" /&gt;
        &lt;/Realm&gt;
      &lt;/Context&gt;        
    &lt;/Host&gt;
  &lt;/Engine&gt;
  </code></pre>
  
  <p>It works perfectly if I use a UserDatabaseRealm instead (Tomcat's default which uses conf/tomcat-users.xml file). However, I always get redirected to the error page if I use a JDBCRealm, even when I introduce an existing user/password in the database.</p>
  
  <p>I forgot to mention that I'm using Eclipse to deploy, so everything is relative to $CATALINA_BASE and <strong>NOT</strong> $CATALINA_HOME. In development environments, $CATALINA_BASE points to $(WORKSPACE_DIR)/.metadata/.plugins/org.eclipse.wst.server.core/tmp0. Thus, MariaDB driver jar file is in $(WORKSPACE_DIR)/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/lib/mariadb-java-client.jar and the public key certificate is in $(WORKSPACE_DIR)/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/hogar.keystore (no problem with this).</p>
  
  <p>By watching the logs, I noticed that whenever I reset the server (only reset, even before launching first request to my app), the following line is written:</p>
  
  <p>127.0.0.1 - - [27/Oct/2013:21:29:32 +0100] "GET / HTTP/1.1" <strong>404</strong> 961</p>
  
  <p>No error or exception is showed in Eclipse's console tab. I guess that Tomcat is unable to establish a connection to the database, but, why?</p>