napperley
10/14/2019, 2:41 AMNoSuchMethodError
when running a program that uses a Kotlin library I have developed called KMQTT Client ( https://gitlab.com/napperley/kmqtt-client ), which uses coroutines. The error occurs when invoking the publish
function. Below is the function's definition ( https://gitlab.com/napperley/kmqtt-client/blob/master/src/jvmMain/kotlin/org/digieng/kmqtt/client/MqttClient.kt#L37 ) in the library:
actual suspend fun publish(topic: String, msg: MqttMessage, timeout: Long): MqttError? = try {
client.publish(topic, PahoMqttMessage(msg.payload.toByteArray()))
null
} catch (mqttPersistenceEx: MqttPersistenceException) {
MqttError(mqttPersistenceEx.message ?: "Message persistence failed.", MqttStatus.MSG_PERSISTENCE_FAILED)
} catch (mqttEx: MqttException) {
MqttError(mqttEx.message ?: "Message delivery failed.", MqttStatus.MSG_DELIVERY_FAILED)
}
Below are some of the error details:
Exception in thread "main" java.lang.NoSuchMethodError: 'java.lang.Object org.digieng.kmqtt.client.MqttClient.publish$default(org.digieng.kmqtt.client.MqttClient, java.lang.String, org.digieng.kmqtt.client.MqttMessage, long, kotlin.coroutines.Continuation, int, java.lang.Object)'
napperley
10/14/2019, 2:47 AMNoSuchMethodError
didn't appear earlier when invoking the connect
function ( https://gitlab.com/napperley/kmqtt-client/blob/master/src/jvmMain/kotlin/org/digieng/kmqtt/client/MqttClient.kt#L88 ).