我是Apache Drill的新手,並且安裝的很好,可以在嵌入式模式下通過Web界面在本地運行。但是,當嘗試使用JDBC通過Java客戶端訪問時,遇到以下問題。Apache Drill JDBC Java客戶端異常
繼鑽文檔和這裏的幾個帖子,我的設置是這樣的:
<dependency>
<groupId>org.apache.drill.exec</groupId>
<artifactId>drill-jdbc</artifactId>
<version>1.7.0</version>
</dependency>
代碼:
public static void main(String[] args) {
Class.forName("org.apache.drill.jdbc.Driver");
**Connection connection = DriverManager.getConnection("jdbc:drill:zk=local");**
Statement st = connection.createStatement();
ResultSet rs = st.executeQuery("SELECT * from cp.`employee` LIMIT 10");
while (rs.next()) {
System.out.println(rs.getString(1));
}
...
沒有編譯的問題但是,在運行上面,我得到以下OutOfMemoryException在上面的代碼中突出顯示的部分:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/drill/exec/exception/OutOfMemoryException
at org.apache.drill.jdbc.impl.DrillJdbc41Factory.newDrillConnection(DrillJdbc41Factory.java:64)
at org.apache.drill.jdbc.impl.DrillFactory.newConnection(DrillFactory.java:69)
at 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:664)
at java.sql.DriverManager.getConnection(DriverManager.java:270)
at com.mapr.drill.DrillJDBCExample.runMode1(DrillJDBCExample.java:49)
at com.mapr.drill.DrillJDBCExample.main(DrillJDBCExample.java:21)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
Caused by: java.lang.ClassNotFoundException: org.apache.drill.exec.exception.OutOfMemoryException
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 13 more
我這樣做了鑽孔運行寧當地人。還嘗試改變jdbc url至"jdbc:drill:drillbit=localhost";
請幫忙。
你正在使用Windows機器或Linux? –
似乎是一個構建問題給我。請確保'mvn clean install -DskipTests'成功。由於演練在本地運行,因此請使用'「jdbc:drill:drillbit = localhost」'(_you提到too_)嘗試 –
在Mac上工作。 – san