Git Product home page Git Product logo

Comments (12)

rampatra avatar rampatra commented on May 22, 2024

Hi, Can u specify the Slack event for which u got this error? Maybe the model isn't according to the response slack is returning to the bot. Slack doesn't have a very detailed documentation regarding the respective models.

Changing the model will fix this error.

from jbot.

Omertron avatar Omertron commented on May 22, 2024

Do you mean the code that caused this?
I've cut out the non-important bits of code

    @Controller(events = EventType.MESSAGE, pattern = "^\\Qgame\\E(?:\\w?)(.*)$")
    public void test(WebSocketSession session, Event event, Matcher matcher) {
        String query = matcher.group(1);
        StringBuilder response;
        Message myReply;

        response = new StringBuilder("Found ....");
        myReply = new Message(response.toString());
        myReply.setThreadTs(event.getTs());
        reply(session, event, myReply);

from jbot.

rampatra avatar rampatra commented on May 22, 2024

Nope, not your code. The Slack response and the model structure doesn't match. The error shows a deserialization error.

from jbot.

Omertron avatar Omertron commented on May 22, 2024

Ok, not sure what you want?

from jbot.

rampatra avatar rampatra commented on May 22, 2024

Just add private String ts; in Message.java to resolve your issue. And do add getters and setters as well. Or just wait for 5 mins and take a pull, I will be adding them. Thanks for reporting the issue.

from jbot.

Omertron avatar Omertron commented on May 22, 2024

Great thanks, I was trying to work out your code and see what was causing the issue (I've some experience with Jackson), but couldn't work it out as fast as you ;)

from jbot.

rampatra avatar rampatra commented on May 22, 2024

No problem. Have modified the code, you can check. It should work unless Slack has no other new properties added to the event.

from jbot.

Omertron avatar Omertron commented on May 22, 2024

Sorry for the delay, was making sure I got the lastest build, but I'm, still getting an error:

2017-02-06 16:00:53.810 ERROR 8440 --- [ient-SecureIO-1] me.ramswaroop.jbot.core.slack.Bot        : Error handling response from Slack: {"type":"message","message":{"type":"message","user":"U3QCGKKNU","text":"game Sushi Go","thread_ts":"1486396857.000434","reply_count":1,"replies":[{"user":"U41LKC0NA","ts":"1486396859.000435"}],"ts":"1486396857.000434"},"subtype":"message_replied","hidden":true,"channel":"G3RU2Q5MG","event_ts":"1486396859.357009","ts":"1486396859.000436"}. 
Exception: 

com.fasterxml.jackson.databind.JsonMappingException: Can not construct instance of me.ramswaroop.jbot.core.slack.models.Message: no suitable constructor found, can not deserialize from Object value (missing default constructor or creator, or perhaps need to add/enable type information?)
 at [Source: {"type":"message","message":{"type":"message","user":"U3QCGKKNU","text":"game Sushi Go","thread_ts":"1486396857.000434","reply_count":1,"replies":[{"user":"U41LKC0NA","ts":"1486396859.000435"}],"ts":"1486396857.000434"},"subtype":"message_replied","hidden":true,"channel":"G3RU2Q5MG","event_ts":"1486396859.357009","ts":"1486396859.000436"}; line: 1, column: 30] (through reference chain: me.ramswaroop.jbot.core.slack.models.Event["message"])
	at com.fasterxml.jackson.databind.JsonMappingException.from(JsonMappingException.java:270) ~[jackson-databind-2.8.5.jar:2.8.5]
	at com.fasterxml.jackson.databind.DeserializationContext.instantiationException(DeserializationContext.java:1456) ~[jackson-databind-2.8.5.jar:2.8.5]
	at com.fasterxml.jackson.databind.DeserializationContext.handleMissingInstantiator(DeserializationContext.java:1012) ~[jackson-databind-2.8.5.jar:2.8.5]
	at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.deserializeFromObjectUsingNonDefault(BeanDeserializerBase.java:1205) ~[jackson-databind-2.8.5.jar:2.8.5]
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:314) ~[jackson-databind-2.8.5.jar:2.8.5]
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:148) ~[jackson-databind-2.8.5.jar:2.8.5]
	at com.fasterxml.jackson.databind.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:499) ~[jackson-databind-2.8.5.jar:2.8.5]
	at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:101) ~[jackson-databind-2.8.5.jar:2.8.5]
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:276) ~[jackson-databind-2.8.5.jar:2.8.5]
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:140) ~[jackson-databind-2.8.5.jar:2.8.5]
	at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3798) ~[jackson-databind-2.8.5.jar:2.8.5]
	at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2842) ~[jackson-databind-2.8.5.jar:2.8.5]
	at me.ramswaroop.jbot.core.slack.Bot.handleTextMessage(Bot.java:159) ~[jbot-3.0.3-SNAPSHOT.jar:3.0.3-SNAPSHOT]
	at me.ramswaroop.jbot.core.slack.BotWebSocketHandler.handleTextMessage(BotWebSocketHandler.java:32) [jbot-3.0.3-SNAPSHOT.jar:3.0.3-SNAPSHOT]
	at org.springframework.web.socket.handler.AbstractWebSocketHandler.handleMessage(AbstractWebSocketHandler.java:43) [spring-websocket-4.3.5.RELEASE.jar:4.3.5.RELEASE]
	at org.springframework.web.socket.handler.WebSocketHandlerDecorator.handleMessage(WebSocketHandlerDecorator.java:75) [spring-websocket-4.3.5.RELEASE.jar:4.3.5.RELEASE]
	at org.springframework.web.socket.handler.LoggingWebSocketHandlerDecorator.handleMessage(LoggingWebSocketHandlerDecorator.java:56) [spring-websocket-4.3.5.RELEASE.jar:4.3.5.RELEASE]
	at org.springframework.web.socket.adapter.standard.StandardWebSocketHandlerAdapter.handleTextMessage(StandardWebSocketHandlerAdapter.java:110) [spring-websocket-4.3.5.RELEASE.jar:4.3.5.RELEASE]
	at org.springframework.web.socket.adapter.standard.StandardWebSocketHandlerAdapter.access$000(StandardWebSocketHandlerAdapter.java:42) [spring-websocket-4.3.5.RELEASE.jar:4.3.5.RELEASE]
	at org.springframework.web.socket.adapter.standard.StandardWebSocketHandlerAdapter$3.onMessage(StandardWebSocketHandlerAdapter.java:81) [spring-websocket-4.3.5.RELEASE.jar:4.3.5.RELEASE]
	at org.springframework.web.socket.adapter.standard.StandardWebSocketHandlerAdapter$3.onMessage(StandardWebSocketHandlerAdapter.java:78) [spring-websocket-4.3.5.RELEASE.jar:4.3.5.RELEASE]
	at org.apache.tomcat.websocket.WsFrameBase.sendMessageText(WsFrameBase.java:399) [tomcat-embed-websocket-8.5.6.jar:8.5.6]
	at org.apache.tomcat.websocket.WsFrameBase.processDataText(WsFrameBase.java:500) [tomcat-embed-websocket-8.5.6.jar:8.5.6]
	at org.apache.tomcat.websocket.WsFrameBase.processData(WsFrameBase.java:295) [tomcat-embed-websocket-8.5.6.jar:8.5.6]
	at org.apache.tomcat.websocket.WsFrameBase.processInputBuffer(WsFrameBase.java:131) [tomcat-embed-websocket-8.5.6.jar:8.5.6]
	at org.apache.tomcat.websocket.WsFrameClient.processSocketRead(WsFrameClient.java:73) [tomcat-embed-websocket-8.5.6.jar:8.5.6]
	at org.apache.tomcat.websocket.WsFrameClient.access$300(WsFrameClient.java:31) [tomcat-embed-websocket-8.5.6.jar:8.5.6]
	at org.apache.tomcat.websocket.WsFrameClient$WsFrameClientCompletionHandler.completed(WsFrameClient.java:131) [tomcat-embed-websocket-8.5.6.jar:8.5.6]
	at org.apache.tomcat.websocket.WsFrameClient$WsFrameClientCompletionHandler.completed(WsFrameClient.java:114) [tomcat-embed-websocket-8.5.6.jar:8.5.6]
	at org.apache.tomcat.websocket.AsyncChannelWrapperSecure$WrapperFuture.complete(AsyncChannelWrapperSecure.java:463) [tomcat-embed-websocket-8.5.6.jar:8.5.6]
	at org.apache.tomcat.websocket.AsyncChannelWrapperSecure$ReadTask.run(AsyncChannelWrapperSecure.java:332) [tomcat-embed-websocket-8.5.6.jar:8.5.6]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_121]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_121]
	at java.lang.Thread.run(Thread.java:745) [na:1.8.0_121]

from jbot.

rampatra avatar rampatra commented on May 22, 2024

Sorry, the push didn't go. Please take a pull now, it should work.

from jbot.

rampatra avatar rampatra commented on May 22, 2024

@Omertron Hey, did it work for you?

from jbot.

Omertron avatar Omertron commented on May 22, 2024

@ramswaroop Yes, this works now.
Thanks for the fix

from jbot.

hirvora avatar hirvora commented on May 22, 2024

Hi @rampatra I am trying to create slack code by using your code but i am getting this above error. can you please help me to resolve it?

from jbot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.