influxdata/influxdb-client-java

Getting NoClassDefFoundError / ClassNotFoundException on java.sql.Date while running SBT assembly jar

itbeans opened this issue · 1 comments

I am getting below error while creating an SBT assembly (fat) jar. The same code works in Intellij Idea just fine.

java.lang.NoClassDefFoundError: java/sql/Date
at com.influxdb.client.JSON.(JSON.java:113)
at com.influxdb.client.internal.AbstractInfluxDBClient.(AbstractInfluxDBClient.java:117)
at com.influxdb.client.internal.AbstractInfluxDBClient.(AbstractInfluxDBClient.java:79)
at com.influxdb.client.internal.InfluxDBClientImpl.(InfluxDBClientImpl.java:99)
at com.influxdb.client.InfluxDBClientFactory.create(InfluxDBClientFactory.java:261)
....
Caused by: java.lang.ClassNotFoundException: java.sql.Date
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:445)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 53 more

Hi,

Were you able to resolve your issue?

I am getting below error while creating an SBT assembly (fat) jar. The same code works in Intellij Idea just fine.

I think this would indicate that your build is missing some file, specifically java/sql/Date.