mbok / logsniffer

logsniffer is a sophisticated open source web tool for parsing, viewing, monitoring and analyzing log data - smarter, collaborative and easier. [No longer maintaned]
GNU Lesser General Public License v3.0
105 stars 46 forks source link

JSON deserialization failure #78

Closed derikl closed 8 years ago

derikl commented 8 years ago

After creating a publisher (HTTP POST) with body containing JSON, logsniffer gets the error below and can no longer show events.

JSON mapper error
com.fasterxml.jackson.databind.JsonMappingException: Failed to deserialize bean: interface com.logsniffer.event.Publisher (through reference chain: com.logsniffer.util.PageableResult["items"]->java.util.ArrayList[0]->com.logsniffer.event.AspectSniffer["publishers"]->com.logsniffer.util.LazyList[0])
    at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:210)
    at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:189)
    at com.fasterxml.jackson.databind.ser.std.StdSerializer.wrapAndThrow(StdSerializer.java:225)
    at com.fasterxml.jackson.databind.ser.std.CollectionSerializer.serializeContents(CollectionSerializer.java:158)
    at com.fasterxml.jackson.databind.ser.std.CollectionSerializer.serialize(CollectionSerializer.java:111)
    at com.fasterxml.jackson.databind.ser.std.CollectionSerializer.serialize(CollectionSerializer.java:24)
    at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:693)
    at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:675)
    at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:157)
    at com.fasterxml.jackson.databind.ser.impl.IndexedListSerializer.serializeContents(IndexedListSerializer.java:119)
    at com.fasterxml.jackson.databind.ser.impl.IndexedListSerializer.serialize(IndexedListSerializer.java:79)
    at com.fasterxml.jackson.databind.ser.impl.IndexedListSerializer.serialize(IndexedListSerializer.java:18)
    at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:693)
    at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:675)
    at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:157)
    at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.serializeValue(DefaultSerializerProvider.java:130)
    at com.fasterxml.jackson.databind.ObjectMapper._configAndWriteValue(ObjectMapper.java:3559)
    at com.fasterxml.jackson.databind.ObjectMapper.writeValueAsString(ObjectMapper.java:2927)
    at com.logsniffer.web.tags.JstlFunctionsLibrary.jsonify(JstlFunctionsLibrary.java:128)
    at sun.reflect.GeneratedMethodAccessor61.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.el.parser.AstFunction.getValue(AstFunction.java:178)
    at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:187)
    at org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:956)
    at org.apache.jsp.WEB_002dINF.views.sniffers.list_jsp$Helper.invoke1(list_jsp.java:428)
    at org.apache.jsp.WEB_002dINF.views.sniffers.list_jsp$Helper.invoke(list_jsp.java:461)
    at org.apache.jsp.tag.webtemplates.bodySidebar_tag$Helper.invoke1(bodySidebar_tag.java:223)
    at org.apache.jsp.tag.webtemplates.bodySidebar_tag$Helper.invoke(bodySidebar_tag.java:245)
    at org.apache.jsp.tag.webtemplates.main_tag.doTag(main_tag.java:211)
    at org.apache.jsp.tag.webtemplates.bodySidebar_tag._jspx_meth_tpl_005fmain_005f0(bodySidebar_tag.java:166)
    at org.apache.jsp.tag.webtemplates.bodySidebar_tag.doTag(bodySidebar_tag.java:133)
    at org.apache.jsp.WEB_002dINF.views.sniffers.list_jsp._jspx_meth_tpl_005fbodySidebar_005f0(list_jsp.java:170)
    at org.apache.jsp.WEB_002dINF.views.sniffers.list_jsp._jspService(list_jsp.java:100)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:808)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:587)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:595)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
    at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:191)
    at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:72)
    at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:168)
    at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:303)
    at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1244)
    at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1027)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:971)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
    at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:808)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:587)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
    at org.eclipse.jetty.server.Server.handle(Server.java:499)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
    at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
    at java.lang.Thread.run(Unknown Source)
