-6

When I run the command jhipster import-jdl jhipster-jdl.jdl it shows this error:

ERROR! An error occured while running jhipster:spring-cache#customizeFiles

ERROR! ERROR! Error editing file E:\ElectronicInvoice\src\main\java\org\electronic\app\config\CacheConfiguration.java: Missing required jhipster-needle redis-add-entry not found at 'E:\ElectronicInvoice\src\main\java\org\electronic\app\config\CacheConfiguration.java' at Error: Missing required jhipster-needle redis-add-entry not found at 'E:\ElectronicInvoice\src\main\java\org\electronic\app\config\CacheConfiguration.java'

Please help me ! Thank for all

4
  • please provide your jhipster-jdl.jdl. Commented Nov 15 at 3:10
  • @life888888 I downloaded it from this site start.jhipster.tech/jdl-studio Commented Nov 15 at 3:39
  • 1
    The website start.jhipster.tech/jdl-studio provides three templates: default sample, simple monolith, and simple microservice. You can choose one, so should I try to guess which template you picked? I’m guessing you chose simple microservice. Am I correct? Commented Nov 15 at 4:13
  • @life888888 no, i choose first, could this be a bug in the CacheConfiguration class? Commented Nov 15 at 9:24

1 Answer 1

0

The website start.jhipster.tech/jdl-studio provides three templates: default sample, simple monolith, and simple microservice.

I couldn't tell which template the questioner used, so I verified all three.

  • templates-1: simple microservice, download file: jhipster-jdl-simple-microservice.jdl put the file into directory name: jhipster-jdl-simple-microservice

  • templates-2: simple monolith, download file: jhipster-jdl-simple-monolith.jdl put the file into directory name: jhipster-jdl-simple-monolith

  • templates-3: default sample, download file: jhipster-jdl-default-sample.jdl put the file into directory name: jhipster-jdl-default-sample

Environment configuration:

  • Microsoft Windows - Version 10.0.17763.379

  • java -version

    • openjdk version "17.0.14" 2025-01-21 (OpenJDK Runtime Environment Temurin-17.0.14+7)
  • javac -version

    • javac 17.0.14
  • mvn -v

    • Apache Maven 3.9.11 (3e54c93a704957b63ee3494413a2b544fd3d825b)
  • npm -v

    • 10.9.2
  • node -v

    • v22.15.0
  • git -v

    • git version 2.51.2.windows.1

jhipster install command: npm install -g [email protected]

  • jhipster --version
    • 8.11.0

git config command:

  • git config --global user.email "[email protected]"
  • git config --global user.name "demo"

Round - 1 - simple-microservice

cd D:\WK\jhipster-jdl-simple-microservice

jhipster import-jdl jhipster-jdl-simple-microservice.jdl

Run finish.

Round - 2 - simple monolith

cd D:\WK\jhipster-jdl-simple-monolith

jhipster import-jdl jhipster-jdl-simple-monolith.jdl

Run finish.

Round - 3 - default sample

cd D:\WK\jhipster-jdl-default-sample

jhipster import-jdl jhipster-jdl-default-sample.jdl

get error message:

D:\WK\jhipster-jdl-default-sample>jhipster import-jdl jhipster-jdl-default-sample.jdl

        ██╗ ██╗   ██╗ ████████╗ ███████╗   ██████╗ ████████╗ ████████╗ ███████╗
        ██║ ██║   ██║ ╚══██╔══╝ ██╔═══██╗ ██╔════╝ ╚══██╔══╝ ██╔═════╝ ██╔═══██╗
        ██║ ████████║    ██║    ███████╔╝ ╚█████╗     ██║    ██████╗   ███████╔╝
  ██╗   ██║ ██╔═══██║    ██║    ██╔════╝   ╚═══██╗    ██║    ██╔═══╝   ██╔══██║
  ╚██████╔╝ ██║   ██║ ████████╗ ██║       ██████╔╝    ██║    ████████╗ ██║  ╚██╗
   ╚═════╝  ╚═╝   ╚═╝ ╚═══════╝ ╚═╝       ╚═════╝     ╚═╝    ╚═══════╝ ╚═╝   ╚═╝
                            https://www.jhipster.tech
Welcome to JHipster v8.11.0

