NotFoundException: null
vkandrotas opened this issue · comments
can you please say what I do wrong? getting ...
web - 2019-03-19 15:46:20,916 [http-nio-9095-exec-1] ERROR r.r.z.s.s.ZuulSwaggerResourceProvider - Some error during obtain swagger documentation for route auth
r.r.z.s.e.NotFoundException: null
at r.r.z.s.s.GenericSwaggerService.getOriginalSwaggerDoc(GenericSwaggerService.java:53)
at r.r.z.s.s.SwaggerService.getSwaggerVersion(SwaggerService.java:36)
at r.r.z.s.s.ZuulSwaggerResourceProvider.generateSwaggerDocumentationResource(ZuulSwaggerResourceProvider.java:47)
at j.u.s.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
at j.u.HashMap$KeySpliterator.forEachRemaining(HashMap.java:1553)
... 104 frames truncated
zuul config like this:
zuul:
prefix: /api
default-swagger-url: v2/api-docs
routes:
auth:
swaggerUrl: auth-api
serviceId: auth-service
path: /auth/**
url: http://${thingsboard.client.host}:${thingsboard.client.port}/api/auth
in documentation you wrote that RestTemplate should be configured, but there is no example. Can this cause problem?
regards,
Virginijus
@vkandrotas Hi! Try this feature fix version from jitpack repository https://jitpack.io/#ru.reliabletech/zuul-springfox-swagger/feature~GH-5-SNAPSHOT
url: http://${thingsboard.client.host}:${thingsboard.client.port}/api/auth
Does /api/auth
is application root path? If your application perform /
requests - you should remove /api/auth
@lex-em Hi! I will try snapshot and let you know.
/api/auth is not root path just path to one service controller.
I don't want to expose all api from remote rest server so zuul proxy is configured for separate services. Remote rest API in swagger looks like this:
do you need an additional information?
regards,
Virginijus
@vkandrotas unfortunately it will not work as you expect. Yes, you can map subset of your api with zuul, but can't subset of swagger docs.
This part is also wrong
swaggerUrl: auth-api
Swagger plugin retrieve docs from {url}/{swaggerUrl}
. swaggerUrl
is relative path from root, but your url
already not root (with /api/auth
prefix). Resulted url should be http://${thingsboard.client.host}:${thingsboard.client.port}/v2/api-docs
, but now you have http://${thingsboard.client.host}:${thingsboard.client.port}/api/auth/auth-api
I think here may be solution with groups, I will think about it later.
@lex-em Thank you for explanation. I was thinking that plugin supports all zuul proxy features.
What do you thing about the idea that plugin could fetch all api docs from remote server and then locally map only parts defined by zuul configuration ?
@vkandrotas I think group support will be a good decision.
Also I will provide a direct link to swagger doc json for route. Wait for it
@vkandrotas refresh snapshot and try this:
zuul:
prefix: /api
routes:
auth:
path: /auth/**
url: http://${thingsboard.client.host}:${thingsboard.client.port}/api/auth
directSwaggerBaseUrl: http://${thingsboard.client.host}:${thingsboard.client.port}
directSwaggerPath: /
stripPrefix: false
swaggerUrl: v2/api-docs
and try it without stripPrefix: false
, show me errors please. What result path will construct zuul?
@vkandrotas test it today please
still a problem but now other place:
web - 2019-03-25 10:28:33,354 [http-nio-9095-exec-1] INFO o.a.c.c.C.[.[.[/] - Initializing Spring DispatcherServlet 'dispatcherServlet'
web - 2019-03-25 10:28:35,080 [http-nio-9095-exec-9] INFO c.n.c.ChainedDynamicProperty - Flipping property: 192.168.99.100.ribbon.ActiveConnectionsLimit to use NEXT property: niws.loadbalancer.availabilityFilteringRule.activeConnectionsLimit = 2147483647
web - 2019-03-25 10:28:35,111 [http-nio-9095-exec-9] INFO c.n.l.BaseLoadBalancer - Client: 192.168.99.100 instantiated a LoadBalancer: DynamicServerListLoadBalancer:{NFLoadBalancer:name=192.168.99.100,current list of Servers=[],Load balancer stats=Zone stats: {},Server stats: []}ServerList:null
web - 2019-03-25 10:28:35,119 [http-nio-9095-exec-9] INFO c.n.l.DynamicServerListLoadBalancer - Using serverListUpdater PollingServerListUpdater
web - 2019-03-25 10:28:35,125 [http-nio-9095-exec-9] INFO c.n.l.DynamicServerListLoadBalancer - DynamicServerListLoadBalancer for client 192.168.99.100 initialized: DynamicServerListLoadBalancer:{NFLoadBalancer:name=192.168.99.100,current list of Servers=[],Load balancer stats=Zone stats: {},Server stats: []}ServerList:com.netflix.loadbalancer.ConfigurationBasedServerList@574f6334
web - 2019-03-25 10:28:35,168 [http-nio-9095-exec-9] ERROR r.r.z.s.s.ZuulSwaggerResourceProvider - vk Some error during obtain swagger documentation for route auth
r.r.z.s.e.NotFoundException: null
at r.r.z.s.s.GenericSwaggerService.getSwaggerResources(GenericSwaggerService.java:61)
at r.r.z.s.s.ZuulSwaggerResourceProvider.generateSwaggerDocumentationResource(ZuulSwaggerResourceProvider.java:51)
at j.u.s.ReferencePipeline$7$1.accept(ReferencePipeline.java:267)
at j.u.s.DistinctOps$1$2.accept(DistinctOps.java:175)
at j.u.HashMap$KeySpliterator.forEachRemaining(HashMap.java:1553)
... 104 frames truncated
I tested with current master version.
@vkandrotas no, you should try latest feature~GH-5-SNAPSHOT
Refresh it.
sorry I tested with develop, I will try with feature~GH-5-SNAPSHOT now
still not working:
web - 2019-03-25 10:43:57,691 [http-nio-9095-exec-1] INFO o.a.c.c.C.[.[.[/] - Initializing Spring DispatcherServlet 'dispatcherServlet'
web - 2019-03-25 10:43:59,156 [http-nio-9095-exec-9] ERROR r.r.z.s.s.ZuulSwaggerResourceProvider - Some error during obtain swagger documentation for route auth
o.s.w.c.HttpClientErrorException$NotFound: 404 null
at o.s.w.c.HttpClientErrorException.create(HttpClientErrorException.java:85)
at o.s.w.c.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:122)
at o.s.w.c.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:102)
at o.s.w.c.ResponseErrorHandler.handleError(ResponseErrorHandler.java:63)
at o.s.w.c.RestTemplate.handleResponse(RestTemplate.java:778)
... 112 frames truncated
config:
thingsboard:
client:
host: 192.168.99.100
port: 9090
zuul:
prefix: /api
routes:
auth:
path: /auth/**
url: http://${thingsboard.client.host}:${thingsboard.client.port}/api/auth
directSwaggerBaseUrl: http://${thingsboard.client.host}:${thingsboard.client.port}
directSwaggerPath: /
stripPrefix: false
swaggerUrl: v2/api-docs
@vkandrotas refresh feature snapshot and try again, there extra logging information.
I have an idea
@vkandrotas I think this is because your documentation is aviable through group name.
I will merge develop into feature to add group support for feature
still the same:
web - 2019-03-25 11:21:35,910 [http-nio-9095-exec-1] INFO o.a.c.c.C.[.[.[/] - Initializing Spring DispatcherServlet 'dispatcherServlet'
web - 2019-03-25 11:21:37,405 [http-nio-9095-exec-9] ERROR r.r.z.s.s.ZuulSwaggerResourceProvider - Some error during obtain swagger documentation for route 'auth'
o.s.w.c.HttpClientErrorException$NotFound: 404 null
at o.s.w.c.HttpClientErrorException.create(HttpClientErrorException.java:85)
at o.s.w.c.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:122)
at o.s.w.c.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:102)
at o.s.w.c.ResponseErrorHandler.handleError(ResponseErrorHandler.java:63)
at o.s.w.c.RestTemplate.handleResponse(RestTemplate.java:778)
... 112 frames truncated
please let me know when I can test again and what branch.
still the same:
@vkandrotas artifact version is not refreshed, please remove artifact from local repository and try again, I need that information
so what branch I should take ?
@vkandrotas feature~GH-5-SNAPSHOT
my code is up to date and local repository is refreshed, you can see in the logs
swagger documentation for route 'auth'
it comes alleady from latest changes you made in ZuulSwaggerResourceProvider class
before was:
... swagger documentation for route auth
ok I see you merged develop to GH-5, I will try now
unfortunally no changes: exactly the same error:
web - 2019-03-25 11:53:36,517 [http-nio-9095-exec-10] ERROR r.r.z.s.s.ZuulSwaggerResourceProvider - Some error during obtain swagger documentation for route 'auth'
o.s.w.c.HttpClientErrorException$NotFound: 404 null
at o.s.w.c.HttpClientErrorException.create(HttpClientErrorException.java:85)
at o.s.w.c.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:122)
at o.s.w.c.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:102)
at o.s.w.c.ResponseErrorHandler.handleError(ResponseErrorHandler.java:63)
at o.s.w.c.RestTemplate.handleResponse(RestTemplate.java:778)
... 112 frames truncated
@vkandrotas try next build, please keep error logs with message like Some unexpected error while requesting ...
new artifact builds rigth now
ther was no such error message, I am posting all possible logs, relative to this issue. I you want I can attach complete log ...
@vkandrotas try now
now it works, but fetch all group documentation, not only auth controller, or it like expected?
@vkandrotas yes, it is expected. only group filter implemented, document inside group is not filtered. I think it is impratical and may lead to unexpected results. the right way is moving auth
to a separate group and filter group list like this:
zuul:
prefix: /api
routes:
auth:
path: /auth/**
url: http://${thingsboard.client.host}:${thingsboard.client.port}/api/auth
directSwaggerBaseUrl: http://${thingsboard.client.host}:${thingsboard.client.port}
directSwaggerPath: /
stripPrefix: false
allowedGroups:
- auth
It already works now
I can not so easy configure groups because it is not my code, yes it open source. But in this case I should fork repository and build my on docker image, what I don't really want to do.
@vkandrotas create an issue for it, I will think about it later