-
Notifications
You must be signed in to change notification settings - Fork 29
Use of different JDKs for development vs production #181
Description
Summary
I ran into an interesting problem when using the java-microprofile stack. My application uses a database. It worked perfectly fine when running the development image on my laptop. When I used the production image, it completely broke. Every database request failed.
[ERROR ] CWWJP9992E: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.7.4.v20190115-ad5b7c6b2a): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: SSL error: Received fatal alert: handshake_failure DSRA0010E: SQL State = 08006, Error Code = 0
Error Code: 0
The problem was due to a difference in the SSL implementation in the OpenJDK used by the development image vs. the IBM JDK used by the production image. Specifically the IBM JDK requires a property to be set to match the behavior of other JDKs when getting an SSLContext.
Luckily I spotted the difference in JDK implementations immediately and suspected that was the issue. Someone else who is not experienced may not be aware of the role the JDK plays in this and might be puzzled by this and spend a lot of time trying to solve the issue.
In fact my first reaction (and the reaction of someone else on my team) was "it works on my machine, why isn't it working on our cluster [where we were running the production image]?"
I think the use of different JDKs for development and production violates a basic principal of container-based development. To quote from the 12-factor app document
"A twelve-factor app never relies on implicit existence of system-wide packages. It declares all dependencies, completely and exactly, via a dependency declaration manifest. Furthermore, it uses a dependency isolation tool during execution to ensure that no implicit dependencies “leak in” from the surrounding system. The full and explicit dependency specification is applied uniformly to both production and development."