Skip to content

Apache Drill JDBC driver only loaded on second attempt #913

@xhochy

Description

@xhochy

Using the Apache Drill JDBC driver always only works with the second attempt to connect to it. The first attempt will always fails with the same missing Java class.

Reproducible example

# wget http://archive.apache.org/dist/drill/drill-1.18.0/apache-drill-1.18.0.tar.gz
# tar xf apache-drill-1.18.0.tar.gz

import os

import jpype
import jpype.dbapi2

classpath = os.path.join(os.getcwd(), "apache-drill-1.18.0/jars/jdbc-driver/drill-jdbc-all-1.18.0.jar")
jpype.startJVM(classpath=classpath)

jpype.dbapi2.connect("jdbc:drill:drillbit=127.0.0.1")

This errors with the following trace for me. A second call to jpype.dbapi2.connect(…) suceeds though.

java.lang.ClassNotFoundException          Traceback (most recent call last)
…/env/lib/python3.8/site-packages/_jpype.cpython-38-darwin.so in java.lang.ClassLoader.loadClass()

…/env/lib/python3.8/site-packages/_jpype.cpython-38-darwin.so in sun.misc.Launcher$AppClassLoader.loadClass()

…/env/lib/python3.8/site-packages/_jpype.cpython-38-darwin.so in java.lang.ClassLoader.loadClass()

…/env/lib/python3.8/site-packages/_jpype.cpython-38-darwin.so in java.net.URLClassLoader.findClass()

java.lang.ClassNotFoundException: java.lang.ClassNotFoundException: oadd.org.apache.drill.exec.store.StoragePluginRegistry

The above exception was the direct cause of the following exception:

Exception                                 Traceback (most recent call last)
…/env/lib/python3.8/site-packages/_jpype.cpython-38-darwin.so in org.jpype.JPypeContext.newWrapper()

…/env/lib/python3.8/site-packages/_jpype.cpython-38-darwin.so in org.jpype.manager.TypeFactoryNative.newWrapper()

…/env/lib/python3.8/site-packages/_jpype.cpython-38-darwin.so in org.jpype.manager.TypeManager.populateMembers()

…/env/lib/python3.8/site-packages/_jpype.cpython-38-darwin.so in org.jpype.manager.TypeManager.createMembers()

…/env/lib/python3.8/site-packages/_jpype.cpython-38-darwin.so in org.jpype.manager.TypeManager.createMethodDispatches()

…/env/lib/python3.8/site-packages/_jpype.cpython-38-darwin.so in java.lang.Class.getDeclaredMethods()

…/env/lib/python3.8/site-packages/_jpype.cpython-38-darwin.so in java.lang.Class.privateGetDeclaredMethods()

…/env/lib/python3.8/site-packages/_jpype.cpython-38-darwin.so in java.lang.Class.getDeclaredMethods0()

Exception: Java Exception

The above exception was the direct cause of the following exception:

java.lang.NoClassDefFoundError            Traceback (most recent call last)
<ipython-input-1-c05c50c246ba> in <module>
     10 jpype.startJVM(classpath=classpath)
     11 
---> 12 jpype.dbapi2.connect("jdbc:drill:drillbit=127.0.0.1")

…/env/lib/python3.8/site-packages/jpype/dbapi2.py in connect(dsn, driver, driver_args, adapters, converters, getters, setters, **kwargs)
    418     # User supplied nothing
    419     elif driver_args is None:
--> 420         connection = DM.getConnection(dsn)
    421 
    422     # Otherwise use the kwargs

java.lang.NoClassDefFoundError: java.lang.NoClassDefFoundError: oadd/org/apache/drill/exec/store/StoragePluginRegistry

Metadata

Metadata

Assignees

Labels

on-holdProblem requiring further user input to address

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions