influxdata / influxdata/influxdb-client-java

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

Open
#523 1 comment 0 reactions 0 assignees View on GitHub
question
Dominant language
Java
Stars
477
Forks
129
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the assembly-jar runtime and the stack trace at com.influxdb.client.JSON (JSON.java:113), then inspect how the assembled artifact loads java.sql.Date compared with IntelliJ. Reproduce the NoClassDefFoundError/ClassNotFoundException and document the packaging or runtime difference that accounts for it.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.