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

simple Jdbc program fails with NoClassDefFoundError

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Fixed
    • 1.2.0
    • 1.2.0
    • None
    • 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();
          }
        }
      }
      

      Attachments

        1. DRILL-3784.1.patch.txt
          0.8 kB
          Abdel Hakim Deneche

        Issue Links

          Activity

            People

              jnadeau Jacques Nadeau
              adeneche Abdel Hakim Deneche
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: