Skip to content
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

NotFoundException: null #5

Closed
vkandrotas opened this issue Mar 19, 2019 · 33 comments
Closed

NotFoundException: null #5

vkandrotas opened this issue Mar 19, 2019 · 33 comments
Assignees
Labels
Milestone

Comments

@vkandrotas
Copy link

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

lex-em added a commit that referenced this issue Mar 21, 2019
Requesting service by direct URL fixed
@lex-em
Copy link
Owner

lex-em commented Mar 21, 2019

@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 lex-em self-assigned this Mar 21, 2019
@lex-em lex-em added the bug label Mar 21, 2019
@lex-em lex-em added this to the 0.2.2 milestone Mar 21, 2019
@vkandrotas
Copy link
Author

@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:

Swagger UI(2)

do you need an additional information?

regards,

Virginijus

@lex-em
Copy link
Owner

lex-em commented Mar 21, 2019

@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
Copy link
Owner

lex-em commented Mar 22, 2019

Group support will be implemented in #6

lex-em added a commit that referenced this issue Mar 22, 2019
adding basic support for swagger groups
@vkandrotas
Copy link
Author

@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 ?

@lex-em
Copy link
Owner

lex-em commented Mar 22, 2019

@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

lex-em added a commit that referenced this issue Mar 22, 2019
Adding support for direct swagger document link
lex-em added a commit that referenced this issue Mar 22, 2019
reimplement direct link
lex-em added a commit that referenced this issue Mar 22, 2019
adding direct path. issue fixed
@lex-em
Copy link
Owner

lex-em commented Mar 22, 2019

@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?

@lex-em
Copy link
Owner

lex-em commented Mar 25, 2019

@vkandrotas test it today please

@vkandrotas
Copy link
Author

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

@vkandrotas
Copy link
Author

I tested with current master version.

@lex-em
Copy link
Owner

lex-em commented Mar 25, 2019

@vkandrotas no, you should try latest feature~GH-5-SNAPSHOT

@lex-em
Copy link
Owner

lex-em commented Mar 25, 2019

Refresh it.

@vkandrotas
Copy link
Author

sorry I tested with develop, I will try with feature~GH-5-SNAPSHOT now

@vkandrotas
Copy link
Author

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

lex-em added a commit that referenced this issue Mar 25, 2019
adding extra logs
@lex-em
Copy link
Owner

lex-em commented Mar 25, 2019

@vkandrotas refresh feature snapshot and try again, there extra logging information.

I have an idea

@lex-em
Copy link
Owner

lex-em commented Mar 25, 2019

@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

@vkandrotas
Copy link
Author

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 

@vkandrotas
Copy link
Author

please let me know when I can test again and what branch.

@lex-em
Copy link
Owner

lex-em commented Mar 25, 2019

still the same:

@vkandrotas artifact version is not refreshed, please remove artifact from local repository and try again, I need that information

@vkandrotas
Copy link
Author

so what branch I should take ?

@lex-em
Copy link
Owner

lex-em commented Mar 25, 2019

@vkandrotas feature~GH-5-SNAPSHOT

@vkandrotas
Copy link
Author

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

lex-em added a commit that referenced this issue Mar 25, 2019
# Conflicts:
#	src/main/java/ru/reliabletech/zuul/swagger/props/ServiceInfo.java
#	src/main/java/ru/reliabletech/zuul/swagger/props/ServicesSwaggerInfo.java
#	src/main/java/ru/reliabletech/zuul/swagger/service/GenericSwaggerService.java
#	src/main/java/ru/reliabletech/zuul/swagger/swagger/ZuulSwaggerResourceProvider.java
@vkandrotas
Copy link
Author

before was:

... swagger documentation for route auth

@vkandrotas
Copy link
Author

ok I see you merged develop to GH-5, I will try now

@vkandrotas
Copy link
Author

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

lex-em added a commit that referenced this issue Mar 25, 2019
refactor merge effects, adding extra logs
@lex-em
Copy link
Owner

lex-em commented Mar 25, 2019

@vkandrotas try next build, please keep error logs with message like Some unexpected error while requesting ...

@lex-em
Copy link
Owner

lex-em commented Mar 25, 2019

new artifact builds rigth now

@vkandrotas
Copy link
Author

ther was no such error message, I am posting all possible logs, relative to this issue. I you want I can attach complete log ...

@lex-em
Copy link
Owner

lex-em commented Mar 25, 2019

@vkandrotas try now

@vkandrotas
Copy link
Author

now it works, but fetch all group documentation, not only auth controller, or it like expected?

@lex-em
Copy link
Owner

lex-em commented Mar 25, 2019

@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

@vkandrotas
Copy link
Author

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.

@lex-em
Copy link
Owner

lex-em commented Mar 25, 2019

@vkandrotas create an issue for it, I will think about it later

@lex-em lex-em closed this as completed Mar 25, 2019
lex-em added a commit that referenced this issue Mar 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants