generator-jhipster icon indicating copy to clipboard operation
generator-jhipster copied to clipboard

generate-application with websockets does not start

Open TimMaltGermany opened this issue 3 years ago • 4 comments
trafficstars

Bug description I used the web generator at https://start.jhipster.tech/generate-application to generate a new JHipster application with web sockets, but it fails to start with the following error message: Factory method 'stompWebSocketHandlerMapping' threw exception; nested exception is java.lang.IllegalStateException: No suitable default RequestUpgradeStrategy found

To Reproduce Steps to reproduce the behavior:

  1. Go to 'generate-application'

  2. Change these settings:

    • Application type: 'Microservice gateway'
    • Authentication type: 'OAuth 2.0'
    • no dabase
    • Check "WebSockets using Spring Websocket'
    • Framework: 'React'
  3. Download as Zip file, install and try to run locally

  4. . See error: 2022-07-07 08:20:51.862 WARN 63429 --- [ restartedMain] onfigReactiveWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'stompWebSocketHandlerMapping' defined in class path resource [org/springframework/web/socket/config/annotation/DelegatingWebSocketMessageBrokerConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.HandlerMapping]: Factory method 'stompWebSocketHandlerMapping' threw exception; nested exception is java.lang.IllegalStateException: No suitable default RequestUpgradeStrategy found 2022-07-07 08:20:52.030 ERROR 63429 --- [ restartedMain] o.s.boot.SpringApplication : Application run failed

Expected behavior Application should start up without an error

Desktop (please complete the following information):

  • OS: linux
  • IntelliJ

Additional context content of .jo-rc.json file:

{
  "generator-jhipster": {
    "applicationType": "gateway",
    "authenticationType": "oauth2",
    "baseName": "jhipsterSampleApplication",
    "blueprints": [],
    "buildTool": "maven",
    "cacheProvider": "no",
    "clientFramework": "react",
    "clientPackageManager": "npm",
    "clientTheme": "none",
    "clientThemeVariant": "",
    "creationTimestamp": 1657174342738,
    "databaseType": "no",
    "devDatabaseType": "no",
    "devServerPort": 9060,
    "dtoSuffix": "DTO",
    "enableGradleEnterprise": false,
    "enableHibernateCache": false,
    "enableSwaggerCodegen": false,
    "enableTranslation": true,
    "entitySuffix": "",
    "gitCompany": "",
    "jhiPrefix": "jhi",
    "jhipsterVersion": "7.8.1",
    "jwtSecretKey": "YWJhZjFiZmRhNThkNzIyY2U4M2E1YjFlMDBhZTZlYjI5OGM2YTc3MGZkZWFiNjBhZjQ0ZDE3NjE0YzZlMzZhMTIxYmMxZjg2YmYxMjNmY2M1ZTY2MTQ1YzdkZDZmYjRiZTY5ZWY1YjE2ZDdlZDIxNzgwY2M0MDRjNjJiYjk1ODk=",
    "languages": ["en"],
    "messageBroker": false,
    "nativeLanguage": "en",
    "otherModules": [],
    "packageFolder": "com/mycompany/myapp",
    "packageName": "com.mycompany.myapp",
    "pages": [],
    "prodDatabaseType": "no",
    "reactive": true,
    "searchEngine": false,
    "serverPort": 8080,
    "serviceDiscoveryType": "eureka",
    "skipCheckLengthOfIdentifier": false,
    "skipFakeData": false,
    "skipUserManagement": true,
    "testFrameworks": [],
    "useSass": true,
    "websocket": "spring-websocket",
    "withAdminUi": true
  }
}
``

TimMaltGermany avatar Jul 07 '22 07:07 TimMaltGermany

Does anyone have any insights on this, please?

TimMaltGermany avatar Jul 18 '22 06:07 TimMaltGermany

This is still an issue with JHipster 7.9.3

TimMaltGermany avatar Sep 21 '22 09:09 TimMaltGermany

@TimMaltGermany : I transfered your ticket here as jhipster online project is not followed enough

pascalgrimaud avatar Sep 21 '22 10:09 pascalgrimaud

Seems related to https://github.com/jhipster/generator-jhipster/issues/14567. Right now we don't support websocket + reactive/webflux. As the gateway is now always reactive it will fail. Spring Websocket abstactions only works for non reactive part, so some handwritten code is needed to create the endpoints and to use the current thin abstraction layer for stomp etc.

For the actual issue, we don't support websockets + reactive on cli, but we do via jdl and the jhipster online ui (which is wrong until the linked issue is resolved, either by doing it on our side or hope spring will update their integation to support webflux).

atomfrede avatar Sep 21 '22 11:09 atomfrede

Duplicated of https://github.com/jhipster/generator-jhipster/issues/14567

mshima avatar Nov 10 '23 17:11 mshima