title: Spring ERR_CONNECTION_REFUSED
body: <p>I am following a tutorial on spring, and so far my code allows you to add a user and view all users. I am now trying to include delete functionality. I added the below code to achieve this. I believe it is exactly as shown in the tutorial, but as a result I get ERR_CONNECTION_REFUSED. In the tutorial this error showed initially but upon refresh went away, but in my case it does not.</p>
  
  <p>index.html</p>
  
  <pre><code>&lt;a href="#" th:href="@{/user/delete/}+${user.id}"&gt;Delete&lt;/a&gt;
  </code></pre>
  
  <p>userService.java</p>
  
  <pre><code>public void delete(User user) {userRepository.delete(user); }
  </code></pre>
  
  <p>userController.java</p>
  
  <pre><code>@RequestMapping(value = "/delete/{user}", method = RequestMethod.GET)
  @ResponseBody
  public String delete(@PathVariable User user)
  {
      String name = user.getFirstname()+" "+user.getLastname();
      userService.delete(user);
      return name;
  }
  </code></pre>
  
  <p>application.properties (the bit added to this line is <code>;FILE_LOCK=FS</code>)</p>
  
  <pre><code>spring.datasource.url=jdbc:h2:file:./database.h2;FILE_LOCK=FS 
  </code></pre>
  
  <p>I noticed in spring boot I now get the following, which I know references the lock method I just added for deleting, but not sure if this is why I am getting connection refused as the tutorial did the same thing but worked:</p>
  
  <blockquote>
    <p>2018-01-24 16:18:54.446  WARN 6589 --- [  restartedMain]
    o.h.e.j.e.i.JdbcEnvironmentInitiator     : HHH000342: Could not obtain
    connection to query metadata : Unsupported file lock method "FS "
    [90060-196] 2018-01-24 16:18:54.447  WARN 6589 --- [  restartedMain]
    ationConfigEmbeddedWebApplicationContext : Exception encountered
    during context initialization - cancelling refresh attempt:
    org.springframework.beans.factory.BeanCreationException: Error
    creating bean with name 'entityManagerFactory' defined in class path
    resource
    [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]:
    Invocation of init method failed; nested exception is
    org.hibernate.service.spi.ServiceException: Unable to create requested
    service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment] 2018-01-24
    16:18:54.447  INFO 6589 --- [  restartedMain]
    o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
    2018-01-24 16:18:54.454  INFO 6589 --- [  restartedMain]
    utoConfigurationReportLoggingInitializer : </p>
    
    <p>Error starting ApplicationContext. To display the auto-configuration
    report re-run your application with 'debug' enabled. 2018-01-24
    16:18:54.459 ERROR 6589 --- [  restartedMain]
    o.s.boot.SpringApplication               : Application startup failed</p>
    
    <p>org.springframework.beans.factory.BeanCreationException: Error
    creating bean with name 'entityManagerFactory' defined in class path
    resource
    [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]:
    Invocation of init method failed; nested exception is
    org.hibernate.service.spi.ServiceException: Unable to create requested
    service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]</p>
  </blockquote>
  
  <p>UPDATE</p>
  
  <p>Documentation for h2 database says this about file lock, so why would this be an unsupported method?:</p>
  
  <blockquote>
    <p>File Locking Method 'FS' This is the default mode for version 1.4 and
    newer. This database file locking mechanism uses native file system
    lock on the database file. No *.lock.db file is created in this case,
    and no background thread is started. This mechanism may not work on
    all systems as expected. Some systems allow to lock the same file
    multiple times within the same virtual machine, and on some system
    native file locking is not supported or files are not unlocked after a
    power failure.</p>
    
    <p>To enable this feature, append ;FILE_LOCK=FS to the database URL.</p>
    
    <p>This feature is relatively new. When using it for production, please
    ensure your system does in fact lock files as expected.</p>
  </blockquote>