Sqoop - 尝试连接到 Oracle DB 服务器时获取 java.lang.NullPointerException [英] Sqoop - getting java.lang.NullPointerException when trying to connect to Oracle DB Server

查看:95
本文介绍了Sqoop - 尝试连接到 Oracle DB 服务器时获取 java.lang.NullPointerException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 Sqoop,我尝试连接到 Oracle DB,然后列出可用的数据库.但是当我尝试执行命令时,我收到 java.lang.NullPointerException

Using Sqoop, I am trying to connect to Oracle DB and then list the databases available. But when I try to execute the command, I am getting java.lang.NullPointerException

请找到我得到的命令和异常,如下所述:

Please find the command and the exception that I get as mentioned below:

[hadoop@njpas01 bin]$ ./sqoop list-databases --connect jdbc:oracle:thin@DEVDB1:1521 --username dev_user -P
Warning: $HADOOP_HOME is deprecated.

15/04/01 14:56:24 INFO sqoop.Sqoop: Running Sqoop version: 1.4.5
Enter password:
15/04/01 14:56:35 INFO oracle.OraOopManagerFactory: Data Connector for Oracle and Hadoop is disabled.
15/04/01 14:56:35 INFO manager.SqlManager: Using default fetchSize of 1000
15/04/01 14:56:35 ERROR sqoop.Sqoop: Got exception running Sqoop: java.lang.NullPointerException
java.lang.NullPointerException
        at org.apache.sqoop.manager.OracleManager.listDatabases(OracleManager.java:695)
        at org.apache.sqoop.tool.ListDatabasesTool.run(ListDatabasesTool.java:49)
        at org.apache.sqoop.Sqoop.run(Sqoop.java:143)
        at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:65)
        at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:179)
        at org.apache.sqoop.Sqoop.runTool(Sqoop.java:218)
        at org.apache.sqoop.Sqoop.runTool(Sqoop.java:227)
        at org.apache.sqoop.Sqoop.main(Sqoop.java:236)

没有防火墙问题.可以从我运行 Sqoop 命令的机器访问端口 1521.Oracle 版本 - 11g 企业版.ojdbc6.jar Oracle 连接器放在 Sqoop lib 文件夹中.

There is no firewall issue. The port 1521 is accessible from the machine where I run the Sqoop command. Oracle Version - 11g Enterprise edition. ojdbc6.jar Oracle connector is placed in the Sqoop lib folder.

请告诉我这个问题的原因是什么.我用SQL Server做了类似的操作,成功列出了数据库,将数据从DB导入到HDFS.但是我在 Oracle DB 中遇到了这个问题.请帮忙.

Please let me know what is the cause of this issue. I have done a similar operation with SQL Server and successfully listed the data base, imported the data from DB to HDFS. But I am facing this issue in Oracle DB. Please help.

谢谢.

推荐答案

在尝试使用 sqoop 命令连接到 oracle 数据库时遇到同样的错误.

Faced the same error when trying to connect to oracle database using sqoop command.

在 sqoop 语句中,使用了无法从执行 sqoop 命令的节点访问的主机名.尝试使用以下命令检查您的 oracle 主机是否可访问:

in the sqoop statement , used the hostname which is not reachable from the node where sqoop command is executed. try the below command to check if your host of oracle is reachable:

ping 主机名

如果你得到 ping:Unknown host,那么 sqoop 将不会连接到 oracle 服务器.

if you get ping:Unknown host, then sqoop won't connect to oracle server.

所以在 sqoop 语句中请求使用 IPaddress 并确保下面的命令成功(得到响应)

So request use IPaddress in the sqoop statement and make sure that below command succeeded (got response)

ping IP 地址;

ping IPaddress;

PING 10.xx.xx.xx (10.xx.xx.xx) 56(84) 字节数据.来自 10.xx.xx.xx 的 64 个字节:icmp_seq=1 ttl=128 time=2.39 ms

PING 10.xx.xx.xx (10.xx.xx.xx) 56(84) bytes of data. 64 bytes from 10.xx.xx.xx: icmp_seq=1 ttl=128 time=2.39 ms

更新 ipadress 后,我可以连接到 oracle 数据库.

After updating the ipadress, i was able to connect to oracle database.

sqoop list-tables --connect jdbc:oracle:thin:@10.xx.xxx.xx:1521/dbname--username ur_username --password ur_password

sqoop list-tables --connect jdbc:oracle:thin:@10.xx.xxx.xx:1521/dbname--username ur_username --password ur_password

这篇关于Sqoop - 尝试连接到 Oracle DB 服务器时获取 java.lang.NullPointerException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