Saturday, April 24, 2021

[Ballerina] ClassNotFoundException NoClassDefFoundError when upgrading ballerina distribution

I was working with a simple SQL query. The only change I did was upgrading the Ballerina distribution from slalpha3 to slalpha4. I got the following error.

[2021-04-20 18:15:15,527] SEVERE {b7a.log.crash} - ballerinax/mysql/0_7_0-alpha7/$ConfigurationMapper
java.lang.NoClassDefFoundError: ballerinax/mysql/0_7_0-alpha7/$ConfigurationMapper
    at suhan.expose_mysql_data.0_1_0.$ConfigurationMapper.$configureInit(Unknown Source)
    at suhan.expose_mysql_data.0_1_0.$_init.main(expose_mysql_data)
Caused by: java.lang.ClassNotFoundException: ballerinax.mysql.0_7_0-alpha7.$ConfigurationMapper
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
    ... 2 more


Reason on slack channel.
from slalpha4, packages like mysql, java.jdbc which are categorized as ballerinax are not coming with the ballerina distribution. if ballerina user needs such dependencies, user can always download those packages from the central. I think this particular issue is coming from either the caching mechanism we used which is not getting up to date dependencies or erroneous package pushed to ballerina central.

Workaround is as follows.
Answer on slack channel - Fixed.
Clear cache at location ~/.ballerina/repositories/central.ballerina.io


No comments:

Post a Comment