sqoop-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From 呂佳鴻 <chiahung1...@gmail.com>
Subject sqoop 1.99.3 problem in using java api
Date Wed, 03 Dec 2014 09:04:11 GMT
hi , i have problem in using sqoop java api.
First, I add dependency to sqoop (sqoop/shell/pom.xml)
and run command: mvn install
(Is it  correct ?)

Here is the testing code i use

import org.apache.sqoop.client.SqoopClient;
import org.apache.sqoop.model.MConnection;
import org.apache.sqoop.model.MConnectionForms;
import org.apache.sqoop.model.MJob;
import org.apache.sqoop.model.MJobForms;
import org.apache.sqoop.model.MSubmission;
import org.apache.sqoop.submission.counter.Counter;
import org.apache.sqoop.submission.counter.CounterGroup;
import org.apache.sqoop.submission.counter.Counters;
import org.apache.sqoop.validation.Status;
import org.apache.sqoop.*;
public class SqoopAccess{
 public static void main(String[] args){
  String url = "http://localhost:12000/sqoop/";
  SqoopClient client = new SqoopClient(url);
  client.setServerUrl(url);
  MConnection newCon = client.newConnection(1);

  MConnectionForms conForms = newCon.getConnectorPart();
  MConnectionForms frameworkForms = newCon.getFrameworkPart();
  newCon.setName("MyConnection");

conForms.getStringInput("connection.connectionString").setValue("jdbc:mysql://localhost/sqoop_test");

conForms.getStringInput("connection.jdbcDriver").setValue("com.mysql.jdbc.Driver");
  conForms.getStringInput("connection.username").setValue("root");
  conForms.getStringInput("connection.password").setValue("root");
  frameworkForms.getIntegerInput("security.maxConnections").setValue(0);
 }
}


when i run, i got the exception

Exception in thread "main" java.lang.NoClassDefFoundError:
org/apache/sqoop/common/ErrorCode
at SqoopAccess.main(SqoopAccess.java:15)
Caused by: java.lang.ClassNotFoundException:
org.apache.sqoop.common.ErrorCode
at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 1 more

Which part is incorrect?
I'm no idea for how to use it .
Is any sample i can find or use on the website?
Thanks.

Mime
View raw message