4

Good morning... I'm completely lost at this moment.

My application is sending a JMS message to an EMS server every 5 minutes. Launching it on a local tomcat it's working fine... But when I deploy it to our PRE enviroment, i'm getting this error when trying to parse the Java object to xml string:

Exception in thread "Timer-8" java.lang.NoSuchMethodError: org.codehaus.stax2.XMLStreamWriter2.closeCompletely()V
    at com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator.close(ToXmlGenerator.java:1091)
    at com.fasterxml.jackson.databind.ObjectMapper._configAndWriteValue(ObjectMapper.java:3633)
    at com.fasterxml.jackson.databind.ObjectMapper.writeValueAsString(ObjectMapper.java:2998)
    at es.adif.icecof.ems.JmsHeartbeatSender.sendMessage(JmsHeartbeatSender.java:67)
    at es.adif.icecof.common.ThreadHeartbeat$1.run(ThreadHeartbeat.java:42)
    at java.util.TimerThread.mainLoop(Timer.java:555)
    at java.util.TimerThread.run(Timer.java:505)

What the hell can be happening?

Thank you very much...

1 Answers1

5

I had the same problem and it turned out I had both Jackson 1.x and 2.x versions on the classpath as well as an old version of Woodstox.

The solution was to go through the list of dependencies and remove all dependencies that have org.codehaus.jackson as groupId, as well as the wstx-asl dependency.

THelper
  • 15,333
  • 6
  • 64
  • 104
  • 2
    `wstx-asl` dependency was my problem as well, it was in conflict with the newer `woodstox-core-5.1.0`, so I had to exclude it. In the older version the `XMLStreamWriter2` interface does not contain the `closeCompletely()` method (which anyway does only a classic `close()`). – JediCate Jun 19 '18 at 06:36
  • I've fixed it in another way. Just put my new Jackson higher then other older legacy conflicted dependencies in the pom.xml. [The order of dependencies does matter](https://stackoverflow.com/a/31743617/5719185) – Optio Oct 10 '20 at 20:25