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.
I am not sure. The Docker container seems to be accessing Codegen through the network.
docker.io/swaggerapi/swagger-editor with TAG latest
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.
mvn clean package jetty:runAttempt to access via curl http://localhost:8080/v1/swagger.json and see 503 error
Edit pom.xml and remove
mvn clean package jetty:run and curl http://localhost:8080/v1/swagger.json successfully.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>
Jep, also experiencing this issue
yes, it is right!
Having the same issue as well, changed the provided scope to compile in order to fix it
If it's of any value to anyone, I used the following command (xml is xmlstarlet) to change the scope to compile:
xml ed -L -u "//*[name()='dependencies']/*[name()='dependency']/*[name()='groupId' and text()='javax.validation']/../*[name()='scope']" -v compile pom.xml
fixed in #8538
I didn't want to try snapshot release. So, I reverted to version 2.1.6 and got it working.
Most helpful comment
Having the same issue as well, changed the provided scope to compile in order to fix it