Generator-jhipster: H2 database does not work in project created with the --skip-client option

Created on 16 May 2019  路  5Comments  路  Source: jhipster/generator-jhipster

Overview of the issue

To create a monolithic project with only the backend, I used the command jhipster --skip-client and when I use this option the H2 database fails API initialization with the following error:

***************************
APPLICATION FAILED TO START
***************************

Description:

Failed to bind properties under '' to com.zaxxer.hikari.HikariDataSource:

    Property: driverclassname
    Value: org.h2.Driver
    Origin: "driverClassName" from property source "source"
    Reason: Failed to load driver class org.h2.Driver in either of HikariConfig class loader or Thread context classloader

Action:

Update your application's configuration
Motivation for or Use Case

With version 5.8.2, when creating a monolithic project with database H2 and parameter --skip-client the database does not fail and version 6.0.1 is failing.

Reproduce the error

On a Windows 10 system, by PowerShell:

  • mkdir backTesteJhipster
  • cd backTesteJhipster
  • jhipster --skip-client

And select the following options:

Open STS-4, import the project as Maven project and wait for the IDE import process, into "Boot Dashboard", select the imported project and click "(Re)start" and wait for API initialization, error occurs during startup.

Related issues
Suggest a Fix
JHipster Version(s)

Version is 6.0.1 and it's not a regression.

JHipster configuration


JHipster info:

INFO! Using JHipster version installed locally in current project's node_modules
INFO! Executing jhipster:info
INFO! Options: from-cli: true
Welcome to the JHipster Information Sub-Generator

##### **JHipster Version(s)**

[email protected] C:\Usersandre.silva\Documents\workspace-stsbackTesteJhipster
`-- [email protected]

##### **JHipster configuration, a `.yo-rc.json` file generated in the root folder**


<details>
<summary>.yo-rc.json file</summary>
<pre>
{
  "generator-jhipster": {
    "promptValues": {
      "packageName": "com.testback",
      "nativeLanguage": "pt-br"
    },
    "jhipsterVersion": "6.0.1",
    "applicationType": "monolith",
    "baseName": "backTesteJhipster",
    "packageName": "com.testback",
    "packageFolder": "com/testback",
    "serverPort": "8080",
    "authenticationType": "jwt",
    "cacheProvider": "ehcache",
    "enableHibernateCache": true,
    "websocket": false,
    "databaseType": "sql",
    "devDatabaseType": "h2Disk",
    "prodDatabaseType": "mysql",
    "searchEngine": false,
    "messageBroker": false,
    "serviceDiscoveryType": false,
    "buildTool": "maven",
    "enableSwaggerCodegen": false,
    "jwtSecretKey": "bXktc2VjcmV0LXRva2VuLXRvLWNoYW5nZS1pbi1wcm9kdWN0aW9uLWFuZC10by1rZWVwLWluLWEtc2VjdXJlLXBsYWNl",
    "testFrameworks": [],
    "jhiPrefix": "jhi",
    "entitySuffix": "",
    "dtoSuffix": "DTO",
    "otherModules": [],
    "enableTranslation": true,
    "clientPackageManager": "npm",
    "nativeLanguage": "pt-br",
    "languages": [
      "pt-br"
    ],
    "skipClient": true
  }
}
</pre>
</details>


##### **JDL for the Entity configuration(s) `entityName.json` files generated in the `.jhipster` directory**

<details>
<summary>JDL entity definitions</summary>

<pre>

</pre>
</details>


##### **Environment and Tools**

java version "1.8.0_201"
Java(TM) SE Runtime Environment (build 1.8.0_201-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode)

git version 2.21.0.windows.1

node: v10.15.3

npm: 6.4.1

yarn: 1.15.2

Docker version 18.09.2, build 6247962

docker-compose version 1.23.2, build 1110ad01

INFO! Congratulations, JHipster execution is complete!

The .yo-rc.json:

{
  "generator-jhipster": {
    "promptValues": {
      "packageName": "com.testback",
      "nativeLanguage": "pt-br"
    },
    "jhipsterVersion": "6.0.1",
    "applicationType": "monolith",
    "baseName": "backTesteJhipster",
    "packageName": "com.testback",
    "packageFolder": "com/testback",
    "serverPort": "8080",
    "authenticationType": "jwt",
    "cacheProvider": "ehcache",
    "enableHibernateCache": true,
    "websocket": false,
    "databaseType": "sql",
    "devDatabaseType": "h2Disk",
    "prodDatabaseType": "mysql",
    "searchEngine": false,
    "messageBroker": false,
    "serviceDiscoveryType": false,
    "buildTool": "maven",
    "enableSwaggerCodegen": false,
    "jwtSecretKey": "ZTBjMzZlNmQ5YzVmZWY5N2UyNGVkNWQxYjFjYTI1NTE4NzVkYjdlZDcxYzU5Yjk3OThjOTkxYjk0NDVlOTY0ZDMzM2MzZDU1MTMxZDUwNWMyODI1YjhhN2FlNTY2MWEyOTIyNjAwNGQ4MWJkZmMwY2RhZGIwYWM3MjIwNTNjMTU=",
    "testFrameworks": [],
    "jhiPrefix": "jhi",
    "entitySuffix": "",
    "dtoSuffix": "DTO",
    "otherModules": [],
    "enableTranslation": true,
    "clientPackageManager": "npm",
    "nativeLanguage": "pt-br",
    "languages": [
      "pt-br"
    ],
    "skipClient": true
  }
}
Entity configuration(s) entityName.json files generated in the .jhipster directory

No entities were generated in this project.

Browsers and Operating System

Problem occurs in Windows 10 Pro during startup in the STS-4 IDE.

  • [x] Checking this box is mandatory (this is just to show you read everything)
invalid needs-reproduction

Most helpful comment

The correct answer for STS users would be:

  • Right click on the project > maven > select maven profiles ... > choose: dev as this pulls in h2 as compile dependency.

All 5 comments

Hi @AndreKrebs,

This error is related to STS.
Running the command mvn springboot-run starts the application. Hence, it is not a JHipster bug.

As a work-around you can create a custom maven build :
Run > Run configurations ... > Maven Build > New configuration

  • base directory : your project path
  • goal : spring-boot:run

For more info : https://stackoverflow.com/a/49556593/10018727

Thanks @SoniaLahi
As it's not a JHipster bug, I'm closing this

The correct answer for STS users would be:

  • Right click on the project > maven > select maven profiles ... > choose: dev as this pulls in h2 as compile dependency.

The correct answer for STS users would be:

  • Right click on the project > maven > select maven profiles ... > choose: dev as this pulls in h2 as compile dependency.

Thanks, this was helpful.

The correct answer for STS users would be:

* Right click on the project > maven > select maven profiles ... > choose: dev as this pulls in h2 as compile dependency.

Great solutions. Many thanks.

Was this page helpful?
0 / 5 - 0 ratings