-
Notifications
You must be signed in to change notification settings - Fork 6k
Description
Description
When using Codegen through Swagger UI Docker container for a JAX-RS server, the README.md
states that running mvn clean package jetty:run
will start the server. Running this results in:
WARNING: The following warnings have been detected: WARNING: HK2 service reification failed for [org.glassfish.jersey.server.model.ResourceMethodInvoker$Builder] with an exception:
MultiException stack 1 of 1
java.lang.NoClassDefFoundError: javax/validation/Validator
and the content is unavailable.
The generated pom.xml has:
<!-- Bean Validation API support -->
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.1.0.Final</version>
<scope>provided</scope>
</dependency>
Removing the provided scope fixes the issue for me.
Swagger-codegen version
I am not sure. The Docker container seems to be accessing Codegen through the network.
docker.io/swaggerapi/swagger-editor with TAG latest
Swagger declaration file content or url
The default yaml file that begins with:
# this is an example of the Uber API
# as a demonstration of an API spec in YAML
can be used to reproduce the issue.
Steps to reproduce
-
Open the default example in Swagger UI in Docker container
-
Generate server JAX-RS
-
Unzip tarball and enter jaxrs-server folder
-
Run
mvn clean package jetty:run
-
See ClassNotFound exception
-
Attempt to access via
curl http://localhost:8080/v1/swagger.json
and see 503 error -
Edit pom.xml and remove provided from validation-api dependency
-
Run
mvn clean package jetty:run
andcurl http://localhost:8080/v1/swagger.json
successfully.
Suggest a Fix
If validation-api is meant to be provided then the documentation needs to be updated and should include how users can provide the dependency. Otherwise, it should not be <scope>provided</scope>