Details
Description
After running command below:
sqoop codegen --connect jdbc:mysql://localhost/sqoop_test --username root --password xxxxx --table foo -outdir foobar
Sqoop outputs like this:
11/04/10 16:17:37 WARN tool.BaseSqoopTool: Setting your password on the command-line is insecure. Consider using -P instead.
11/04/10 16:17:37 INFO tool.CodeGenTool: Beginning code generation
11/04/10 16:17:37 INFO manager.MySQLManager: Executing SQL statement: SELECT t.* FROM `foo` AS t LIMIT 1
11/04/10 16:17:38 INFO manager.MySQLManager: Executing SQL statement: SELECT t.* FROM `foo` AS t LIMIT 1
11/04/10 16:17:38 INFO orm.CompilationManager: HADOOP_HOME is /home/angus/src/hadoop
Note: /tmp/sqoop-angus/compile/c57bf5a7ba52d0e86dc9809fbb6417d1/foo.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
11/04/10 16:17:40 ERROR orm.CompilationManager: Could not rename /tmp/sqoop-angus/compile/c57bf5a7ba52d0e86dc9809fbb6417d1/foo.java to /home/angus/foobar/foo.java
11/04/10 16:17:40 INFO orm.CompilationManager: Writing jar file: /tmp/sqoop-angus/compile/c57bf5a7ba52d0e86dc9809fbb6417d1/foo.jar
It shows that CompilationManager fails to rename foo.java. Then I changed permission of the "foobar" directory to 777, but with no luck. And the failure might be caused by the call to File.renameTo. After replacing the call with FileUtils.moveFile in commons-io, it works. (LocalFileSytem.rename in Hadoop works as well).