JDBC downgraded to older version but still facing UnsupportedClassVersionError

Solved!
daniel_adornes
Level 3
JDBC downgraded to older version but still facing UnsupportedClassVersionError

This is a solved problem worth sharing with the community and a potential opportunity for evolving DSS.

I had a database driver for jre11 under my DATA_DIR/lib/jdbc/ directory. I was able to successfully deploy an API Service to Kubernetes cluster (thus based on the api-deployer base image), but when querying an enrichment endpoint (which needed to connect to the database) the request failed with an error like this:

java.lang.UnsupportedClassVersionError: com/microsoft/sqlserver/jdbc/SQLServerDriver has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0

I tried many things that didn't solve it:

  • Replace the jar file for a jre8 version
  • Downgrade my Design Node's Java version (from 11 to 8), which didn't really make sense, since the error was in the Docker container built from the Docker base image, which in turn basically runs as an isolated new VM in the Kubernetes cluster.
  • Deleted my Docker images (all of them) and rebuilt all of them again, pushing them again to my remote image repository.

Though I did all of these steps described above, when I built my deployment I could still see in the logs the old jar being included (!!!!). Even after rebuilding all the Docker images and redeploying the API Service several times.

What SOLVED the problem:

There was a temporary/cached directory under `DATA_DIR/tmp/api_deployer/name-of-my-deployment/dockerbuildcontext/lib-jdbc/` 

I deleted the root folder `DATA_DIR/tmp/api_deployer/name-of-my-deployment` and redeployed my API Service and the jre11 jar file was no more there, FINALLY 🙂 

My Conclusion 

Maybe if a jar file is upgrade under lib/jdbc, the cached/tmp files won't be a problem because the latest version of the jar will prevail in runtime. However, if you are trying to downgrade a jar file (maybe due to an error like `UnsupportedClassVersionError` ) you will need to delete that.

Also, maybe these tmp files should be discarded automatically, when the base images are rebuilt. Somehow, this cached data seems to be useful in some aspects but prone to errors like this.

1 Solution
CoreyS
Dataiker Alumni

Hey @daniel_adornes thank you for sharing your observation, solution, and suggestion. We appreciate your desire to share your knowledge with the rest of us!

If you think it warrants it, I would suggest proposing the potential opportunity to evolve DSS you identify as a Product Idea. Thanks again!

Looking for more resources to help you use Dataiku effectively and upskill your knowledge? Check out these great resources: Dataiku Academy | Documentation | Knowledge Base

A reply answered your question? Mark as ‘Accepted Solution’ to help others like you!

View solution in original post

0 Kudos
3 Replies
CoreyS
Dataiker Alumni

Hey @daniel_adornes thank you for sharing your observation, solution, and suggestion. We appreciate your desire to share your knowledge with the rest of us!

If you think it warrants it, I would suggest proposing the potential opportunity to evolve DSS you identify as a Product Idea. Thanks again!

Looking for more resources to help you use Dataiku effectively and upskill your knowledge? Check out these great resources: Dataiku Academy | Documentation | Knowledge Base

A reply answered your question? Mark as ‘Accepted Solution’ to help others like you!
0 Kudos
daniel_adornes
Level 3
Author

Hey @CoreyS ! You're welcome! I didn't know about this "Product Ideas" page.. This is great! I'll post my case there.

Thank you

Daniel

 

0 Kudos
daniel_adornes
Level 3
Author

Hey @CoreyS ! I just created the Product Idea there: https://community.dataiku.com/t5/Product-Ideas/Error-when-downgrading-JDBC-driver-for-API-Services/i...

Thank you for the suggestion!

Cheers,

Daniel