SoftInstigate / restheart

Rapid API Development with MongoDB
https://restheart.org
GNU Affero General Public License v3.0
805 stars 171 forks source link

Unable to get _schema response, #190

Closed cyf992002 closed 7 years ago

cyf992002 commented 7 years ago

**When I created a json schema using

http put http://a:a@127.0.0.1:8888/db/_schemas/address < address_schema.json

I can see the schema was created successfully in Mongo DB. But when I tried to get the schema back using http get http://a:a@127.0.0.1:8888/db/_schemas/address I got a 500 error**

{ "_embedded": { "rh:exception": [ { "exception": "java.lang.NullPointerException" } ] }, "_links": { "self": { "href": "/db/_schemas/address" } }, "http status code": 500, "http status description": "Internal Server Error", "message": "Error handling the request, see log for more information" }

Here is the stacktrace copied from log Length=0 username=a roles=[admins] 11:59:44.077 [XNIO-1 task-1] ERROR org.restheart.handlers.ErrorHandler - Error handling the request java.lang.NullPointerException: null at org.restheart.handlers.schema.JsonSchemaTransformer.transform(JsonSchemaTransformer.java:51) at org.restheart.handlers.metadata.TransformerHandler.lambda$transform$114(TransformerHandler.java:93) at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948) at java.util.stream.ReferencePipeline$Head.forEachOrdered(ReferencePipeline.java:590) at org.restheart.handlers.metadata.TransformerHandler.transform(TransformerHandler.java:92) at org.restheart.handlers.metadata.TransformerHandler.handleRequest(TransformerHandler.java:69) at org.restheart.handlers.PipedHttpHandler.next(PipedHttpHandler.java:136) at org.restheart.handlers.document.GetDocumentHandler.handleRequest(GetDocumentHandler.java:190) at org.restheart.handlers.PipedHttpHandler.next(PipedHttpHandler.java:136) at org.restheart.handlers.metadata.AbstractTransformerMetadataHandler.handleRequest(AbstractTransformerMetadataHandler.java:63) at org.restheart.handlers.RequestDispacherHandler.handleRequest(RequestDispacherHandler.java:457) at org.restheart.handlers.injectors.CollectionPropsInjectorHandler.handleRequest(CollectionPropsInjectorHandler.java:99) at org.restheart.handlers.PipedHttpHandler.next(PipedHttpHandler.java:136) at org.restheart.handlers.injectors.DbPropsInjectorHandler.handleRequest(DbPropsInjectorHandler.java:92) at org.restheart.handlers.PipedHttpHandler.next(PipedHttpHandler.java:136) at org.restheart.handlers.injectors.AccountInjectorHandler.handleRequest(AccountInjectorHandler.java:56) at org.restheart.handlers.PipedHttpHandler.next(PipedHttpHandler.java:136) at org.restheart.security.handlers.AccessManagerHandler.handleRequest(AccessManagerHandler.java:55) at org.restheart.handlers.PipedHttpHandler.next(PipedHttpHandler.java:136) at org.restheart.security.handlers.AuthTokenInjecterHandler.handleRequest(AuthTokenInjecterHandler.java:70) at org.restheart.handlers.PipedHttpHandler.next(PipedHttpHandler.java:136) at org.restheart.security.handlers.AuthenticationCallHandler.handleRequest(AuthenticationCallHandler.java:54) at org.restheart.handlers.PipedHttpHandler.next(PipedHttpHandler.java:136) at org.restheart.security.handlers.AuthenticationConstraintHandler.handleRequest(AuthenticationConstraintHandler.java:55) at org.restheart.handlers.PipedHttpHandler.next(PipedHttpHandler.java:136) at org.restheart.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:61) at org.restheart.handlers.PipedHttpHandler.next(PipedHttpHandler.java:136) at org.restheart.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:85) at org.restheart.handlers.PipedHttpHandler.next(PipedHttpHandler.java:136) at org.restheart.security.handlers.SecurityHandler.handleRequest(SecurityHandler.java:50) at org.restheart.security.handlers.SecurityHandlerDispacher.handleRequest(SecurityHandlerDispacher.java:60) at org.restheart.handlers.PipedHttpHandler.next(PipedHttpHandler.java:136) at org.restheart.handlers.injectors.BodyInjectorHandler.handleRequest(BodyInjectorHandler.java:109) at org.restheart.handlers.PipedHttpHandler.next(PipedHttpHandler.java:136) at org.restheart.handlers.OptionsHandler.handleRequest(OptionsHandler.java:58) at org.restheart.handlers.PipedHttpHandler.next(PipedHttpHandler.java:136) at org.restheart.handlers.injectors.RequestContextInjectorHandler.handleRequest(RequestContextInjectorHandler.java:647) at org.restheart.handlers.PipedHttpHandler.next(PipedHttpHandler.java:136) at org.restheart.security.handlers.CORSHandler.handleRequest(CORSHandler.java:88) at org.restheart.handlers.RequestLoggerHandler.handleRequest(RequestLoggerHandler.java:87) at org.restheart.handlers.PipedHttpHandler.handleRequest(PipedHttpHandler.java:89) at io.undertow.server.handlers.PathHandler.handleRequest(PathHandler.java:94) at io.undertow.server.handlers.HttpContinueAcceptingHandler.handleRequest(HttpContinueAcceptingHandler.java:78) at org.restheart.handlers.ErrorHandler.handleRequest(ErrorHandler.java:69) at io.undertow.server.handlers.encoding.EncodingHandler.handleRequest(EncodingHandler.java:72) at org.restheart.handlers.GzipEncodingHandler.handleRequest(GzipEncodingHandler.java:74) at io.undertow.server.Connectors.executeRootHandler(Connectors.java:208) at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:809) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) 11:59:44.080 [XNIO-1 task-1] INFO o.r.handlers.RequestLoggerHandler - GET http://127.0.0.1:8888/db/_schemas/address from /127.0.0.1:40075 => status=500 elapsed=14ms contentLength=208 username=a roles=[admins]

cyf992002 commented 7 years ago

I am using mongodb 3.4 and restheart 3.0. Anyone can help? thanks !

ujibang commented 7 years ago

I created bug https://softinstigate.atlassian.net/browse/RH-235. working on it.

will be fixed in 3.0.1 to be released in few days.

ujibang commented 7 years ago

Hi, just pushed a fix for this (and also added integration tests to avoid future regressions)

you can get the latest snapshot builds from sonatype

if you check and confirm fix we will release 3.0.1

cyf992002 commented 7 years ago

Just tested and it works properly now, Thanks very much! Close issue.