lightblue-platform/lightblue-audit-hook

Problem creating a new entity using audit hook

Closed this issue · 1 comments

Got this exception from server.log using the country example http://docs.lightblue.io/cookbook/audit_all_changes.html :

 com.mongodb.BasicDBObject cannot be cast to com.fasterxml.jackson.databind.JsonNode: java.lang.ClassCastException: com.mongodb.BasicDBObject cannot be cast to com.fasterxml.jackson.databind.JsonNode
        at com.redhat.lightblue.hook.audit.AuditHookConfigurationParser.convert(AuditHookConfigurationParser.java:13)
        at com.redhat.lightblue.metadata.parser.MetadataParser.convertHooks(MetadataParser.java:1279)
        at com.redhat.lightblue.metadata.parser.MetadataParser.convert(MetadataParser.java:885)
        at com.redhat.lightblue.metadata.mongo.BSONParser.convert(BSONParser.java:197)
        at com.redhat.lightblue.metadata.mongo.MongoMetadata.createNewMetadata(MongoMetadata.java:264)
        at com.redhat.lightblue.rest.metadata.hystrix.CreateEntityMetadataCommand.run(CreateEntityMetadataCommand.java:78)
        at com.redhat.lightblue.rest.metadata.hystrix.CreateEntityMetadataCommand.run(CreateEntityMetadataCommand.java:36)
        at com.netflix.hystrix.HystrixCommand$1.call(HystrixCommand.java:294)
        at com.netflix.hystrix.HystrixCommand$1.call(HystrixCommand.java:289)
        at rx.Observable$1.call(Observable.java:144)
        at rx.Observable$1.call(Observable.java:136)
        at rx.Observable$1.call(Observable.java:144)
        at rx.Observable$1.call(Observable.java:136)
        at rx.Observable$1.call(Observable.java:144)
        at rx.Observable$1.call(Observable.java:136)
        at rx.Observable.unsafeSubscribe(Observable.java:7466)
        at com.netflix.hystrix.AbstractCommand$5.call(AbstractCommand.java:514)
        at com.netflix.hystrix.AbstractCommand$5.call(AbstractCommand.java:497)
        at rx.Observable.unsafeSubscribe(Observable.java:7466)
        at rx.internal.operators.OperatorSubscribeOn$1$1.call(OperatorSubscribeOn.java:62)
        at com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction$1.call(HystrixContexSchedulerAction.java:56)
        at com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction$1.call(HystrixContexSchedulerAction.java:47)
        at com.netflix.hystrix.strategy.concurrency.HystrixContexSchedulerAction.call(HystrixContexSchedulerAction.java:69)
        at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:47)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        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)

The response returned (maybe it should have an specific errorcode for plugins like audit-hook failure):

< HTTP/1.1 200 OK
< Server: Apache-Coyote/1.1
< Pragma: No-cache
< Cache-Control: no-cache
< Expires: Wed, 31 Dec 1969 19:00:00 EST
< Content-Type: application/json
< Content-Length: 275
* Closing connection #0
{  
   "objectType":"error",
   "context":"CreateEntityMetadataCommand/country/1.0.0/createNewMetadata(country)/convert[info|bson]/convert[info]/hooks",
   "errorCode":"metadata:IllFormedMetadata",
   "msg":"com.mongodb.BasicDBObject cannot be cast to com.fasterxml.jackson.databind.JsonNode"
}

Linking #31