Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swagger2 - No handler found for GET

I have developed one API in Spring boot. where I used Swagger2 for easiness & technical doc purposefully. Now, I am running through an issue which is mainly cause on our whole API. It's Frequently printing a logs. it's around in 1-min. 2-5 MB logs are created. which is absolutely not acceptable. Due to the below mentioned error.

I strongly believe, it's because of Swagger UI configuration. it's appearing.

org.springframework.web.servlet.NoHandlerFoundException: No handler found for GET /null/swagger-resources/configuration/security

org.springframework.web.servlet.NoHandlerFoundException: No handler found for GET /null/swagger-resources

org.springframework.web.servlet.NoHandlerFoundException: No handler found for GET /null/swagger-resources/configuration/ui

I have already configured to bypassed the following endpoints from my "Authentication/Authorization" validation checks.

1. /swagger-ui.html
2. /v2/api-docs
3. /swagger-resources/configuration/ui
4. /swagger-resources
5. /swagger-resources/configuration/security

Question is, why it's internally calls endpoints which are starting with /null prefix(see the above mentioned 3-erroneous statements which are printing in my logs)

Surplice! & Interesting! things for me is, it's happening(causing) in only one of my environment(DEV, TEST, PROD). Whereas in other environment, it works very well without throwing any such kind of errors.

NOTE - I have enabled swagger only in DEV & LOCAL env. only. May be due to this reason, it's not giving any error in TEST & PROD respectively. Again I am not sure what's wrong going on.

Even, In my Local also not giving any errors!

I am using following maven dependencies to enable swagger are,

<!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger2 -->
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
            <version>2.8.0</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger-ui -->
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger-ui</artifactId>
            <version>2.8.0</version>
        </dependency> 

Any help would be appreciable!!

like image 839
Vishal Gajera Avatar asked Nov 07 '22 01:11

Vishal Gajera


1 Answers

Upgrading to swagger 3 solved the problem for me. This link might be useful.

like image 69
Hala Avatar answered Nov 14 '22 23:11

Hala