2 Replies Latest reply on Dec 12, 2019 2:35 AM by saleemtol

    Servlet Security with in-memory database h2

    saleemtol

      Hi All,

       

      I am exploring servlet security example provided in "quickstart" of Widlfly 17. I have created dynamic web project and deployed it in wildfly successfully.

       

      When I requested "http://localhost:8080/servlet_security/SecuredServlet" its asked BASIC authentication username/password.

       

      I am getting following exception :

       

      Caused by: org.h2.jdbc.JdbcSQLException: Table "USERS" not found; SQL statement:

      SELECT PASSWORD FROM USERS WHERE USERNAME = ? [42102-193]

       

       

      The following are data source configuration in standalone.xml.

       

      <datasource jndi-name="java:jboss/datasources/ServletSecurityDS" pool-name="ServletSecurityDS">

                          <connection-url>jdbc:h2:mem:servlet-security;DB_CLOSE_ON_EXIT=FALSE</connection-url>

                          <driver>h2</driver>

                          <security>

                              <user-name>sa</user-name>

                              <password>sa</password>

                          </security>

         </datasource>

       

      I observed that "quickstart"->"servlet-security" contain "import.sql" DB script which created tables and users. But, How will it be executed ? Where I have to place this script ? What configuration is missing ?

       

      Please help!

       

      Thanks in advance.