I update project JDK to jdk1.8.144_32bit (from 1.7).
But the following error occurs:
Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class javax.crypto.JceSecurity
at javax.crypto.SecretKeyFactory.nextSpi(SecretKeyFactory.java:295)
at javax.crypto.SecretKeyFactory.<init>(SecretKeyFactory.java:121)
at javax.crypto.SecretKeyFactory.getInstance(SecretKeyFactory.java:160)
at oracle.jdbc.driver.T4C8TTIdty.<init>(T4C8TTIdty.java:517)
at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1603)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:496)
at oracle.jdbc.driver.PhysicalConnection.connect(PhysicalConnection.java:666)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:566)
at org.apache.commons.dbcp2.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:53)
at org.apache.commons.dbcp2.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:279)
at org.apache.commons.dbcp2.BasicDataSource.validateConnectionFactory(BasicDataSource.java:2343)
at org.apache.commons.dbcp2.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:2329)
at org.apache.commons.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:2071)
at org.apache.commons.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:1525)
Then I installed JCE from Oracle download site: https://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html
Nothing change except I'm quite sure that JCE is installed according to such answers: https://stackoverflow.com/a/13238132
In my scenario:
System.out.println(Cipher.getMaxAllowedKeyLength("AES"));
return
2147483647
What's wrong? Why this environment doesn't work correctly?
I'm working with jdk1.8.144 in 32bit version. And Eclipse Oxygen.3a Release (4.7.3a)
I found an answer. It wasn't problem with neither JDK nor Eclipse. Simple answer is:
In our code there is
java.home
variable assigned to custom value.
Explanation:
Variable java.home
points to Java installation directory as said in documentation of System.getProperties(). It is always available.
In normal scenario value of this variable is inferred from JAVA_HOME system variable.
More interesting reading here on SO.
But because of some strange configuration of our computers somebody made a decision to set it manually for local test environment. And it worked until JDK migration when JDK path has changed.
Hints for others:
After JDK upgrade when you are using Eclipse there are several places to check configuration: