-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
java.lang.NoClassDefFoundError: javax/servlet/ServletConfig with Jersey 2 without Servlet #1913
Comments
This was answered on stackoverflow. Just add the servlet dependency |
Hi @fehguy I ran into the same problem. I am using GrizzlyServer. I would like to avoid switching the server. Is it possible to use swagger without switching away from Grizzly? If yes, then what dependency should I add to my pom.xml? |
Adding the following dependency worked for me.
|
Hi, After 3 years we have the same bug, why do I need to change to a servlet-based project while I have an already running Java HTTP server like a grizzly HTTP server, without all servlet weird configurations? This occurs because in the dependency swagger-jersey2-jaxrs the class ApiListingResource wants the servlet instance to be injected. Why not provide a different implementation (this is one that runs on a non-servlet server, is not already parameterized, is just an example that works):
I am saying this because if you pick Jersey startup project from Maven archive, you end with "jersey-container-grizzly2-http" dependency, newer people will not have in mind the confusion around containers/servlets and will not conclude swagger set up. |
This is my solution to this issue:
I registred this resource instead of the one provided by |
When following the tutorial described [here](https://github.com/swagger-api/swagger-core/wiki/Swagger-Core-Jersey-2.X-Project-Setup-1.5#using-a-custom-application-subclass here) to setup Swagger with Jersey 2.23.2 with the "Using a custom Application subclass" approach. The following error is thrown:
Se also this StackOverflow discussion: http://stackoverflow.com/questions/38891661/swagger-with-jersey-2-throws-java-lang-noclassdeffounderror-javax-servlet-servl
The text was updated successfully, but these errors were encountered: