Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Reopen] The default profile is ignored when rebuilding an application generated with Jhipster 8.6.0 #26603

Open
1 task done
edilsonmendes opened this issue Jul 2, 2024 · 14 comments

Comments

@edilsonmendes
Copy link
Contributor

Overview of the issue

The error reported in #26333 also occurs in JHipster 8.6.0. When I try to run it using the ./mvnw command or npm run backend:debug, it does not display the default profile in the JHipster banner but the @spring.profiles.active@ placeholder. Furthermore, the application fails to create the LoggingConfigurarion bean, as it is unable to inject the value of the server.port property, as shown in the message below.

Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'server.port' in value "${server.port}"

Sometimes, it runs on first time or if the profile is informed (./mvnw -P dev), however, when changing any file in the backend it fails (same error) when performing the hot reload.

Motivation for or Use Case

The application should run without error using the default profile and shows the correct profile in the banner.

Reproduce the error

-Genarate a monolith JHipster 8.6.0
-Run the application with ./mvnw or npm run backend:debug
-Change any backend file to force hot reload

Related issues

#26333
#25979

Suggest a Fix

N/A

JHipster Version(s)

The error ocurrs in v8.6.0, v8.5.0 and v8.4.0,

JHipster configuration

WARNING! Since JHipster v8, the jhipster command will not use the locally installed generator-jhipster.
If you want to execute the locally installed generator-jhipster, run: npx jhipster

    ██╗ ██╗   ██╗ ████████╗ ███████╗   ██████╗ ████████╗ ████████╗ ███████╗
    ██║ ██║   ██║ ╚══██╔══╝ ██╔═══██╗ ██╔════╝ ╚══██╔══╝ ██╔═════╝ ██╔═══██╗
    ██║ ████████║    ██║    ███████╔╝ ╚█████╗     ██║    ██████╗   ███████╔╝

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

Welcome to the JHipster Information Sub-Generator

pure-v-860@0.0.1-SNAPSHOT /home/embj/git/tjpe/pure-v8.6.0
└── generator-jhipster@8.6.0
JHipster configuration, a .yo-rc.json file generated in the root folder
.yo-rc.json file
{
  "generator-jhipster": {
    "applicationType": "monolith",
    "authenticationType": "oauth2",
    "baseName": "pureV860",
    "buildTool": "maven",
    "cacheProvider": "ehcache",
    "clientFramework": "angular",
    "clientTestFrameworks": [],
    "clientTheme": "none",
    "creationTimestamp": 1719429321098,
    "databaseType": "sql",
    "devDatabaseType": "h2Disk",
    "devServerPort": 4200,
    "enableHibernateCache": true,
    "enableSwaggerCodegen": false,
    "enableTranslation": false,
    "entities": [],
    "feignClient": null,
    "jhipsterVersion": "8.6.0",
    "messageBroker": false,
    "microfrontend": null,
    "microfrontends": [],
    "nativeLanguage": "pt-br",
    "packageName": "com.mycompany.myapp",
    "prodDatabaseType": "postgresql",
    "reactive": false,
    "searchEngine": false,
    "serverPort": null,
    "serverSideOptions": [],
    "serviceDiscoveryType": false,
    "skipUserManagement": true,
    "syncUserWithIdp": false,
    "testFrameworks": [],
    "websocket": false,
    "withAdminUi": false
  }
}
Environment and Tools

openjdk version "17.0.6" 2023-01-17
OpenJDK Runtime Environment Temurin-17.0.6+10 (build 17.0.6+10)
OpenJDK 64-Bit Server VM Temurin-17.0.6+10 (build 17.0.6+10, mixed mode, sharing)

git version 2.25.1

node: v20.12.2
npm: 10.5.0

Docker version 24.0.1, build 6802122

JDL for the Entity configuration(s) entityName.json files generated in the .jhipster directory
@ChangelogDate("20240506143746")
entity SpaceEvent {
  id UUID
  name String required
  date LocalDate required
  description TextBlob required
  photo ImageBlob required
  type SpaceEventType required
}
@ChangelogDate("20240506143747")
entity Mission {
  id UUID
  name String required
  description String
}
@ChangelogDate("20240527105557")
entity Log {
  id UUID
  description String
}
enum SpaceEventType {
  LAUNCH,
  LANDING
}

relationship OneToOne {
  SpaceEvent{mission(name)} to Mission
}
relationship OneToMany {
  Mission{log} to Log{mission}
}

dto SpaceEvent, Mission, Log with mapstruct
paginate SpaceEvent, Mission, Log with pagination
service SpaceEvent, Mission, Log with serviceClass
search SpaceEvent, Mission, Log with no
filter SpaceEvent, Mission, Log

##### **Entity configuration(s) `entityName.json` files generated in the `.jhipster` directory**
Browsers and Operating System
  • Checking this box is mandatory (this is just to show you read everything)
@mraible
Copy link
Contributor

mraible commented Jul 3, 2024

I tried to recreate the issue with jhipster jdl blog-oauth2. When I first start it with ./mvnw, it has the profile set correctly.

Screenshot 2024-07-03 at 09 57 07

If I change a Java class and re-compile it, it restarts and the dev profile is still there.

Screenshot 2024-07-03 at 09 58 44

I tried with your .yo-rc.json and JDL and experienced the same behavior. Here's the console after the restart by Spring DevTools.

Screenshot 2024-07-03 at 10 07 01

From jhipster info:

