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

Update Ivy to 2.5.2 to solve NoClassDefFoundError #2

Closed
stariy95 opened this issue May 9, 2024 · 0 comments
Closed

Update Ivy to 2.5.2 to solve NoClassDefFoundError #2

stariy95 opened this issue May 9, 2024 · 0 comments
Milestone

Comments

@stariy95
Copy link
Member

stariy95 commented May 9, 2024

Upgrading Ivy solves an annoying issue with missing classes from the transitive dependencies defined via %maven magic.

Steps to Reproduce

For the record, here are the maximally simplified steps to reproduce:

  1. rm -rf ~/.ivy2
  2. Create a notebook with the sections below (all dependencies are publicly-available on Maven central)
  3. Run it once (you'll get a DB connection error at the end, but that's fine. It is not the one we are chasing)
  4. Close the browser, stop jupyter
  5. Running jupyter and going through this notebook again causes NoClassDefFoundError below when instantiating the connector

I don't know if this is a coincidence, but the NoClassDefFoundError is always on the "invisible" dependency (i.e. the classes we don't interact with directly in the code). The failing class is org/slf4j/LoggerFactory, loaded via the following dependency chain: dflib-jupyter -> dflib-jdbc -> slf4j-api, when a class from dflib-jdbc (SimpleDataSource) is invoked explicitly.

Notebook code

%maven org.dflib:dflib-jupyter:1.0.0-M20
%maven org.postgresql:postgresql:42.7.2
import org.dflib.jupyter.*;
import org.dflib.*;
import org.dflib.jdbc.*;

DFLibJupyter.init(getKernelInstance());
var connector = Jdbc.connector("jdbc:postgresql://localhost:15432/")
    .userName("postgres")
    .password("test")
    .build();

connector

Error

ava.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
	at org.dflib.jdbc.datasource.SimpleDataSource.<clinit>(SimpleDataSource.java:19)
	at org.dflib.jdbc.connector.JdbcConnectorBuilder.createDataSource(JdbcConnectorBuilder.java:97)
	at org.dflib.jdbc.connector.JdbcConnectorBuilder.build(JdbcConnectorBuilder.java:76)
	at .do_it$Aux(#24:4)
	at .(#24:1)
@stariy95 stariy95 added this to the 1.0-M1 milestone May 9, 2024
stariy95 added a commit that referenced this issue May 10, 2024
@andrus andrus changed the title Update Ivy to 2.5.2 Update Ivy to 2.5.2 to solve NoClassDefFoundError May 12, 2024
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