INFO! Generating jdls jhipster-jdl-default-sample.jdl
WARNING! The paginate option is deprecated, please use pagination instead.
WARNING! The paginate option is deprecated, please use pagination instead.
ERROR! An error occured while running jhipster:jdl#parseJDL
ERROR! ERROR! The passed type must not be nil.
Error: The passed type must not be nil.
    at Object.getIsType (file:///C:/Users/IEUser/AppData/Roaming/npm/node_modules/generator-jhipster/dist/lib/jhipster/field-types.js:101:15)
    at getTypeCheckingFunction (file:///C:/Users/IEUser/AppData/Roaming/npm/node_modules/generator-jhipster/dist/lib/jdl/converters/validators/jdl-without-application-validator.js:160:23)
    at file:///C:/Users/IEUser/AppData/Roaming/npm/node_modules/generator-jhipster/dist/lib/jdl/converters/validators/jdl-without-application-validator.js:91:42
    at Array.forEach (<anonymous>)
    at checkForFieldErrors (file:///C:/Users/IEUser/AppData/Roaming/npm/node_modules/generator-jhipster/dist/lib/jdl/converters/validators/jdl-without-application-validator.js:80:32)
    at file:///C:/Users/IEUser/AppData/Roaming/npm/node_modules/generator-jhipster/dist/lib/jdl/converters/validators/jdl-without-application-validator.js:74:13
    at file:///C:/Users/IEUser/AppData/Roaming/npm/node_modules/generator-jhipster/dist/lib/jdl/core/models/jdl-object.js:129:13
    at Array.forEach (<anonymous>)
    at JDLObject.forEachEntity (file:///C:/Users/IEUser/AppData/Roaming/npm/node_modules/generator-jhipster/dist/lib/jdl/core/models/jdl-object.js:127:36)
    at checkForEntityErrors (file:///C:/Users/IEUser/AppData/Roaming/npm/node_modules/generator-jhipster/dist/lib/jdl/converters/validators/jdl-without-application-validator.js:67:19)

jhipster-jdl-default-sample.jdl

entity Region {
    regionName String
}

entity Country {
    countryName String
}

// an ignored comment
/** not an ignored comment */
entity Location {
    streetAddress String
    postalCode String
    city String
    stateProvince String
}

entity Department {
    departmentName String required
}

/**
 * Task entity.
 * @author The JHipster team.
 */
entity Task {
    title String
    description String
}

/**
 * The Employee entity.
 */
entity Employee {
    /**
    * The firstname attribute.
    */
    firstName String
    lastName String
    email String
    phoneNumber String
    hireDate Instant
    salary Long
    commissionPct Long
}

entity Job {
    jobTitle String
    minSalary Long
    maxSalary Long
}

entity JobHistory {
    startDate Instant
    endDate Instant
    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}
}

// defining multiple OneToMany relationships with comments
relationship OneToMany {
    Employee to Job{employee}
    /**
    * A relationship
    */
    Department to
    /**
    * Another side of the same relationship
    */
    Employee{department}
}

relationship ManyToOne {
    Employee{manager} to Employee
}

// defining multiple oneToOne relationships
relationship OneToOne {
    JobHistory{job} to Job
    JobHistory{department} to Department
    JobHistory{employee} to Employee
}

// Set pagination options
paginate JobHistory, Employee with infinite-scroll
paginate Job with pagination

// Use Data Transfer Objects (DTO)
// dto * with mapstruct

// Set service options to all except few
service all with serviceImpl except Employee, Job

// Set an angular suffix
// angularSuffix * with mySuffix

This configuration file does not contain any settings related to the Application.

Therefore, we must provide the relevant Application configuration requirements:

  • applicationType : monolith
  • authenticationType : session
  • buildTool : Maven
  • database : PostgreSQL
  • cacheProvider : ehcache ....

Therefore, we need to add the Application settings to jhipster-jdl-default-sample.jdl, making it jhipster-jdl-default-sample-ADD-APP-CONFIG.jdl

put the file into directory name: jhipster-jdl-default-sample-ADD-APP-CONFIG

Round - 4 - default sample - ADD APP CONFIG

cd D:\WK\jhipster-jdl-default-sample-ADD-APP-CONFIG

jhipster import-jdl jhipster-jdl-default-sample-ADD-APP-CONFIG.jdl

Run finish.

jhipster-jdl-default-sample-ADD-APP-CONFIG.jdl

application {
  config {
    applicationType monolith
    baseName DemoApp
    packageName com.demo.app
    authenticationType session
    buildTool maven
    prodDatabaseType postgresql
    devDatabaseType postgresql
    enableHibernateCache true
    cacheProvider ehcache
    dtoSuffix DTO
    clientFramework angular
    clientTheme none
    enableTranslation false
  }
  entities *
}

/***********************
 * Entities
 ***********************/
 
entity Region {
    regionName String
}

entity Country {
    countryName String
}

// an ignored comment
/** not an ignored comment */
entity Location {
    streetAddress String
    postalCode String
    city String
    stateProvince String
}

entity Department {
    departmentName String required
}

/**
 * Task entity.
 * @author The JHipster team.
 */
entity Task {
    title String
    description String
}

/**
 * The Employee entity.
 */
entity Employee {
    /**
    * The firstname attribute.
    */
    firstName String
    lastName String
    email String
    phoneNumber String
    hireDate Instant
    salary Long
    commissionPct Long
}

entity Job {
    jobTitle String
    minSalary Long
    maxSalary Long
}

entity JobHistory {
    startDate Instant
    endDate Instant
    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}
}

// defining multiple OneToMany relationships with comments
relationship OneToMany {
    Employee to Job{employee}
    /**
    * A relationship
    */
    Department to
    /**
    * Another side of the same relationship
    */
    Employee{department}
}

relationship ManyToOne {
    Employee{manager} to Employee
}

// defining multiple oneToOne relationships
relationship OneToOne {
    JobHistory{job} to Job
    JobHistory{department} to Department
    JobHistory{employee} to Employee
}

// Set pagination options
paginate JobHistory, Employee with infinite-scroll
paginate Job with pagination

// Use Data Transfer Objects (DTO)
// dto * with mapstruct

// Set service options to all except few
service all with serviceImpl except Employee, Job

// Set an angular suffix
// angularSuffix * with mySuffix

The only difference between this file (jhipster-jdl-default-sample-ADD-APP-CONFIG.jdl) and jhipster-jdl-default-sample-ADD-APP-CONFIG.jdl is the application settings added at the very beginning of the file.

application {
  config {
    applicationType monolith
    baseName DemoApp
    packageName com.demo.app
    authenticationType session
    buildTool maven
    prodDatabaseType postgresql
    devDatabaseType postgresql
    enableHibernateCache true
    cacheProvider ehcache
    dtoSuffix DTO
    clientFramework angular
    clientTheme none
    enableTranslation false
  }
  entities *
}

Note:

In Round - 3 - default sample (jhipster-jdl-default-sample.jdl), I was unable to reproduce the exact same error message as the questioner.

ERROR! An error occured while running jhipster:spring-cache#customizeFiles

ERROR! ERROR! Error editing file E:\ElectronicInvoice\src\main\java\org\electronic\app\config\CacheConfiguration.java: Missing required jhipster-needle redis-add-entry not found at 'E:\ElectronicInvoice\src\main\java\org\electronic\app\config\CacheConfiguration.java' at Error: Missing required jhipster-needle redis-add-entry not found at 'E:\ElectronicInvoice\src\main\java\org\electronic\app\config\CacheConfiguration.java'`)

My error message is:

ERROR! An error occured while running jhipster:jdl#parseJDL
ERROR! ERROR! The passed type must not be nil.
Error: The passed type must not be nil.
    at Object.getIsType (file:///C:/Users/IEUser/AppData/Roaming/npm/node_modules/generator-jhipster/dist/lib/jhipster/field-types.js:101:15)
    at getTypeCheckingFunction (file:///C:/Users/IEUser/AppData/Roaming/npm/node_modules/generator-jhipster/dist/lib/jdl/converters/validators/jdl-without-application-validator.js:160:23)
    at file:///C:/Users/IEUser/AppData/Roaming/npm/node_modules/generator-jhipster/dist/lib/jdl/converters/validators/jdl-without-application-validator.js:91:42

If you are using the default sample, its settings do not include application-related settings, nor does it include the redis cacheProvider setting. I don't understand why your settings are displaying unexplained Redis-related error messages.

Sign up to request clarification or add additional context in comments.

1 Comment

ohhhh, thank you. In my jdl file, i missing application config line :v

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.