The Hortonworks Community Connection is now live. A completely rebuilt Q&A forum, Knowledge Base, Code Hub and more, backed by the experts in the industry.

You will be redirected here in 10 seconds. If your are not redirected, click here to visit the new site.

The legacy Hortonworks Forum is now closed. You can view a read-only version of the former site by clicking here. The site will be taken offline on January 31,2016

MapReduce Forum

Sqoop Import From SQL Error

  • #46388
    Jeffrey
    Participant

    We are trying to create a simple import routine in Java that imports a single table from SQL Server to Hadoop/Hive using Sqoop. We are getting the following error:

    Exception in thread “main” java.lang.NoClassDefFoundError: org/apache/hadoop/util/PlatformName
    at org.apache.hadoop.security.UserGroupInformation.getOSLoginModuleName(UserGroupInformation.java:303)
    at org.apache.hadoop.security.UserGroupInformation.<clinit>(UserGroupInformation.java:348)
    at org.apache.hadoop.mapreduce.task.JobContextImpl.<init>(JobContextImpl.java:72)
    at org.apache.hadoop.mapreduce.Job.<init>(Job.java:133)
    at org.apache.hadoop.mapreduce.Job.<init>(Job.java:123)
    at org.apache.sqoop.mapreduce.ImportJobBase.runImport(ImportJobBase.java:230)
    at org.apache.sqoop.manager.SqlManager.importTable(SqlManager.java:600)
    at org.apache.sqoop.tool.ImportTool.importTable(ImportTool.java:413)
    at org.apache.sqoop.tool.ImportTool.run(ImportTool.java:502)
    at SqlImport.importSQLToHDFS(SqlImport.java:38)
    at SqlImport.main(SqlImport.java:9)
    Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.util.PlatformName
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

    We have found that the PlatformName.class file is no longer being supplied in the Hadoop-Common jar file.
    Is there a incompatibility between the JAR files supplied in the HortonWorks Sandbox 2.0?

    Here is a copy of our test Java import routine:

    String driver = “com.microsoft.sqlserver.jdbc.SQLServerDriver”;
    Class.forName(driver).newInstance();
    SqoopOptions options = new SqoopOptions();
    options.setConnManagerClassName(“org.apache.sqoop.manager.GenericJdbcManager”);
    options.setDriverClassName(driver);
    options.setHadoopMapRedHome(“/usr/lib/hadoop-mapreduce”);
    options.setConnectString(“jdbc:sqlserver://server;databaseName=db;user=user;password=pwd”);
    options.setTableName(“Parameters”);
    options.setUsername(“user”);
    options.setPassword(“pwd”);
    options.setOverwriteHiveTable(true);
    options.setDirectMode(true);
    options.setNumMappers(1);
    options.setJobName(“Test Import”);
    options.setFileLayout(FileLayout.TextFile);
    options.setDirectMode(true);
    options.setHiveImport(true);
    options.setHiveDatabaseName(“default”);
    options.setHiveTableName(“Parameters”);
    options.setHiveHome(“/usr/lib/hive”);

    ImportTool tool = new ImportTool();
    tool.run(options);

    If anyone has a solution for this, please let me know.

    Thanks,

    Jeffrey Taylor

  • Author
    Replies
  • #46869
    Jeffrey
    Participant

    Finally got past this error.
    You must include hadoop-auth-2.2.0.2.0.6.0-76.jar in your classpath.

The forum ‘MapReduce’ is closed to new topics and replies.

Support from the Experts

A HDP Support Subscription connects you experts with deep experience running Apache Hadoop in production, at-scale on the most demanding workloads.

Enterprise Support »

Become HDP Certified

Real world training designed by the core architects of Hadoop. Scenario-based training courses are available in-classroom or online from anywhere in the world

Training »

Hortonworks Data Platform
The Hortonworks Data Platform is a 100% open source distribution of Apache Hadoop that is truly enterprise grade having been built, tested and hardened with enterprise rigor.
Get started with Sandbox
Hortonworks Sandbox is a self-contained virtual machine with Apache Hadoop pre-configured alongside a set of hands-on, step-by-step Hadoop tutorials.
Modern Data Architecture
Tackle the challenges of big data. Hadoop integrates with existing EDW, RDBMS and MPP systems to deliver lower cost, higher capacity infrastructure.