Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Sqoop Connect to DB with Truststore

avatar
Contributor

Hello,

I am trying to access a VIrtual Database from JBoss Data Virtualization using Sqoop. This database is defined to connect using a Truststore (JKS format), using another application like Squirrel i can connect using the following argument:

	-Djavax.net.ssl.trustStore=/home/user/truststore-xxxxx.jks

Does anyone knows how can I use this argument with Sqoop?

Ps.: I already deploy my .jar file on $SQOOP_HOME/lib.

1 ACCEPTED SOLUTION

avatar
Super Guru

@Washington Nascimento

Try with below two commands.

export HADOOP_OPTS=" -Djavax.net.ssl.trustStore=/home/user/truststore-xxxxx.jks"

OR

sqoop import -Dmapred.child.java.opts=" -Djavax.net.ssl.trustStore=/home/user/truststore-xxxxx.jks"

View solution in original post

6 REPLIES 6

avatar
Super Guru

@Washington Nascimento

Try with below two commands.

export HADOOP_OPTS=" -Djavax.net.ssl.trustStore=/home/user/truststore-xxxxx.jks"

OR

sqoop import -Dmapred.child.java.opts=" -Djavax.net.ssl.trustStore=/home/user/truststore-xxxxx.jks"

avatar
Super Guru

@Washington Nascimento Thanks for confirming. Please accept the answer to close this thread.

avatar
Contributor

Hello Jitendra Yadav

The solution was great, the first one (export... HADOOP_OPTS...) worked for me!

Thanks

avatar
Contributor

Hello,

Now the problem is the following error:

Error: java.lang.RuntimeException: java.lang.RuntimeException: org.teiid.jdbc.TeiidSQLException: TEIID20020 Error establishing socket to host and port: xxxx.hostname:port. Reason: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
        at org.apache.sqoop.mapreduce.db.DBInputFormat.setConf(DBInputFormat.java:167)
        at org.apache.hadoop.util.ReflectionUtils.setConf(ReflectionUtils.java:76)
        at org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:136)
        at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:749)
        at org.apache.hadoop.mapred.MapTask.run(MapTask.java:341)
        at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:164)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.security.auth.Subject.doAs(Subject.java:415)
        at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1657)
        at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:158)

We tried to put the enviroment variable on all slave/master nodes like the following commando on /etc/profile ... /etc/bashrc

export HADOOP_OPTS="-Djavax.net.ssl.trustStore=/home/user/truststore.jks"

But unfortunately the error persists.

Thanks

avatar
Super Guru

So is that the same exception you got initally?

avatar
Contributor

Hello,

It worked fine now, the first solution worked connected to the database, but when Sqoop was running Map Reduce, the same error occurred. This way all Map Reduce agents have this configuration.

So the solution is configure the TrustStore parameter on Map Reduce Configuration inside Ambari

4902-ambari-erietp-google-chrome-4.png

The value:

-Djavax.net.ssl.trustStore=/home/user/truststore.jks

Thank you