Skip to content

java.lang.NoClassDefFoundError: retrofit2/Converter$Factory #188

Open
@Black0ut44

Description

Ok I've been trying to figure this out but I just cannot, so I have to come here to ask for help.

I'm basically just playing around trying to understand how everything works. About a week ago, I could send a text message (this is when I was using Maven). Now I have downloaded the JAR file and added to my referenced libraries, running the exact same code and it won't send the text message.

Here is the error:
Exception in thread "main" java.lang.NoClassDefFoundError: retrofit2/Converter$Factory at com.whatsapp.api.impl.WhatsappBusinessCloudApi.<init>(WhatsappBusinessCloudApi.java:40) at com.whatsapp.api.WhatsappApiFactory.newBusinessCloudApi(WhatsappApiFactory.java:45) at WhatsApp.WhatsApp.main(WhatsApp.java:17) Caused by: java.lang.ClassNotFoundException: retrofit2.Converter$Factory at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) ... 3 more

Here is my code:
` public static void main(String[] args) {

    WhatsappApiFactory factory = WhatsappApiFactory.newInstance(Constants.TOKEN);

    WhatsappBusinessCloudApi whatsappBusinessCloudApi = factory.newBusinessCloudApi();
    var message = MessageBuilder.builder()
            .setTo(Constants.PHONE_NUMBER_1)
            .buildTextMessage(new TextMessage()
                .setBody(Formatter.bold("Hello world!") + "\nSome code here: \n" + Formatter.code("hello world code here"))
                .setPreviewUrl(false));


    whatsappBusinessCloudApi.sendMessage(Constants.PHONE_NUMBER_ID, message);

}`

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions