What is the Kerberos method? - java

I'm trying to connect to hive with jdbc. I keep getting this error. I tried looking it up but could not hind anything useful .
This is my connection string:
jdbc:hive2://hostname.xxx.com:10000/default;principal=hive/hostname.xxx.com#HADOOP_ENV.COM
What is this error: java.lang.NoSuchMethodError: org.apache.hadoop.security.authentication.util.KerberosUtil.hasKerberosTicket(Ljavax/security/auth/Subject;)Z

That method exists in Hadoop 2.8 but not in Hadoop 2.7 -- so my guess is that your project dependencies are not aligned with whatever version of Hadoop you have in Production.
Code in trunk
https://github.com/apache/hadoop/blob/trunk/hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/util/KerberosUtil.java
code in branch-2.8.0
https://github.com/apache/hadoop/blob/branch-2.8.0/hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/util/KerberosUtil.java
code in branch-2.7.4
https://github.com/apache/hadoop/blob/branch-2.7.4/hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/util/KerberosUtil.java

Kerberos is an authentication protocol that is used by Hive server (https://en.wikipedia.org/wiki/Kerberos_(protocol))
The problem you are setting is more about a missing library in our pom.xml. Have you include <artifactId>hive-jdbc</artifactId> ?

I think your keberos ticket is not generated properly
Can you try running these two commands in order from the user you are trying to connect:
kdestroy (deleted any kerberos ticket generated before)
kinit (generates a new ticket)
Then try to connect again.

Related

Could not create File Client. Mismatch found for java and native libraries java build version

I am trying to access mapr path remotely, using a spring boot application. I have set the fs.mapr.bailout.on.library.mismatch property to false, to avoid the error on version mismatch. Still whenever the getFileStatus() function gets called, the application stops with the following error:
2020-12-15 10:07:18,7377 ERROR JniCommon fs/client/fileclient/cc/jni_MapRClient.cc:691 Thread: 123145425235968 Mismatch found for java and native libraries java build version 6.0.1.20180404222005.GA, native build version 6.0.1.20190808152212.GA java patch vserion $Id: mapr-version: 6.0.1.20180404222005.GA 1aeeb6d3c17c777fcba0, native patch version $Id: mapr-version: 6.0.1.20190808152212.GA 1aeeb6d3c17c777fcba0
2020-12-15 10:07:18,7378 ERROR JniCommon fs/client/fileclient/cc/jni_MapRClient.cc:708 Thread: 123145425235968 Client initialization failed.
Code:
FileSystem fileSystem = FileSystem.newInstance(new Configuration());
Configuration conf = fileSystem.getConf();
conf.set("fs.mapr.bailout.on.library.mismatch", "false");
Path OffsetPath = new Path(filePath);
FileStatus file = fileSystem.getFileStatus(filePath); ====> This statement gives error
hbase dependencies used:
<dependency>
<groupId>com.mapr.fs</groupId>
<artifactId>mapr-hbase</artifactId>
<version>6.0.1-mapr</version>
</dependency>
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-client</artifactId>
<version>1.1.8-mapr-1710</version>
</dependency>
How can I correct this?
So it isn't a great idea to just disable the version mismatch error. Some mismatch is OK for some tasks, but some mismatch can be fatal.
To say much more, it would be helpful to have a little bit of clarification.
when you say remote access, are you talking from one cluster to another? Or from a client machine that is outside the cluster?
assuming that you mean the second case (client outside the cluster), what did you install on the client machine?
why did you disable the version mismatch? What versions are you worried will not match?
does the POSIX interface or the local loopback NFS work from the problem node?
does the hadoop shell work from the problem node?

What version of sqljdbc do I require?

I am running in to an issue with my application where I get the error.
The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: "SQL Server returned an incomplete response."
I have looked and the only difference on my new server is version of SQL which leads me to think I have the wrong version of SQLJDBC4.jar
I have been looking for a version that works with Java version 1.6.0_27 and MS SQL Sever 2017
Does anyone have any suggestions of what version of this JAR I require?
Please try to add the "sqljdbc42-0.jar" file to your build path.
Try the following link if it is maven project, else download the jar from any trusted url.
https://mvnrepository.com/artifact/com.microsoft.sqlserver/sqljdbc42/6.0.8112

Impala driver class not being found through Jaydebeapi Connection

I recently switched over from using a PC to a Mac and now for whatever reason one of my Impala drivers that worked fine is no longer found when run in Python. I keep receiving this error every time I run the script : "java.lang.RuntimeException: Class com.cloudera.impala.jdbc41.Driver not found". Please see code snippet for my connection below.
c = jaydebeapi.connect
(jclassname='com.cloudera.impala.jdbc41.Driver',
url='jdbc:impala://cloudera-impala-proxy.live.bi.xxx/;AuthMech=3;ssl=1;',
driver_args=['xxx', self.dwh_password], jars='/Users/xxx/Desktop/ImpalaJDBC41 2.jar')
Any help or suggestions are appreciated, I feel like I'm going crazy trying to get this to work.
Did you check do you have the ImpalaJDBC***.jar in your new machine.
Please check properly weather it's available at classpath/build path or not.
Edit:
You can use hive jdbc jar as well to connect with impala , just use the port of impala rather hive in jdbc url.
Looking at this error means your jar is corrupt.
First check your impalaJDBC jar
java -jar ImpalaJDBC<version>.jar
If it gives you error that means your jar is corrupt.
Download the correct jar from cloudera

Problems with jCifs authentication on oracle RDMS embedded jvm

I'm using jCifs 1.3.17 to connect and list files on remote windows share.
Everything works fine on my local JRE(5,6,7), but the same code executed on oracle 11g database (11.2.0.3.0) crashes with following stack:
jcifs.smb.SmbAuthException: Logon failure: unknown user name or bad
password. at
jcifs.smb.SmbTransport.checkStatus(SmbTransport.java:546) at
jcifs.smb.SmbTransport.send(SmbTransport.java) at
jcifs.smb.SmbSession.sessionSetup(SmbSession.java) at
jcifs.smb.SmbSession.send(SmbSession.java:218) at
jcifs.smb.SmbTree.treeConnect(SmbTree.java:176) at
jcifs.smb.SmbFile.doConnect(SmbFile.java:911) at
jcifs.smb.SmbFile.connect(SmbFile.java:954) at
jcifs.smb.SmbFile.connect0(SmbFile.java:880) at
jcifs.smb.SmbFile.exists(SmbFile.java) at
pl.openlife.CifsConnect.listCIFSFiles(CifsConnect.java:49)
I found out, that user password lenght might cause the problem:
1. Windows env jdk1.5.0_22 -> works with long passwords
2. Oracle linux, RDMS embeded JVM -> works with short password only (8 characters)
3. Oracle linux, RDMS embeded JVM -> long password fails with error shown above.
Sample code:
NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication(domain,
username,
password);
SmbFile dir = new SmbFile(path,auth);
if(!dir.exists()){
// ABOVE CHECK FAILS
}
I heard somewhere about problems with oracle embedded jvm and bugs in JCE, but this shouldn't be the case, as jcifs have its own implementation of algorithms such as RC4 or DES. Does anyone have a clue what can be the case? Is there a way to walk this around?
Unfortunately I didn't find any answer to the issue mentioned above.
As a walkaround, I have used older version of jcifs (jcifs-1.2.25), which seems to work properly with oracle db embedded jvm.
UPDATE:
I have imported jcifs lib again (1.3.17) and it is working like a charm. I ended up with conclusion, that the java library was not imported properly. Reimport (loadjava) with option "-force" and manual compilation of invalid objects solves the problem always, but (I cant't figure why) in my case it must be loaded in following order :
1. Load my program lib (will cause errors)
2. Load jcifs lib with force option
3. compile and resolve
It seems that oracle jvm is unpredictable :)

Firebird connection with java

I have installed Firebird 2.1 on windows Xp and using firebirdsql.jdbc-2.1.6 driver to connect with java. Code:
Class.forName("org.firebirdsql.jdbc.FBDriver");
connection = DriverManager.getConnection(
"jdbc:firebirdsql://localhost/3050//C:/firebird/database/EMPLOYEE.FDB",
"test","test");
I am getting following error:
Caused by: org.firebirdsql.jdbc.FBSQLException: GDS Exception. 335544375.
unavailable database
Reason: unavailable database at
org.firebirdsql.jdbc.FBDataSource.getConnection(FBDataSource.java:122) at
org.firebirdsql.jdbc.FBDriver.connect(FBDriver.java:140) at
java.sql.DriverManager.getConnection(DriverManager.java:525) at
java.sql.DriverManager.getConnection(DriverManager.java:171)
Please help.
Problem solved:
Actually I had problem with jar file that I got from
http://mirrors.ibiblio.org/pub/mirrors/maven2
I downloaded jaybird-full-2.1.6.jar from firebird offical website and problem got solved.
Correct URL is
"jdbc:firebirdsql://localhost:3050/C:\\firebird\\database\\EMPLOYEE.FDB"
I tried this URL earlier also but it was not working beacuse of jar issue.
As #Thorbjørn Ravn Andersen observes, your Jaybird JDBC URL is incorrect. The syntax is jdbc:firebirdsql:[host[/port]:]<database>. You need a colon between the host/port and the database path. Perhaps something like this:
"jdbc:firebirdsql://localhost/3050:C:\\firebird\database\EMPLOYEE.FDB"
Oops, I left in the leading slashes; try this:
"jdbc:firebirdsql:localhost/3050:C:\\firebird\database\EMPLOYEE.FDB"
Addendum: You might run through the common errors list. Also, my firebird database files end in .fdb, but the FAQ mentions .gdb. It can't hurt to check.
From https://www.firebirdsql.org/file/documentation/drivers_documentation/java/faq.html#pure-java-default
Default URL format:
"jdbc:firebirdsql://host[:port]/<database>"
Deprecated, but still supported legacy URL format:
"jdbc:firebirdsql:host[/port]:<database>"
Then, the correct URL should be:
"jdbc:firebirdsql://localhost:3050/C:/firebird/database/EMPLOYEE.FDB"
Your URL is most likely broken for this driver.
Attach actual source to the jar and set a breakpoint in FBDataSource.getConnection(...) and see what values are actually present when the connection is attempted made.
Are you absolutely certain that the combination of a hostname with port agrees with a path to the FDB-file?
Looking at the documentation on this site:
http://www.firebirdsql.org/file/documentation/drivers_documentation/java/faq.html, item 3.1
It seems that after the [port], you must have an slash "/" or double slash "//" in case you would connect on a linux server.
To connect to the database located on remote machine or cloud (linux) then use following link.
jdbc:firebirdsql:34.212.208.251/3050:/opt/app/db/sample_training.fdb
You should try this one. It works for me on Windows.
jdbc:firebirdsql://localhost:3050/C:\firebird\database\EMPLOYEE.FDB
Also make sure you added an exception for port 3050 to the Firewall.
Connection string example for Apache Tomcat properties.xml with specified IP, port, data base alias and encoding:
<entry key="db.url">jdbc:firebirdsql:127.0.0.1/2222:my-db-alias?lc_ctype=WIN1251</entry>

Categories