orm.compilationmanager问题:spring中的java编译错误

nxagd54h  于 2021-05-29  发布在  Hadoop
关注(0)|答案(1)|浏览(501)

我已经安装了hadoop2.6.0,hbase 0.98.12.1-hadoop2和sqoop1.4.6。当我使用简单的java程序运行这个程序时,它工作正常,但是当我运行spring程序时,它会给出错误
代码:java文件

String[] cmd = {
            "import",
            "-Dsqoop.hbase.add.row.key=true",
            "--connect",
            "jdbc:mysql://hostname:3306/dbname",
            "--username",
            "username",
            "--password",
            "passowrd",
            "--table",
            "Mysql table name",
            "--hbase-table",
            "Hbase table name",
            "--column-family",
            "family name",
            "--columns",
            "Columns names",
            "--hbase-row-key",
            "Key values for Hbase",             
            "--hbase-create-table", "-m", "1" };

    Sqoop.runTool(cmd,config);

在sqoopcontroller中使用相同的代码:
运行spring时的日志文件:

Sqoop Processing
        2015-07-23 09:32:23,370 INFO  [http-bio-8080-exec-8] Configuration.deprecation (Configuration.java:warnOnceIfDeprecated(1049)) - fs.default.name is deprecated. Instead, use fs.defaultFS
       2015-07-23 09:32:23,420 WARN  [http-bio-8080-exec-8] tool.SqoopTool (SqoopTool.java:loadPluginsFromConfDir(177)) - $SQOOP_CONF_DIR has not been set in the environment. Cannot check for additional configuration.
        2015-07-23 09:32:23,457 INFO  [http-bio-8080-exec-8] sqoop.Sqoop (Sqoop.java:<init>(92)) - Running Sqoop version: 1.4.6
        2015-07-23 09:32:23,469 WARN  [http-bio-8080-exec-8] tool.BaseSqoopTool (BaseSqoopTool.java:applyCredentialsOptions(1021)) - Setting your password on the command-line is insecure. Consider using -P instead.
        2015-07-23 09:32:23,479 WARN  [http-bio-8080-exec-8] sqoop.ConnFactory (ConnFactory.java:loadManagersFromConfDir(273)) - $SQOOP_CONF_DIR has not been set in the environment. Cannot check for additional configuration.
        2015-07-23 09:32:23,648 INFO  [http-bio-8080-exec-8] manager.MySQLManager (MySQLManager.java:initOptionDefaults(69)) - Preparing to use a MySQL streaming resultset.
        2015-07-23 09:32:23,649 INFO  [http-bio-8080-exec-8] tool.CodeGenTool (CodeGenTool.java:generateORM(92)) - Beginning code generation
        2015-07-23 09:32:23,959 INFO  [http-bio-8080-exec-8] manager.SqlManager (SqlManager.java:execute(757)) - Executing SQL statement: SELECT t.* FROM `MODELING3` AS t LIMIT 1
        2015-07-23 09:32:24,004 INFO  [http-bio-8080-exec-8] manager.SqlManager (SqlManager.java:execute(757)) - Executing SQL statement: SELECT t.* FROM `MODELING3` AS t LIMIT 1
        2015-07-23 09:32:24,010 INFO  [http-bio-8080-exec-8] orm.CompilationManager (CompilationManager.java:findHadoopJars(85)) - $HADOOP_MAPRED_HOME is not set
        /tmp/sqoop-sunplus/compile/84aa64d558f0617e0c6a33d5475d8b9d/MODELING3.java:7: error: package org.apache.hadoop.io does not exist
        import org.apache.hadoop.io.BytesWritable;
/tmp/sqoop-sunplus/compile/84aa64d558f0617e0c6a33d5475d8b9d/MODELING3.java:37: error: cannot access Writable
public class MODELING3 extends SqoopRecord  implements DBWritable, Writable {
pod7payv

pod7payv1#

首先,请注意,sqoop1没有任何公开支持的api。如果您选择自己调用sqoop.runtool,您可能会看到很多麻烦。sqoop2纠正了这一点,并添加了对公共api的支持。
在我看来,当通过spring执行时,您可能没有类路径上所有必需的依赖项。你有没有比较过独立运行和spring运行时sqoop的类路径?

相关问题