Caused by: com.logsniffer.config.ConfigException: Failed to deserialize bean: interface com.logsniffer.event.Publisher
    at com.logsniffer.config.BeanConfigFactoryManager.createBeanFromJSON(BeanConfigFactoryManager.java:175)
    at com.logsniffer.event.h2.H2SnifferPersistence$SnifferRowMapper$3$1.getWrapped(H2SnifferPersistence.java:146)
    at com.logsniffer.event.h2.H2SnifferPersistence$SnifferRowMapper$3$1.getWrapped(H2SnifferPersistence.java:143)
    at com.logsniffer.config.WrappedBean$WrapperSerializer.serializeWithType(WrappedBean.java:57)
    at com.logsniffer.config.WrappedBean$WrapperSerializer.serializeWithType(WrappedBean.java:42)
    at com.fasterxml.jackson.databind.ser.std.CollectionSerializer.serializeContents(CollectionSerializer.java:151)
    ... 73 more
Caused by: com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.lang.String out of START_OBJECT token
 at [Source: {"@type":"HttpPublisher","method":"POST","url":"https://hooks.slack.com/services/...","body":{"channel":"#test","username":"webhookbot","text":"This is posted to #test and comes from a bot named webhookbot.","icon_emoji":":ghost:"},"headers":{},"bodyMimeType":"application/json","httpAuthentication":null}; line: 1, column: 127] (through reference chain: com.logsniffer.event.publisher.http.HttpPublisher["body"])
    at com.fasterxml.jackson.databind.JsonMappingException.from(JsonMappingException.java:148)
    at com.fasterxml.jackson.databind.DeserializationContext.mappingException(DeserializationContext.java:857)
    at com.fasterxml.jackson.databind.deser.std.StringDeserializer.deserialize(StringDeserializer.java:62)
    at com.fasterxml.jackson.databind.deser.std.StringDeserializer.deserialize(StringDeserializer.java:11)
    at com.fasterxml.jackson.databind.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:520)
    at com.fasterxml.jackson.databind.deser.impl.FieldProperty.deserializeAndSet(FieldProperty.java:101)
    at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:339)
    at com.fasterxml.jackson.databind.deser.BeanDeserializer._deserializeOther(BeanDeserializer.java:166)
    at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:136)
    at com.logsniffer.config.ConfiguredBean$ConfiguredBeanDeserializer.deserialize(ConfiguredBean.java:123)
    at com.logsniffer.config.ConfiguredBean$ConfiguredBeanDeserializer.deserialize(ConfiguredBean.java:108)
    at com.fasterxml.jackson.databind.jsontype.impl.AsPropertyTypeDeserializer._deserializeTypedForId(AsPropertyTypeDeserializer.java:122)
    at com.fasterxml.jackson.databind.jsontype.impl.AsPropertyTypeDeserializer.deserializeTypedFromObject(AsPropertyTypeDeserializer.java:93)
    at com.fasterxml.jackson.databind.jsontype.impl.AsPropertyTypeDeserializer.deserializeTypedFromAny(AsPropertyTypeDeserializer.java:165)
    at com.fasterxml.jackson.databind.deser.std.StdDeserializer.deserializeWithType(StdDeserializer.java:119)
    at com.fasterxml.jackson.databind.deser.impl.TypeWrappedDeserializer.deserialize(TypeWrappedDeserializer.java:42)
    at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3736)
    at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2726)
    at com.logsniffer.config.BeanConfigFactoryManager.createBeanFromJSON(BeanConfigFactoryManager.java:172)
    ... 78 more```
mbok commented 8 years ago

Thanks for the feedback! I could reproduce it. Fix is on the way.

mbok commented 8 years ago

Delivered with the 0.5.6 release. You can download it under https://github.com/logsniffer/logsniffer/releases/tag/0.5.6