jhipster / generator-jhipster

JHipster is a development platform to quickly generate, develop, & deploy modern web applications & microservice architectures.
https://www.jhipster.tech
Apache License 2.0
21.5k stars 4.02k forks source link

Failed to generate entity ui from microservie #3599

Closed rainee007 closed 8 years ago

rainee007 commented 8 years ago
Overview of the issue

I download a sample jh file from JDL Studio, and generated a microservice based on it. Later, I generated entity Region for ui gateway, it was failed.

Motivation for or Use Case

I think it should easily work the case.

JHipster Version(s)

3.3.0

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

gateway's: { "generator-jhipster": { "jhipsterVersion": "3.3.0", "baseName": "qyboi", "packageName": "com.mycompany.myapp", "packageFolder": "com/mycompany/myapp", "serverPort": "8080", "authenticationType": "uaa", "uaaBaseName": "uaa", "hibernateCache": "ehcache", "clusteredHttpSession": "no", "websocket": "no", "databaseType": "sql", "devDatabaseType": "mysql", "prodDatabaseType": "mysql", "searchEngine": "no", "buildTool": "maven", "jwtSecretKey": "95302780b4502f07e9988cf3704070633df58b4d", "useSass": false, "applicationType": "gateway", "testFrameworks": [ "gatling" ], "jhiPrefix": "jhi", "enableTranslation": true, "nativeLanguage": "zh-cn", "languages": [ "zh-cn", "en" ] } }

microservice's: { "generator-jhipster": { "jhipsterVersion": "3.3.0", "baseName": "testms", "packageName": "com.mycompany.myapp", "packageFolder": "com/mycompany/myapp", "serverPort": "8081", "authenticationType": "uaa", "hibernateCache": "ehcache", "databaseType": "sql", "devDatabaseType": "mysql", "prodDatabaseType": "mysql", "searchEngine": "no", "buildTool": "maven", "jwtSecretKey": "1fe7cf77a21a76fed05f9c7354fc32a59dc5761c", "enableTranslation": true, "applicationType": "microservice", "testFrameworks": [ "gatling" ], "jhiPrefix": "jhi", "skipClient": true, "skipUserManagement": true, "nativeLanguage": "zh-cn", "languages": [ "zh-cn", "en" ] } }

Entity configuration(s) entityName.json files generated in the .jhipster directory

Region.json: { "relationships": [], "fields": [ { "fieldId": 1, "fieldName": "regionId", "fieldType": "Long" }, { "fieldId": 2, "fieldName": "regionName", "fieldType": "String" } ], "changelogDate": "20160515153525", "dto": "no", "pagination": "no", "service": "no", "entityTableName": "region" }

Browsers and Operating System

Mac OS latest

Reproduce the error

The Registry is running. The UAA is running. The microservice has been generated. The ui gateway has been generated. After ran yo jhipster:entity Region under ui gateway, got error below: $ yo jhipster:entity Region

The entity Region is being created.

? Do you want to generate this entity from an existing microservice? Yes ? Enter the path to the microservice root directory: ../testms

Found the .jhipster/Region.json configuration file, entity can be automatically generated!

Error jhipster:entity Region

Microservice name for the entity is not found. Entity cannot be generated!

deepu105 commented 8 years ago

Did you use import-jdl sub generator or jhipster uml to generate the entity? Also did you provide the mocroservice name in the JDL file?

deepu105 commented 8 years ago

This might be a duplicate of https://github.com/jhipster/generator-jhipster/issues/3532

rainee007 commented 8 years ago

I used jhipster uml to generate the entities. The JDL file is:

entity Region { regionId Long, regionName String }

entity Country { countryId Long, countryName String }

entity Location { locationId Long, streetAddress String, postalCode String, city String, stateProvince String }

entity Department { departmentId Long, departmentName String required }

entity Task { taskId Long, title String, description String }

/**

entity Job { jobId Long, jobTitle String, minSalary Long, maxSalary Long }

entity JobHistory { startDate ZonedDateTime, endDate ZonedDateTime, language Language }

enum Language { FRENCH, ENGLISH, SPANISH }

relationship OneToOne { Country{region} to Region }

relationship OneToOne { Location{country} to Country }

relationship OneToOne { Department{location} to Location }

relationship ManyToMany { Job{task(title)} to Task{job} }

relationship OneToMany { Employee{job} to Job }

relationship OneToMany { /* * A relationship / Department{employee} to / * Another side of the same relationship */ Employee }

relationship ManyToOne { Employee{manager} to Employee }

relationship OneToOne { JobHistory{job} to Job }

relationship OneToOne { JobHistory{department} to Department }

relationship OneToOne { JobHistory{employee} to Employee }

