Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Black0ut44 opened this issue May 18, 2024 · 0 comments
Open

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

Black0ut44 opened this issue May 18, 2024 · 0 comments

Comments

@Black0ut44
Copy link

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);

}`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant