loic911 / Rest-api-doc

MIT License
21 stars 32 forks source link

Displaying an error popup when i try to have a view on the Web report #66

Open bocaralpha opened 8 years ago

bocaralpha commented 8 years ago

When i hit the following adress to view the report http://localhost:8080/RestApiDoc-example/restApiDoc?doc_url=http://localhost:8080/RestApiDoc-example/restApiDoc/api#

I get a popup where is mentionned [Error:error] **the api method in the controller RestApiDoc*** def api() { def input try { input = servletContext.getResourceAsStream(grailsApplication.mergedConfig.grails.plugins.restapidoc.outputFileReading) File docFile = new File(grailsApplication.mergedConfig.grails.plugins.restapidoc.outputFileReading) println docFile.absolutePath render(input.text) } finally { input.close() } } }

It's seem grails cannot get my restapidoc.json *below the the stacktrace*******

20-10-2015 17:02:39,396 ERROR GrailsExceptionResolver - NullPointerException occurred when processing request: [GET] /RestApiDoc-example/restApiDoc/api Cannot invoke method close() on null object. Stacktrace follows: java.lang.NullPointerException: Cannot invoke method close() on null object at org.restapidoc.RestApiDocController.api(RestApiDocController.groovy:28) at grails.plugin.cache.web.filter.PageFragmentCachingFilter.doFilter(PageFragmentCachingFilter.java:198) at grails.plugin.cache.web.filter.AbstractFilter.doFilter(AbstractFilter.java:63) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745)

Last thing when i go to: target/work/tomcat/work/Tomcat/localhost/RestApiDoc-example/grails-resource i not find my restapidoc.json

*_RestApidocDefaultConfig.groovy_**** outputFileGeneration = "restapidoc.json" outputFileReading = "restapidoc.json"

Some help please.

loic911 commented 8 years ago

Can you check the value of "grailsApplication.mergedConfig.grails.plugins.restapidoc.outputFileReading" and look if the absolute path is on your restapidoc.json file

bocaralpha commented 8 years ago

When i try to see the value of outFileReading by running: println "outputfile reading" + grailsApplication.mergedConfig.grails.plugins.restapidoc.outputFileReading i get this error: java.lang.IllegalArgumentException: The resource path [restapidoc.json] is not valid

The basePath of my restapidoc is: "basePath": "http://localhost:8080/RestApiDoc-example",

edinhojorge commented 7 years ago

I was having the same problem. Moving restapidoc.json to web-app folder solved this. Now I am dealing with some other problems in js and css. Using a local 0.6.5 version