Hi. Does anyone know what could be causing this er...
# cfml-general
e
Hi. Does anyone know what could be causing this error? “Incompatible magic value 0 in class file com/mysql/cj/jdbc/Driver” We are using Lucee and MySQL driver v8.1.0. It suddenly started happening and we have to restart the server.
t
so it clears up after you restart the server?
e
Yes. Some times it happends just after starting the lucee container
d
As a longshot possibility, try clearing your class files. Not sure if that's a Lucee thing, but it is on Adobe, and search results for that phrase are talking mostly about compiling on a different jvm version that you're using to run the code. Could be a class files anomaly.
t
other googling indicates this resolved the issue for others but not sure the root cause
CJException.class
e
This is strange because sometimes the error happends just after creating the container. It runs on AWS ECS
b
I wonder if you have Lucee auto-downloading any bundles behind the scenes
You could crank up the level of your deploy log and check it to confirm
Or disable Lucee's auto-download behavior with the java system property
That could possibly explain differing behaviors
e
The container is using commandbox default params
b
I've seen the magic number of 0 before and I want to say it's usually a corrupt or empty class file, which could be • a full hard drive • permissions • gremlins in Lucee's extraction of bundles, which is code riddled with try/catches that swallow most errors
You could try and track down the OSGI bundle that has that class file to look for clues too
Does the bottom of the stack trace have a "caused by" exception with any additional information on the specific class file and where it was at?
Copy code
The "magic value" of a Java class file is the first four bytes of the file. In a valid class file, these bytes are always 0xCAFEBABE. This is a hexadecimal number, and it's used by the Java Virtual Machine (JVM) to recognize class files.

If the magic value is 0, it means the first four bytes of the file are all zeroes. This is not valid for a Java class file, and it typically indicates that the file is not actually a class file, or that it's been corrupted.
And to be clear, the class in question is not going to be in Lucee's cfclasses directory. It's going to be in the JDBC driver jar
e
The error is just happening when using cfquery on mysql
b
That doesn't really change any of my suggestions
e
Thank you, I’ll look into this
Caused by: java.lang.ClassFormatError: Incompatible magic value 0 in class file com/mysql/cj/jdbc/Driver