paginate JobHistory, Employee with infinite-scroll paginate Job with pagination

dto Employee with mapstruct

service Employee with serviceClass

rainee007 commented 8 years ago

I could see all the rest apis in the running microservice, but just could not generate UI code via jhipster:entity cli following the recommended way.

deepu105 commented 8 years ago

I dont see you defining the microserviceName as per the documentation anywhere in JDL. Please check the JDL docs and define it properly and ise jhipster uml to generate the entities.

deepu105 commented 8 years ago

Here is the related docs https://jhipster.github.io/jdl/#microserviceoptions

davidweianibone commented 7 years ago

Hi, I have the same issue and followed jdl docs. Didn't quit understand if and why do I need to specify my microservice name. I have used the jhipster uml to generate the micro services entities.

This is my stack trace for the error: Davids-IMac:AniBoneGateWay david$ yo jhipster:entity Task

The entity Task is being created.

? Do you want to generate this entity from an existing microservice? Yes ? Enter the path to the microservice root directory: /Users/david/git/AniBoneMcrService

Found the .jhipster/Task.json configuration file, entity can be automatically generated!

Error jhipster:entity Task

ERROR! Microservice name for the entity is not found. Entity cannot be generated!

JHipster Version(s)
ani-bone-gate-way@0.0.0 /Users/david/git/AniBoneGateWay
└── generator-jhipster@3.8.0 
JHipster configuration, a .yo-rc.json file generated in the root folder
{
  "generator-jhipster": {
    "jhipsterVersion": "3.8.0",
    "baseName": "AniBoneGateWay",
    "packageName": "com.anibone",
    "packageFolder": "com/anibone",
    "serverPort": "8080",
    "authenticationType": "jwt",
    "hibernateCache": "ehcache",
    "clusteredHttpSession": "hazelcast",
    "websocket": "spring-websocket",
    "databaseType": "sql",
    "devDatabaseType": "mysql",
    "prodDatabaseType": "mysql",
    "searchEngine": "elasticsearch",
    "messageBroker": false,
    "buildTool": "maven",
    "enableSocialSignIn": false,
    "jwtSecretKey": "dda38f675b4a9ebae124d72505a4758974e8f67d",
    "useSass": true,
    "applicationType": "gateway",
    "testFrameworks": [
      "gatling",
      "cucumber",
      "protractor"
    ],
    "jhiPrefix": "jhi",
    "enableTranslation": false
  }
}
Entity configuration(s) entityName.json files generated in the .jhipster directory

ls: no such file or directory: .jhipster/*.json

Browsers and Operating System

java version "1.8.0_101" Java(TM) SE Runtime Environment (build 1.8.0_101-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)

git version 2.10.0

node: v4.6.0

npm: 2.15.9

bower: 1.7.9

gulp: [21:26:43] CLI version 1.2.2 [21:26:43] Local version 3.9.1

yeoman: 1.8.5

Docker version 1.12.1, build 6f9534c

docker-compose version 1.8.0, build f3628c7

tezcane commented 7 years ago

Same issue as @davidweianibone . It would be nice if the JDL documentation had a simple step 1. 2. 3. guide on how to make entities on the microservice (using JDL studio) then import these entities into the gateway. I have found, there is a lot of gray area around JDL studio. Although an awesome tool, I wish the documentations were a little clearer. Once I learn it I was hoping to contribute to improving some of the JHipster docs...

tezcane commented 7 years ago

@davidweianibone got it working by deleting .yo-rc-global.json which was in my home folder. It was pointing to generator v3.8.0, but I had upgraded to v3.9.1 today.

It looks like this now:

{
  "generator-jhipster:3.9.1": {
    "promptValues": {
      "microservicePath": "../microservice"
    }
  }
}
davidweianibone commented 7 years ago

Don't find such file in my project. The only file I have is .yo-rc.json which looks like this

{ "generator-jhipster": { "jhipsterVersion": "3.8.0", "baseName": "AniBoneGateWay", "packageName": "com.anibone", "packageFolder": "com/anibone", "serverPort": "8080", "authenticationType": "jwt", "hibernateCache": "ehcache", "clusteredHttpSession": "hazelcast", "websocket": "spring-websocket", "databaseType": "sql", "devDatabaseType": "mysql", "prodDatabaseType": "mysql", "searchEngine": "elasticsearch", "messageBroker": false, "buildTool": "maven", "enableSocialSignIn": false, "jwtSecretKey": my secrete key, "useSass": true, "applicationType": "gateway", "testFrameworks": [ "gatling", "cucumber", "protractor" ], "jhiPrefix": "jhi", "enableTranslation": false } }

pascalgrimaud commented 7 years ago

Plz guys, don't camp on old tickets. If you have an issue, plz open a new one, with :