← All tasks
javaspringdoc/springdoc-openapi #1357Not a task: already works

SpringDocWebFluxConfiguration throws NoClassDefFoundError: javax/servlet/ServletException

envgap__springdoc__springdoc-openapi-1357

01 / FAILURE SIGNATURE

As reported upstream

When the app starts, I get the following error:
Not a benchmark task.
  • The project already builds and runs before the fix, so there is nothing to repair.

02 / ENVIRONMENT RECIPE

Base commit
476b012cb23e93663ffdc87538a94690a5a557cc
Manifest
springdoc-openapi-data-rest/pom.xml
Reproduce
Awaiting issue-specific recipe
Run under trace
Awaiting a meaningful runtime command

03 / ORIGINAL ISSUE TEXT

springdoc/springdoc-openapi #1357 · read the original issue
**Describe the bug**



We're trying to migrate JHipster to use Springdoc instead of Springfox. 



https://github.com/jhipster/jhipster-bom/pull/556



In a Spring WebFlux application, I have the following dependencies:



```xml

<dependency>

    <groupId>org.springdoc</groupId>

    <artifactId>springdoc-openapi-webflux-core</artifactId>

</dependency>

<dependency>

    <groupId>org.springdoc</groupId>

    <artifactId>springdoc-openapi-data-rest</artifactId>

</dependency>

```



When the app starts, I get the following error:



```

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 

'openApiResource' defined in class path resource 

[org/springdoc/webflux/core/SpringDocWebFluxConfiguration.class]: Unsatisfied dependency expressed through 

method 'openApiResource' parameter 2; nested exception is 

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'responseBuilder' 

defined in class path resource [org/springdoc/webflux/core/SpringDocWebFluxConfiguration.class]: Bean 

instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: 

Failed to instantiate [org.springdoc.core.GenericResponseService]: Factory method 'responseBuilder' threw 

exception; nested exception is java.lang.NoClassDefFoundError: javax/servlet/ServletException

```



Another strange thing that happens with these two dependencies. A new webflux + MongoDB app fails with the following when running `mvn verify`:



```

Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate 

[org.springdoc.core.GenericResponseService]: Factory method 'responseBuilder' threw exception; nested 

exception is java.lang.NoClassDefFoundError: Could not initialize class 

org.springdoc.core.GenericResponseService

```



However, if I change replace both dependencies with `springdoc-openapi-webflux-ui`, all tests pass.



**To Reproduce**



Steps to reproduce the behavior:

- What version of spring-boot you are using? 2.5.7

- What modules and versions of springdoc-openapi are you using? 1.5.13

- What is the actual and the expected result using OpenAPI Description (yml or json)?

- Provide with a sample code (HelloController) or Test that reproduces the problem



I can provide steps to reproduce, but it's kinda complicated. Here's an attempt:



```

git clone -b springdocs git@github.com:mshima/jhipster-bom.git

cd jhipster-bom

./mvnw install -Dgpg.skip=true

cd ..

git clone -b skip_ci-doc git@github.com:mshima/generator-jhipster.git

cd generator-jhipster

npm link

```



Then, create a new JHipster project (for example, in your ~/Downloads directory):



```

mkdir webflux-mongodb

cd webflux-mongodb

```



Create a `.yo-rc.json` file in this directory with the following contents:



```json

{

  "generator-jhipster": {

    "applicationType": "monolith",

    "reactive": true,

    "baseName": "sampleWebfluxMongodb",

    "packageName": "tech.jhipster.sample",

    "packageFolder": "tech/jhipster/sample",

    "authenticationType": "jwt",

    "cacheProvider": "no",

    "enableHibernateCache": false,

    "websocket": false,

    "databaseType": "mongodb",

    "devDatabaseType": "mongodb",

    "prodDatabaseType": "mongodb",

    "searchEngine": false,

    "buildTool": "maven",

    "enableTranslation": true,

    "nativeLanguage": "en",

    "languages": ["en", "fr"],

    "testFrameworks": ["gatling", "cypress"],

    "serverPort": "8080",

    "jhiPrefix": "jhi",

    "clientPackageManager": "npm",

    "clientFramework": "angularX",

    "creationTimestamp": 1596513172471,

    "jwtSecretKey": "ZjY4MTM4YjI5YzMwZjhjYjI2OTNkNTRjMWQ5Y2Q0Y2YwOWNmZTE2NzRmYzU3NTMwM2NjOTE3MTllOTM3MWRkMzcyYTljMjVmNmQ0Y2MxOTUzODc0MDhhMTlkMDIxMzI2YzQzZDM2ZDE3MmQ3NjVkODk3OTVmYzljYTQyZDNmMTQ=",

    "jhipsterVersion": "7.4.0",

    "skipClient": false,

    "skipServer": false,

    "skipUserManagement": false,

    "skipCheckLengthOfIdentifier": false,

    "skipFakeData": false,

    "entitySuffix": "",

    "dtoSuffix": "DTO",

    "blueprints": [],

    "otherModules": [],

    "pages": [],

    "devServerPort": 4200,

    "clientTheme": "none",

    "clientThemeVariant": "",

    "withAdminUi": true,

    "serviceDiscoveryType": false,

    "enableGradleEnterprise": false

  }

}

```



Then, run `jhipster`. 



Once the app is finished, run `./mvnw verify` to see the test failures.



To start the app:



```

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

./mvnw

```



Continue on GitHub ↗

04 / LABELS

Labels from the report text only; not yet run

No supported category has been assigned.

Label rules and the text that matched
[]