Could not initialize class javax.crypto.SunJCE_b

Connectivity

Could not initialize class javax.crypto.SunJCE_b

Hi,

I am trying to connect to TeraData from R.

RStudio v0.96 (R v2.15.1)

JDBC v14.00.00.21

JDK v1.7.0_07

Mac v10.7.4

...

library(DBI)

library(RJDBC)

library(rJava)

jdrv <- JDBC(driverClass="com.teradata.jdbc.TeraDriver", classPath="/System/Library/Frameworks/JavaVM.framework/Home/lib/jce.jar:terajdbc4.jar:tdgssconfig.jar")

conn = dbConnect(drv=jdrv,"jdbc:teradata://DBServer/TMODE=ANSI,CHARSET=UTF8",user="user",password="password",dbname="DBName")

....

I get the following error.

I tried without jce.jar in classpath and again with (see above).  Either way, I get the following error. any help ?!


Error in .jcall(drv@jdrv, "Ljava/sql/Connection;", "connect", as.character(url)[1],  : 

  com.teradata.jdbc.jdbc_4.util.JDBCException: [Teradata JDBC Driver] [TeraJDBC 14.00.00.21] [Error 1014] [SQLState HY000] TeraEncrypt: Error tdgss-stack-trace-begin>>> java.lang.NoClassDefFoundError: Could not initialize class javax.crypto.SunJCE_b

at javax.crypto.KeyGenerator.a(DashoA13*..)

at javax.crypto.KeyGenerator.<init>(DashoA13*..)

at javax.crypto.KeyGenerator.getInstance(DashoA13*..)

at com.teradata.tdgss.jalgapi.AlgParcel.isKeySupported(Unknown Source)

at com.teradata.tdgss.jalgapi.AlgParcel.getCipherSuitesParcel(Unknown Source)

at com.teradata.tdgss.jgssp2td2.Td2Context.BuildInitMsg(Unknown Source)

at com.teradata.tdgss.jgssp2td2.Td2Context.initSecContext(Unknown Source)

at com.teradata.tdgss.jtdgss.TdgssContext.initSecContext(Unknown Source)

at com.teradata.jdbc.jdbc.GenericTeraEncrypt.initSecContext(GenericTeraEncrypt.java:454)

at com.teradata.jdbc.jdbc.GenericLogonController.run(GenericLogonController.java:260)

at com.teradata.jdbc.jdbc_4.TDSession.<in

Tags (3)
5 REPLIES

Re: Could not initialize class javax.crypto.SunJCE_b

The correct version of jce.jar - /Library/Java/Home/lib/jce.jar:

Still, I see the same error.

Teradata Employee

Re: Could not initialize class javax.crypto.SunJCE_b

Googling "Could not initialize class javax.crypto.SunJCE_b" returns many results, with different suggestions for how to fix the problem. I recommend that you try some of the suggestions.

Re: Could not initialize class javax.crypto.SunJCE_b

Thank you for your suggestion, Tom.

I had the, Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files 7.

http://www.oracle.com/technetwork/java/javase/downloads/jce-7-download-432124.html

So, reverted back to the JCE that came default with installation. Fixed this issue.

Re: Could not initialize class javax.crypto.SunJCE_b

Final steps:

> library(RJDBC)

> jdrv <- JDBC(driverClass="com.teradata.jdbc.TeraDriver", classPath="~/mydrivers/td/terajdbc4.jar:~/mydrivers/ td/tdgssconfig.jar")

> conn <- dbConnect(jdrv,"jdbc:teradata://TDServer/ TMODE=ANSI,CHARSET=UTF8,uid=tduser,pwd=passwd")

Teradata Employee

Re: Could not initialize class javax.crypto.SunJCE_b

That JDBC URL is not correct.

Beginning with Teradata JDBC Driver version 14.00.00.13, the USER and PASSWORD URL parameters are available, but there are no "uid" or "pwd" URL parameters.