Skip to content
Advertisement

java.lang.AbstractMethodError occurs while trying to implement call inbound of nexmo SDK through rabbitMQ

I am trying to integrate call inbound feature using nexmo java SDK to my spring MVC project with help of rabbitMQ. But I keep on getting the exception below

[WARN ] 2021-01-26 14:52:26.913 [org.springframework.amqp.rabbit.config.ListenerContainerFactoryBean#6-9]   ConditionalRejectingErrorHandler - Execution of Rabbit message listener failed.
org.springframework.amqp.rabbit.listener.exception.ListenerExecutionFailedException: Listener method 'listen' threw exception
        at org.springframework.amqp.rabbit.listener.adapter.MessageListenerAdapter.invokeListenerMethod(MessageListenerAdapter.java:371) ~[spring-rabbit-2.1.8.RELEASE.jar:2.1.8.RELEASE]
        at org.springframework.amqp.rabbit.listener.adapter.MessageListenerAdapter.onMessage(MessageListenerAdapter.java:292) ~[spring-rabbit-2.1.8.RELEASE.jar:2.1.8.RELEASE]
        at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:1542) ~[spring-rabbit-2.1.8.RELEASE.jar:2.1.8.RELEASE]
        at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.actualInvokeListener(AbstractMessageListenerContainer.java:1468) ~[spring-rabbit-2.1.8.RELEASE.jar:2.1.8.RELEASE]
        at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:1456) [spring-rabbit-2.1.8.RELEASE.jar:2.1.8.RELEASE]
        at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:1451) [spring-rabbit-2.1.8.RELEASE.jar:2.1.8.RELEASE]
        at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.executeListener(AbstractMessageListenerContainer.java:1400) [spring-rabbit-2.1.8.RELEASE.jar:2.1.8.RELEASE]
        at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.doReceiveAndExecute(SimpleMessageListenerContainer.java:870) [spring-rabbit-2.1.8.RELEASE.jar:2.1.8.RELEASE]
        at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.receiveAndExecute(SimpleMessageListenerContainer.java:854) [spring-rabbit-2.1.8.RELEASE.jar:2.1.8.RELEASE]
        at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.access$1600(SimpleMessageListenerContainer.java:78) [spring-rabbit-2.1.8.RELEASE.jar:2.1.8.RELEASE]
        at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.mainLoop(SimpleMessageListenerContainer.java:1137) [spring-rabbit-2.1.8.RELEASE.jar:2.1.8.RELEASE]
        at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:1043) [spring-rabbit-2.1.8.RELEASE.jar:2.1.8.RELEASE]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_275]
Caused by: java.lang.AbstractMethodError: io.jsonwebtoken.impl.DefaultJwtBuilder.addClaims(Ljava/util/Map;)Lio/jsonwebtoken/JwtBuilder;
        at com.nexmo.jwt.JwtGenerator.generate(JwtGenerator.kt:44) ~[jwt-1.0.1.jar:?]
        at com.nexmo.jwt.Jwt.generate(Jwt.kt:44) ~[jwt-1.0.1.jar:?]
        at com.nexmo.jwt.Jwt.generate$default(Jwt.kt:43) ~[jwt-1.0.1.jar:?]
        at com.nexmo.jwt.Jwt.generate(Jwt.kt) ~[jwt-1.0.1.jar:?]
        at com.nexmo.client.auth.JWTAuthMethod.apply(JWTAuthMethod.java:49) ~[client-5.6.0.jar:5.6.0]
        at com.nexmo.client.AbstractMethod.applyAuth(AbstractMethod.java:133) ~[client-5.6.0.jar:5.6.0]
        at com.nexmo.client.AbstractMethod.execute(AbstractMethod.java:79) ~[client-5.6.0.jar:5.6.0]
        at com.nexmo.client.voice.CallsEndpoint.post(CallsEndpoint.java:62) ~[client-5.6.0.jar:5.6.0]
        at com.nexmo.client.voice.VoiceClient.createCall(VoiceClient.java:66) ~[client-5.6.0.jar:5.6.0]
        at com.senpiper.core.listener.VoiceCallListener.listen(VoiceCallListener.java:63) ~[classes/:?]
        at sun.reflect.GeneratedMethodAccessor104.invoke(Unknown Source) ~[?:?]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_275]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_275]
        at org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:269) ~[spring-core-4.2.3.RELEASE.jar:4.2.3.RELEASE]
        at org.springframework.amqp.rabbit.listener.adapter.MessageListenerAdapter.invokeListenerMethod(MessageListenerAdapter.java:363) ~[spring-rabbit-2.1.8.RELEASE.jar:2.1.8.RELEASE]
        ... 12 more

RabbitMQ Listener class where call inbound logic is implemented.

@RabbitListener
public class VoiceCallListener {
    public void listen(VoiceCallPojo voiceCallPojo) {
        NexmoClient client = NexmoClient.builder()
                .apiKey(API_KEY)
                .applicationId(APPLICATION_ID)
                .privateKeyContents(PRIVATE_KEY).httpConfig(HttpConfig.defaultConfig())
                .signatureSecret(SECRET_KEY)
                .build();
        Ncco ncco = new Ncco(
         TalkAction.builder(voiceCallPojo.getMessage()).voiceName(VoiceName.ADITI).build()
        );
        CallEvent result = client.getVoiceClient().createCall(new Call(voiceCallPojo.getCallNumber(),FROM_NUMBER, ncco));
    }
}

POM dependencies

<dependency>
      <groupId>com.nexmo</groupId>
      <artifactId>client</artifactId>
      <version>5.6.0</version>
    </dependency>
    <dependency>
      <groupId>io.jsonwebtoken</groupId>
      <artifactId>jjwt-impl</artifactId>
      <version>0.11.2</version>
      <scope>runtime</scope>
    </dependency>

Advertisement

Answer

This has nothing to do with spring-rabbit; it is an incompatibility between the two library versions you are using and will happen when called from any of your code. See the javadocs for AbstractMethodError.

/**
 * Thrown when an application tries to call an abstract method.
 * Normally, this error is caught by the compiler; this error can
 * only occur at run time if the definition of some class has
 * incompatibly changed since the currently executing method was last
 * compiled.
 *
 * @author  unascribed
 * @since   1.0
 */

You need to find out which versions are compatible.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement