简体   繁体   中英

Jhipster The entity cannot be generated as the application does not have a database configured in gateway

I am using jhipster version v6.5.0
When I am creating microservice gateway it asks for a database with the following error.

ERROR: Error: The entity cannot be generated as the application does not have a database configured!

Actually First I created a gateway with database and entities will work after my microservices are not running. That means it works as monolithic and I could see all JPA servicers in the gateway. Swagger API showing fine. But menu from Entities not using microservices.

.yo-rc.json

{
"generator-jhipster": {
    "promptValues": {
        "packageName": "com.xxx.gate",
        "nativeLanguage": "en"
    },
    "jhipsterVersion": "6.5.0",
    "applicationType": "gateway",
    "baseName": "myGate2",
    "packageName": "com.xxx.gate",
    "packageFolder": "com/xxx/gate",
    "serverPort": "8080",
    "authenticationType": "jwt",
    "cacheProvider": "hazelcast",
    "enableHibernateCache": false,
    "websocket": "spring-websocket",
    "databaseType": "no",
    "devDatabaseType": "no",
    "prodDatabaseType": "no",
    "searchEngine": false,
    "messageBroker": false,
    "serviceDiscoveryType": "eureka",
    "buildTool": "maven",
    "enableSwaggerCodegen": false,
    "jwtSecretKey": "XXXXXXXX",
    "embeddableLaunchScript": false,
    "useSass": true,
    "clientPackageManager": "npm",
    "clientFramework": "angularX",
    "clientTheme": "lumen",
    "clientThemeVariant": "dark",
    "jhiPrefix": "jhi",
    "entitySuffix": "",
    "dtoSuffix": "DTO",
    "otherModules": [],
    "enableTranslation": true,
    "nativeLanguage": "en",
    "languages": [
        "en"
    ],
    "blueprints": []
}

Please help

JHipster gateway does not persist entities, it's the responsibility of the microservices. This is why you are not able to generate entities in your gateway, the gateway will only import your microservices entities to generate frontend for them.

Rather than converting your monolith into a gateway, you should import your existing entities into a new service.

I tried several possibilities. After changing my angular service class below it starts working as expected(calling microservice rather going directly to gateway).

Generated

public resourceUrl = SERVER_API_URL + 'api/countries';

Changed to

public resourceUrl = SERVER_API_URL + 'services/myservice/api/countries';

I am not sure that is the correct way that Jhipster expected. I have noticed that in gateway SORS filter too.

If you have any git project build with Angular Entities it would be great to understand better.

Thank you for your attention and help.

Have you solved this issue? and how? I am having the same issue as yours, the user entity is not created on the database, actually the whole database configuration properties are not provided, and the Spring Data dependencies are not in the classpath. Even if you add the Spring Data dependency and the configuration properties, nothing gets created on the database. Please help.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM