Uploaded image for project: 'Apache Drill'
  1. Apache Drill
  2. DRILL-3784

simple Jdbc program fails with NoClassDefFoundError

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 1.2.0
    • Fix Version/s: 1.2.0
    • Component/s: None
    • Labels:
      None

      Description

      I have zookeeper installed and I'm running a single drillbit.

      I'm running a simple Jdbc program that uses drill-jdbc-all, and I do get the following error when trying to connect:

      Exception in thread "main" java.lang.NoClassDefFoundError: oadd/org/codehaus/jackson/map/ObjectMapper
      	at oadd.org.apache.curator.x.discovery.details.JsonInstanceSerializer.<init>(JsonInstanceSerializer.java:42)
      	at oadd.org.apache.curator.x.discovery.ServiceDiscoveryBuilder.builder(ServiceDiscoveryBuilder.java:42)
      	at oadd.org.apache.drill.exec.coord.zk.ZKClusterCoordinator.getDiscovery(ZKClusterCoordinator.java:265)
      	at oadd.org.apache.drill.exec.coord.zk.ZKClusterCoordinator.<init>(ZKClusterCoordinator.java:103)
      	at oadd.org.apache.drill.exec.client.DrillClient.connect(DrillClient.java:185)
      	at org.apache.drill.jdbc.impl.DrillConnectionImpl.<init>(DrillConnectionImpl.java:134)
      	at org.apache.drill.jdbc.impl.DrillJdbc41Factory.newDrillConnection(DrillJdbc41Factory.java:66)
      	at org.apache.drill.jdbc.impl.DrillFactory.newConnection(DrillFactory.java:69)
      	at oadd.net.hydromatic.avatica.UnregisteredDriver.connect(UnregisteredDriver.java:126)
      	at org.apache.drill.jdbc.Driver.connect(Driver.java:72)
      	at java.sql.DriverManager.getConnection(DriverManager.java:571)
      	at java.sql.DriverManager.getConnection(DriverManager.java:233)
      	at SimpleJdbc.main(SimpleJdbc.java:13)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:606)
      	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
      Caused by: java.lang.ClassNotFoundException: oadd.org.codehaus.jackson.map.ObjectMapper
      	at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
      	at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
      	at java.security.AccessController.doPrivileged(Native Method)
      	at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
      	at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
      	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
      	at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
      	... 18 more
      

      Using jdbc-all built right before DRILL-3589 commit works fine, so the problem seem to be related to the changes in DRILL-3589

      Here is the program I'm running:

      import java.sql.Connection;
      import java.sql.DriverManager;
      import java.sql.ResultSet;
      import java.sql.Statement;
      
      public class SimpleJdbc {
      
        public static void main(String[] args) throws Exception {
          Class.forName("org.apache.drill.jdbc.Driver").newInstance();
          Connection conn = DriverManager.getConnection("jdbc:drill:");
      
          Statement stmt = null;
          ResultSet rs = null;
      
          try {
            stmt = conn.createStatement();
            rs = stmt.executeQuery("SELECT employee_id FROM cp.`employee.json`");
      
            while (rs.next()) {
              System.out.println(rs.getObject(1));
            }
      
          } finally {
            if (stmt != null) {
              stmt.close();
            }
            if (rs != null) {
              rs.close();
            }
      
            conn.close();
          }
        }
      }
      
      1. DRILL-3784.1.patch.txt
        0.8 kB
        Deneche A. Hakim

        Issue Links

          Activity

          Hide
          khfaraaz Khurram Faraaz added a comment -

          Verified. I was able to compile and run a simple JDBC program on Drill master b9afcf8f

          Show
          khfaraaz Khurram Faraaz added a comment - Verified. I was able to compile and run a simple JDBC program on Drill master b9afcf8f
          Hide
          adeneche Deneche A. Hakim added a comment -

          Fixed in bb111addb1f702044c70d48c9dd05a5c001b15d6

          Show
          adeneche Deneche A. Hakim added a comment - Fixed in bb111addb1f702044c70d48c9dd05a5c001b15d6
          Hide
          jnadeau Jacques Nadeau added a comment -

          Lgtm. +1

          Show
          jnadeau Jacques Nadeau added a comment - Lgtm. +1
          Hide
          adeneche Deneche A. Hakim added a comment -

          Jacques Nadeau can you please review ?

          Show
          adeneche Deneche A. Hakim added a comment - Jacques Nadeau can you please review ?
          Hide
          adeneche Deneche A. Hakim added a comment -

          This fixes the problem. I will submit a patch right now

          Show
          adeneche Deneche A. Hakim added a comment - This fixes the problem. I will submit a patch right now
          Hide
          jnadeau Jacques Nadeau added a comment -

          Deneche A. Hakim, can you try to after deleting this line:

          https://github.com/apache/drill/blob/master/exec/jdbc-all/pom.xml#L308

          I just noticed this and won't be able to get to it for a couple days.

          Show
          jnadeau Jacques Nadeau added a comment - Deneche A. Hakim , can you try to after deleting this line: https://github.com/apache/drill/blob/master/exec/jdbc-all/pom.xml#L308 I just noticed this and won't be able to get to it for a couple days.

            People

            • Assignee:
              jnadeau Jacques Nadeau
              Reporter:
              adeneche Deneche A. Hakim
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development