1

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

2
  • I have tried --skip-server option 'jhipster import-jdl ../../Downloads/jhipster-jdlX.jh --skip-server'. Then its working. But after I start gateway It does not show entities.
    – ssp
    Nov 22, 2019 at 15:12
  • Please consider editing your question rather than commenting it with what you have tried later. Nov 22, 2019 at 15:26

2 Answers 2

0

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.

2
  • I use microservice gateway. Not monolithic. Just try to shut down microservice apps. Still Entities will work.
    – ssp
    Nov 23, 2019 at 17:59
  • Sorry I misinterpreted your sentence "it works as monolithic", still your question is not clear to me. I wish someone will help you Nov 24, 2019 at 10:22
0

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.

1
  • Your requests still go though the gateway, they don't go directly to services. What do you mean by "Angular Entities", ngrx? Nov 25, 2019 at 21:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.