0

I'm trying to use the newDefaultUnpacker static method of the MessagePack class like this:

import org.msgpack.MessagePack;

Map<Value, Value> map = MessagePack.newDefaultUnpacker(myByteArray).unpackValue().asMapValue().map();

however I get the error:

The method newDefaultUnpacker(byte[]) is undefined for the type MessagePack

Initially I created the following Maven dependency:

<dependency>
    <groupId>org.msgpack</groupId>
    <artifactId>msgpack</artifactId>
    <version>0.6.12</version>
</dependency>

Changing it to this (or adding this in addition to the previous dependency) doesn't work.

<dependency>
  <groupId>org.msgpack</groupId>
  <artifactId>msgpack-core</artifactId>
  <version>0.8.16</version>
</dependency>

What do I need to do to successfully reference newDefaultUnpacker? I don't get any hints that suggest a particular import that I should add, and import org.msgpack.core isn't recognised i.e. the package doesn't exist.

Chris Halcrow
  • 28,994
  • 18
  • 176
  • 206
  • Sounds like the maven dependency is not updated in local m2 repo. The dependency in my pom is org.msgpack msgpack-core 0.8.16 and importing the following classes work fine: import org.msgpack.core.MessagePack; import org.msgpack.value.Value; I would suggest that you remove the old msgpack from your m2 repo manually and then perform Maven > Update project, with Force update of snapshot/releases in case you are using eclipse. I am sure other IDEs have similar functions. – moonlighter Nov 07 '18 at 03:54
  • Thanks @moonlighter. I believe I'm not using m2 - my understanding is that this is an Eclipse add-in? I resolved the issue by uninstalling and re-installing Maven. – Chris Halcrow Nov 07 '18 at 03:58

1 Answers1

0

I uninstalled Maven (by removing the folder containing the bin and removing the folder from my Windows path under environment variables > system ). I then re-installed it the same way as I'd originally installed it, and everything worked.

Chris Halcrow
  • 28,994
  • 18
  • 176
  • 206