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

Nobody has claimed this yet.

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

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

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.