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

Get "Not Found" error for Entities menu for Micro Frontend entities #26245

Closed
mwrightmtw opened this issue May 23, 2024 · 3 comments
Closed

Get "Not Found" error for Entities menu for Micro Frontend entities #26245

mwrightmtw opened this issue May 23, 2024 · 3 comments

Comments

@mwrightmtw
Copy link

A description of the issue is provided in StackOverflow post: https://stackoverflow.com/questions/78486513/angular-micro-frontends-remoteentry-js-not-found-error?noredirect=1#comment138376267_78486513

JHipster info:
Welcome to JHipster v8.4.0

Welcome to the JHipster Information Sub-Generator

JHipster configuration, a .yo-rc.json file generated in the root folder
.yo-rc.json file
{
  "generator-jhipster": {
    "appsFolders": [
      "CaplWorkbook",
      "CaplCommon",
      "CaplLap"
    ],
    "baseName": "workspaces",
    "clientPackageManager": "npm",
    "directoryPath": "./",
    "dockerCompose": true,
    "jhipsterVersion": "8.4.0",
    "monorepository": true
  }
}
.yo-rc.json file for CaplWorkbook
{
  "generator-jhipster": {
    "applicationIndex": 0,
    "applicationType": "gateway",
    "applications": {
      "CaplCommon": {
        "applicationIndex": 1,
        "clientFramework": "angular",
        "serverPort": "9093"
      },
      "CaplLap": {
        "applicationIndex": 2,
        "clientFramework": "angular",
        "serverPort": "9094"
      }
    },
    "baseName": "CaplWorkbook",
    "buildTool": "maven",
    "clientFramework": "angular",
    "databaseType": "no",
    "devDatabaseType": "no",
    "devServerPort": 4200,
    "enableHibernateCache": false,
    "enableTranslation": true,
    "entities": [],
    "jhipsterVersion": "8.4.0",
    "languages": [
      "en",
      "es"
    ],
    "microfrontends": [
      {
        "baseName": "CaplCommon"
      },
      {
        "baseName": "CaplLap"
      }
    ],
    "monorepository": true,
    "nativeLanguage": "en",
    "packageFolder": "com/kelc/capl/gateway/workbook",
    "packageName": "com.kelc.capl.gateway.workbook",
    "prodDatabaseType": "no",
    "reactive": false,
    "serverPort": "9092",
    "serviceDiscoveryType": "consul",
    "skipCommitHook": true,
    "skipUserManagement": true,
    "testFrameworks": [
      "cypress"
    ]
  }
}
.yo-rc.json file for CaplCommon
{
  "generator-jhipster": {
    "applicationIndex": 1,
    "applicationType": "microservice",
    "baseName": "CaplCommon",
    "buildTool": "maven",
    "clientFramework": "angular",
    "databaseType": "sql",
    "devDatabaseType": "postgresql",
    "devServerPort": 4201,
    "enableHibernateCache": false,
    "enableTranslation": true,
    "entities": [
      "Organization",
      "HierarchyEntity1",
      "HierarchyEntity2",
      "HierarchyEntity3",
      "Site",
      "ChildGroup",
      "SchoolYear",
      "LicensePool",
      "Child",
      "ChildGroupLink",
      "CaplUser"
    ],
    "gatewayServerPort": "9092",
    "jhipsterVersion": "8.4.0",
    "languages": [
      "en",
      "es"
    ],
    "lastLiquibaseTimestamp": 1715717087000,
    "monorepository": true,
    "nativeLanguage": "en",
    "packageFolder": "com/kelc/capl/service/common",
    "packageName": "com.kelc.capl.service.common",
    "prodDatabaseType": "postgresql",
    "reactive": false,
    "serverPort": "9093",
    "serviceDiscoveryType": "consul",
    "skipCommitHook": true,
    "skipUserManagement": true,
    "testFrameworks": [
      "cypress"
    ]
  }
}
.yo-rc.json file for CaplLap
{
  "generator-jhipster": {
    "applicationIndex": 2,
    "applicationType": "microservice",
    "baseName": "CaplLap",
    "buildTool": "maven",
    "clientFramework": "angular",
    "databaseType": "sql",
    "devDatabaseType": "mssql",
    "devServerPort": 4202,
    "enableHibernateCache": false,
    "enableTranslation": true,
    "entities": [
      "LapChildHierarchyLink",
      "LapSubscaleLookup",
      "LapItemLookup",
      "LapSoftwareSource",
      "LapAssessment",
      "LapBkSubscale",
      "LapBkItem",
      "LapBkObservation",
      "LapBkObservationItem",
      "LapObservationFreeFormText"
    ],
    "gatewayServerPort": "9092",
    "jhipsterVersion": "8.4.0",
    "languages": [
      "en",
      "es"
    ],
    "lastLiquibaseTimestamp": 1715717027000,
    "monorepository": true,
    "nativeLanguage": "en",
    "packageFolder": "com/kelc/capl/service/lap",
    "packageName": "com.kelc.capl.service.lap",
    "prodDatabaseType": "mssql",
    "reactive": false,
    "serverPort": "9094",
    "serviceDiscoveryType": "consul",
    "skipCommitHook": true,
    "skipUserManagement": true,
    "testFrameworks": [
      "cypress"
    ]
  }
}
##### **Environment and Tools**

openjdk version "21.0.2" 2024-01-16
OpenJDK Runtime Environment (build 21.0.2+13-58)
OpenJDK 64-Bit Server VM (build 21.0.2+13-58, mixed mode, sharing)

git version 2.37.1.windows.1

node: v22.0.0
npm: 10.5.1

Docker version 26.0.0, build 2ae903e

JDL for the Entity configuration(s) entityName.json files generated in the .jhipster directory
JDL entity definitions

Overview of the issue

Items for Micro Frontends in Entities menu on Gateway show "Failed to load" error

Motivation for or Use Case

I am not able to use Micro Frontends

Reproduce the error

I have created two microservices and one gateway app using micro frontends. My dev environment is Windows 11. I am using Consul and have it running in a Docker container. One of the microservices uses PostgreSQL and the other one uses Microsoft SQL. I have a PostgreSQL engine and a Microsoft SQL engine running locally. I can run all three apps: 2 Microservices (CaplCommon, CaplLap) and one gateway (CaplWorkbook) from Eclipse.

I did an npm start for each of the projects and can log into all three. When the gateway app logs in and I select the Entities menu it has the following two entries:

Failed to load caplcommon entries
Failed to load capllap entries.
I looked in the network tab for the browser developer tools and saw this: Request URL: http://localhost:9004/services/caplcommon/remoteEntry.js Request Method: GET Status Code: 404 Not Found.

If I open a tab in the browser and manually enter the http://localhost:9004/services/caplcommon/remoteEntry.js, I get the following:

{
"type": "https://www.jhipster.tech/problem/problem-with-message",
"titl": "Not Found",
"stats": 404,
"detil": "No static resource services/caplcommon/remoteEntry.js.",
"instnce": "/services/caplcommon/remoteEntry.js",
"mesage" : " error.http.404",
"path" : "/services/caplcommon/remoteEntry.js"
}.
The caplcommon and capllab microservices and caplworkbook gateway springboot are not logging any errors. Had the same error for the capllap microservice

Related issues

None

Suggest a Fix

Unknown

JHipster Version(s)

8.4

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

None

Browsers and Operating System

Windows 11 Version 10.0.22631 Build 22631
Chrome Version 125.0.6422.76

  • [X ] Checking this box is mandatory (this is just to show you read everything)
@mshima
Copy link
Member

mshima commented May 23, 2024

The gateway in the provided sample is servlet based (non-reactive).
It’s experimental in jhipster:

  • spring-cloud-gateway-mvc does not provide service-discovery integration yet. So routes needs to be manually configured.
  • swagger ui will not work.

Please see #25715 for more info.

@mwrightmtw
Copy link
Author

mwrightmtw commented May 29, 2024

I tried the suggested work around to add the following to the Gateway Application:
routes ["CaplCommon:CaplCommon:9093","CaplLap:CaplLap:9094"]

At first I was not able to run Jhipster to generate because it said routes was unrecongnized. So I cloned the latest version of Jhipster and used it and was able to get past it.

I also had to add the following dependency to the pom files for the two microservices that use a database:

	<dependency>
	    <groupId>jakarta.data</groupId>
	    <artifactId>jakarta.data-api</artifactId>
	    <version>1.0.0-RC1</version>
	</dependency>

When running the apps, I still get a 404 Not Found whenever it tries to load the Entities from in the Workbook Gateway app from the 2 CaplCommon and CaplLap microservices. It gets the 404 results when calling the loadNavbarItems method in the navbar.component.ts file. I see the following in the Network tab of the Browsers Developer Tools:

Request URL: http://localhost:9004/services/caplcommon/remoteEntry.js
Request Method: GET
Status Code: 404 Not Found
Remote Address: [::1]:9004
Referrer Policy: strict-origin-when-cross-origin

Have any other suggestions?

Copy link
Contributor

github-actions bot commented May 29, 2024

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

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.

@mraible mraible added this to the 8.5.0 milestone May 31, 2024
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

3 participants