pure-v-860@0.0.1-SNAPSHOT /Users/mraible/Downloads/reopen
└── generator-jhipster@8.6.0
JHipster configuration, a .yo-rc.json file generated in the root folder
.yo-rc.json file
{
  "generator-jhipster": {
    "applicationType": "monolith",
    "authenticationType": "oauth2",
    "baseName": "pureV860",
    "buildTool": "maven",
    "cacheProvider": "ehcache",
    "clientFramework": "angular",
    "clientTestFrameworks": [],
    "clientTheme": "none",
    "creationTimestamp": 1719429321098,
    "databaseType": "sql",
    "devDatabaseType": "h2Disk",
    "devServerPort": 4200,
    "enableHibernateCache": true,
    "enableSwaggerCodegen": false,
    "enableTranslation": false,
    "entities": [
      "SpaceEvent",
      "Mission",
      "Log"
    ],
    "feignClient": null,
    "jhipsterVersion": "8.6.0",
    "messageBroker": false,
    "microfrontend": null,
    "microfrontends": [],
    "nativeLanguage": "pt-br",
    "packageName": "com.mycompany.myapp",
    "prodDatabaseType": "postgresql",
    "reactive": false,
    "searchEngine": false,
    "serverPort": null,
    "serverSideOptions": [],
    "serviceDiscoveryType": false,
    "skipUserManagement": true,
    "syncUserWithIdp": false,
    "testFrameworks": [],
    "websocket": false,
    "withAdminUi": false
  }
}
Environment and Tools

openjdk version "22.0.1" 2024-04-16
OpenJDK Runtime Environment GraalVM CE 22.0.1+8.1 (build 22.0.1+8-jvmci-b01)
OpenJDK 64-Bit Server VM GraalVM CE 22.0.1+8.1 (build 22.0.1+8-jvmci-b01, mixed mode, sharing)

git version 2.39.3 (Apple Git-146)

node: v20.15.0
npm: 10.7.0

Docker version 26.1.4, build 5650f9b

JDL for the Entity configuration(s) entityName.json files generated in the .jhipster directory
JDL entity definitions
@ChangelogDate("20240506143746")
entity SpaceEvent {
  id UUID
  name String required
  date LocalDate required
  description TextBlob required
  photo ImageBlob required
  type SpaceEventType required
}
@ChangelogDate("20240506143747")
entity Mission {
  id UUID
  name String required
  description String
}
@ChangelogDate("20240527105557")
entity Log {
  id UUID
  description String
}

enum SpaceEventType {
  LAUNCH,
  LANDING
}

relationship OneToOne {
  SpaceEvent{mission(name)} to Mission
}
relationship OneToMany {
  Mission{log} to Log{mission}
}

dto SpaceEvent, Mission, Log with mapstruct
paginate SpaceEvent, Mission, Log with pagination
service SpaceEvent, Mission, Log with serviceClass
search SpaceEvent, Mission, Log with no
filter SpaceEvent, Mission, Log

@mshima
Copy link
Member

mshima commented Jul 4, 2024

Happened in a vscode rebuild with me.
I wonder if it’s a IDE misbehavior.

@edilsonmendes
Copy link
Contributor Author

Happened in a vscode rebuild with me. I wonder if it’s a IDE misbehavior.

Sure. I'm using vscode too. I tested with Intellij and the error does not occur.

Any idea for a workarond? I use wsl and vscode fits perfectly.

@mshima
Copy link
Member

mshima commented Jul 5, 2024

Any idea for a workarond? I use wsl and vscode fits perfectly.

No, probably duplicate the maven-resources-plugin configuration instead of rely on parent pom configuration.

@dmarin2000

This comment was marked as off-topic.

@mraible
Copy link
Contributor

mraible commented Aug 28, 2024

Can y'all see if you can reproduce this issue with 8.7.0?

@dmarin2000

This comment was marked as off-topic.

@mshima
Copy link
Member

mshima commented Aug 28, 2024

@dmarin2000 your error is not the same from issue description. Please open a new issue.

@mshima mshima changed the title [Reopen] The default profile is ignored when run a application generated with Jhipster 8.6.0 [Reopen] The default profile is ignored when rebuilding an application generated with Jhipster 8.6.0 Aug 28, 2024
@mshima
Copy link
Member

mshima commented Aug 28, 2024

Reproducing:

  • generate a new project using maven.
  • open in vscode.
  • run ./mvnw in a terminal
  • change any backend file to trigger a vscode rebuild
  • maven-properties will not replace resources and fail to start with Could not resolve placeholder 'server.port' in value "${server.port}" error.

@edilsonmendes
Copy link
Contributor Author

Can y'all see if you can reproduce this issue with 8.7.0?

The error also occurs in version 8.7.0:

Captura de tela 2024-08-28 212544

@GLinBoy
Copy link

GLinBoy commented Sep 2, 2024

I have the same issue
In my case, I have an old application started by JHipter 7.0.1. Everything worked smoothly until I upgraded to version 8.6 and now I have to pass the profile to it (mvn -Dspring-boot.run.profiles=dev). It can't find the default profile and prints @spring.profiles.active@ instead of it (just like the above image)

The project source code is available here: https://github.com/GLinBoy/MessageCentral

@mshima
Copy link
Member

mshima commented Sep 17, 2024

This is probably fixed in #27062

@mshima mshima closed this as completed Sep 17, 2024
@mshima
Copy link
Member

mshima commented Sep 20, 2024

Not fixed

@mshima mshima reopened this Sep 20, 2024
Copy link
Contributor

github-actions bot commented Sep 20, 2024

JHipster has completed the sample check
.yo-rc.json: valid
Entities JDL: blank
Application: successfully generated
Frontend check: success
Backend check: success
E2E check: success

This check uses jhipster info output from the issue description to generate the sample.
Bug report that does not contain this information will be marked as invalid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants