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.52k stars 4.02k forks source link

Lauching a JHipster project with production profile fails #17875

Closed M4jor-Tom closed 2 years ago

M4jor-Tom commented 2 years ago
JHipster Version(s)
lapp-li@0.0.1-SNAPSHOT C:\Users\tom-v\Repos\LappLi
`-- generator-jhipster@7.3.1
JHipster configuration, a .yo-rc.json file generated in the root folder
.yo-rc.json file
{
  "generator-jhipster": {
    "applicationType": "monolith",
    "baseName": "LappLi",
    "jhipsterVersion": "7.3.1",
    "skipClient": false,
    "skipServer": false,
    "skipUserManagement": false,
    "skipCheckLengthOfIdentifier": false,
    "skipFakeData": false,
    "jhiPrefix": "jhi",
    "entitySuffix": "",
    "dtoSuffix": "DTO",
    "testFrameworks": [],
    "blueprints": [],
    "otherModules": [],
    "pages": [],
    "creationTimestamp": 1637698315578,
    "serviceDiscoveryType": "no",
    "reactive": false,
    "authenticationType": "jwt",
    "packageName": "com.muller.lappli",
    "serverPort": "8080",
    "cacheProvider": "ehcache",
    "enableHibernateCache": true,
    "databaseType": "sql",
    "devDatabaseType": "h2Disk",
    "prodDatabaseType": "mysql",
    "buildTool": "maven",
    "serverSideOptions": [],
    "websocket": false,
    "searchEngine": false,
    "messageBroker": false,
    "enableSwaggerCodegen": false,
    "clientFramework": "react",
    "withAdminUi": true,
    "clientTheme": "none",
    "enableTranslation": true,
    "nativeLanguage": "en",
    "jwtSecretKey": "YourJWTSecretKeyWasReplacedByThisMeaninglessTextByTheJHipsterInfoCommandForObviousSecurityReasons",
    "devServerPort": 9060,
    "clientPackageManager": "npm",
    "clientThemeVariant": "",
    "languages": ["en", "fr", "de"],
    "enableGradleEnterprise": false,
    "entities": [
      "Element",
      "ElementKind",
      "Copper",
      "Material",
      "ElementSupply",
      "Lifter",
      "LifterRunMeasure",
      "BangleSupply",
      "Bangle",
      "ElementKindEdition",
      "MaterialMarkingStatistic",
      "CustomComponentSupply",
      "CustomComponent",
      "Strand",
      "OneStudySupply",
      "Study",
      "StrandSupply",
      "UserData",
      "CentralAssembly",
      "CoreAssembly",
      "IntersticeAssembly",
      "Sheathing",
      "SupplyPosition"
    ],
    "lastLiquibaseTimestamp": 1643102431000
  }
}

JDL for the Entity configuration(s) entityName.json files generated in the .jhipster directory
JDL entity definitions
entity Element {
  number Long unique required
  color Color required
}
entity ElementKind {
  designation String unique required
  gramPerMeterLinearMass Double required
  milimeterDiameter Double required
  insulationThickness Double required
}
entity Copper {
  number Long unique required
  designation String unique required
}
entity Material {
  number Long unique required
  designation String unique required
  kilogramPerCubeMeterVolumicDensity Double required
}
entity ElementSupply {
  apparitions Long required
  markingType MarkingType required
  description String
}
entity Lifter {
  index Long unique required
  minimumMilimeterDiameter Double required
  maximumMilimeterDiameter Double required
  supportsSpirallyColoredMarkingType Boolean required
  supportsLongitudinallyColoredMarkingType Boolean required
  supportsNumberedMarkingType Boolean required
  supportsInkJetMarkingTechnique Boolean required
  supportsRsdMarkingTechnique Boolean required
}
entity LifterRunMeasure {
  milimeterDiameter Double
  meterPerHourSpeed Double
  markingType MarkingType required
  markingTechnique MarkingTechnique required
  hourPreparationTime Double
}
entity BangleSupply {
  apparitions Long required
  description String
}
entity Bangle {
  number Long unique required
  designation String unique required
  gramPerMeterLinearMass Double required
  milimeterDiameter Double required
}
entity ElementKindEdition {
  editionDateTime Instant required
  newGramPerMeterLinearMass Double
  newMilimeterDiameter Double
  newInsulationThickness Double
}
entity MaterialMarkingStatistic {
  markingType MarkingType required
  markingTechnique MarkingTechnique required
  meterPerHourSpeed Long required
}
entity CustomComponentSupply {
  apparitions Long required
  description String
  markingType MarkingType required
}
entity CustomComponent {
  number Long
  designation String
  gramPerMeterLinearMass Double required
  milimeterDiameter Double required
  surfaceColor Color required
}
entity Strand {
  diameterAssemblyStep Double required
  assemblyMean AssemblyMean required
}
entity OneStudySupply {
  apparitions Long
  number Long
  componentDesignation String
  description String
  markingType MarkingType required
  gramPerMeterLinearMass Double required
  milimeterDiameter Double required
  surfaceColor Color required
}
entity Study {
  number Long
  lastEditionInstant Instant required
}
entity StrandSupply {
  apparitions Long required
  markingType MarkingType required
  description String
}
entity UserData
entity CentralAssembly
entity CoreAssembly {
  assemblyLayer Long required
  forcedMeanMilimeterComponentDiameter Double
  componentsCount Long required
}
entity IntersticeAssembly {
  assemblyLayer Long required
  intersticeLayer Long required
  forcedMeanMilimeterComponentDiameter Double
}
entity Sheathing {
  operationLayer Long required
  milimeterThickness Double required
  sheathingKind SheathingKind required
}
entity SupplyPosition {
  supplyApparitionsUsage Long required
}
enum Color {
  NATURAL,
  WHITE,
  BROWN,
  GREEN,
  YELLOW,
  GREY,
  PINK,
  BLUE,
  RED,
  BLACK,
  PURPLE,
  PINK_GREY,
  RED_BLUE,
  WHITE_GREEN,
  BROWN_GREEN,
  WHITE_YELLOW,
  YELLOW_BROWN,
  WHITE_GREY,
  GREY_BROWN,
  WHITE_PINK,
  PINK_BROWN,
  WHITE_BLUE,
  BROWN_BLUE,
  WHITE_RED,
  BROWN_RED,
  WHITE_BLACK,
  BROWN_BLACK,
  GREY_GREEN,
  YELLOW_GREY,
  PINK_GREEN,
  YELLOW_PINK,
  GREEN_BLUE,
  YELLOW_BLUE,
  GREEN_RED,
  YELLOW_RED,
  GREEN_BLACK,
  YELLOW_BLACK,
  GREY_BLUE,
  PINK_BLUE,
  GREY_RED,
  PINK_RED,
  GREY_BLACK,
  PINK_BLACK,
  BLUE_BLACK,
  RED_BLACK,
  WHITE_BROWN_BLACK,
  YELLOW_GREEN_BLACK,
  GREY_PINK_BLACK,
  RED_BLUE_BLACK,
  WHITE_GREEN_BLACK,
  BROWN_GREEN_BLACK,
  WHITE_YELLOW_BLACK,
  YELLOW_BROWN_BLACK,
  WHITE_GREY_BLACK,
  GREY_BROWN_BLACK,
  WHITE_PINK_BLACK,
  PINK_BROWN_BLACK,
  WHITE_BLUE_BLACK,
  BROWN_BLUE_BLACK,
  WHITE_RED_BLACK,
  BROWN_RED_BLACK,
  BLACK_WHITE
}
enum MarkingType {
  LIFTING,
  SPIRALLY_COLORED,
  LONGITUDINALLY_COLORED,
  RINGY_COLORED,
  NUMBERED
}
enum MarkingTechnique {
  NONE,
  NONE_SUITABLE,
  INK_JET,
  RSD
}
enum AssemblyMean {
  RIGHT,
  LEFT,
  STRAIGHT
}
enum SheathingKind {
  TUBE,
  FLOATING_TUBE,
  HALF_STUFFING,
  STUFFING
}

relationship OneToOne {
  UserData{user(login) required} to User
  CentralAssembly{ownerStrand(designation) required} to Strand{centralAssembly(productionStep)}
  CentralAssembly{supplyPosition} to SupplyPosition{ownerCentralAssembly(productDesignation)}
}
relationship OneToMany {
  Material{materialMarkingStatistics(markingType)} to MaterialMarkingStatistic{material(designation) required}
  Study{strands(designation)} to Strand{futureStudy(number) required}
  UserData{studies(number)} to Study{author(login) required}
  Study{strandSupplies(designation)} to StrandSupply{study(number) required}
  Strand{coreAssemblies(productionStep)} to CoreAssembly{ownerStrand(designation) required}
  Strand{intersticeAssemblies(productionStep)} to IntersticeAssembly{ownerStrand(designation) required}
  Strand{sheathings(productionStep)} to Sheathing{ownerStrand(designation) required}
  ElementSupply{ownerSupplyPosition(designation) required} to SupplyPosition{elementSupply(designation)}
  BangleSupply{ownerSupplyPosition(designation) required} to SupplyPosition{bangleSupply(designation)}
  CustomComponentSupply{ownerSupplyPosition(designation) required} to SupplyPosition{customComponentSupply(designation)}
  OneStudySupply{ownerSupplyPosition(designation) required} to SupplyPosition{oneStudySupply(designation)}
  Strand{supplyPositions} to SupplyPosition{ownerStrand(designation)}
  IntersticeAssembly{supplyPositions} to SupplyPosition{ownerIntersticeAssembly(productDesignation)}
}
relationship ManyToOne {
  Element{elementKind(designation) required} to ElementKind
  ElementKind{copper(designation) required} to Copper
  ElementKind{insulationMaterial(designation) required} to Material
  ElementSupply{element(designationWithColor) required} to Element
  LifterRunMeasure{lifter(name) required} to Lifter
  BangleSupply{bangle(designation) required} to Bangle
  Bangle{material(designation) required} to Material
  ElementKindEdition{editedElementKind(designation) required} to ElementKind
  CustomComponentSupply{customComponent(designation) required} to CustomComponent
  CustomComponent{surfaceMaterial(designation) required} to Material
  OneStudySupply{surfaceMaterial(designation) required} to Material
  StrandSupply{strand(designation) required} to Strand
  Sheathing{material(designation) required} to Material
}

service Element, ElementKind, Copper, Material, ElementSupply, Lifter, LifterRunMeasure, BangleSupply, Bangle, ElementKindEdition, MaterialMarkingStatistic, CustomComponentSupply, CustomComponent, Strand, OneStudySupply, Study, StrandSupply, UserData, CentralAssembly, CoreAssembly, IntersticeAssembly, Sheathing, SupplyPosition with serviceImpl

Environment and Tools

java version "16.0.1" 2021-04-20 Java(TM) SE Runtime Environment (build 16.0.1+9-24) Java HotSpot(TM) 64-Bit Server VM (build 16.0.1+9-24, mixed mode, sharing)

git version 2.24.1.windows.2

node: v14.17.6

npm: 6.14.15

Docker version 20.10.10, build b485636

docker-compose version 1.29.2, build 5becea4c

Overview of the issue

Building successes, but H2 startup fails upon prompting "./mvnw -Pprod".

As I've chosen mysql as a production database, it seems normal to me that the result isn't successful, but event when looking at https://www.jhipster.tech/production/#run, I don't find any instruction for setting up connection between jhipster and external (not H2, which is built-in) databases

It shows the following Exceptions:

org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is java.lang.RuntimeException: java.lang.RuntimeException: Failed to load and initialize org.h2.server.web.WebServlet at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:163) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:577) at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434) at org.springframework.boot.SpringApplication.run(SpringApplication.java:338) at com.muller.lappli.LappLiApp.main(LappLiApp.java:69) Caused by: java.lang.RuntimeException: java.lang.RuntimeException: Failed to load and initialize org.h2.server.web.WebServlet at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:257) at org.springframework.boot.web.embedded.undertow.UndertowServletWebServerFactory.createManager(UndertowServletWebServerFactory.java:347) at org.springframework.boot.web.embedded.undertow.UndertowServletWebServerFactory.getWebServer(UndertowServletWebServerFactory.java:316) at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:182) at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:160) ... 6 common frames omitted Caused by: java.lang.RuntimeException: Failed to load and initialize org.h2.server.web.WebServlet at tech.jhipster.config.h2.H2ConfigurationHelper.initH2Console(H2ConfigurationHelper.java:128) at com.muller.lappli.config.WebConfigurer.initH2Console(WebConfigurer.java:112) at com.muller.lappli.config.WebConfigurer.onStartup(WebConfigurer.java:51) at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.selfInitialize(ServletWebServerApplicationContext.java:235) at org.springframework.boot.web.embedded.undertow.UndertowServletWebServerFactory$Initializer.onStartup(UndertowServletWebServerFactory.java:506) at io.undertow.servlet.core.DeploymentManagerImpl$1.call(DeploymentManagerImpl.java:204) at io.undertow.servlet.core.DeploymentManagerImpl$1.call(DeploymentManagerImpl.java:187) at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:42) at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43) at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:255) ... 10 common frames omitted Caused by: java.lang.ClassNotFoundException: org.h2.server.web.WebServlet at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:636) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:182) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:519) at java.base/java.lang.Class.forName0(Native Method) at java.base/java.lang.Class.forName(Class.java:466) at tech.jhipster.config.h2.H2ConfigurationHelper.initH2Console(H2ConfigurationHelper.java:119) ... 19 common frames omitted

Still, "./mvnw -Pprod clean verify" shows nor failures or errors

Motivation for or Use Case

I want to test my code within a production environnement.

Reproduce the error

git clone https://github.com/M4jor-Tom/LappLi cd LappLi ./mvnw -Pprod

Related issues

Nothing found.

Suggest a Fix

Upon trying "./mvnw -Pprod -X", I've seen that jhipster tryed to access https://repo.spring.io/ui/native/libs-release/org/springframework/roo/org.springframework.roo.annotations/1.2.3.RELEASE/org.springframework.roo.annotations-1.2.3.RELEASE.pom, and received a status 401.

Maybe this is the cause of the bug.

Browsers and Operating System

Google chrome on Windows 10

mraible commented 2 years ago

I've seen that jhipster tryed to access https://repo.spring.io/ui/native/libs-release/org/springframework/roo/org.springframework.roo.annotations/1.2.3.RELEASE/org.springframework.roo.annotations-1.2.3.RELEASE.pom, and received a status 401.

I see this too on apps that are working so I don't think this is the problem.

Did you start MySQL since that's what you're using for production?

docker-compose -f src/main/docker/mysql.yml up -d

I cloned your repo, started MySQL, and ran ./mvnw -Pprod. Everything worked fine for me, so I'm closing this issue. Please reopen it if this does not solve your issue.

----------------------------------------------------------
    Application 'LappLi' is running! Access URLs:
    Local:      http://localhost:8080/
    External:   http://127.0.0.1:8080/
    Profile(s):     [prod]
----------------------------------------------------------