Forum: Other

Post: Incompatible magic number.

Incompatible magic number.
vsimurra
Jun 25, 2012
I've been trying to implement a simple app, that will store some flat file data.
I've been able to compile the catalog jar. But when I try to start the database I get
Build: 2.7.1 voltdb-2.7.1-0-gbd9911a Community Edition
Connecting to VoltDB cluster as the leader...
ERROR: Thread Thread[Site 0:1,5,main] died
java.lang.ClassFormatError: Incompatible magic value 4022320623 in class file com/otcmarkets/bfd/db/procs/InsertFile
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.lang.ClassLoader.defineClass(ClassLoader.java:465)
at org.voltdb.utils.InMemoryJarfile$JarLoader.loadClass(InMemoryJarfile.java:244)
at org.voltdb.CatalogContext.classForProcedure(CatalogContext.java:169)
at org.voltdb.LoadedProcedureSet.loadProceduresFromCatalog(LoadedProcedureSet.java:94)
at org.voltdb.LoadedProcedureSet.loadProcedures(LoadedProcedureSet.java:73)
at org.voltdb.ExecutionSite.(ExecutionSite.java:733)
at org.voltdb.ExecutionSite.(ExecutionSite.java:668)
at org.voltdb.ExecutionSiteRunner.run(ExecutionSiteRunner.java:67)
at java.lang.Thread.run(Thread.java:662)
ERROR: Thread Thread[main,5,main] died
java.lang.ClassFormatError: Incompatible magic value 4022320623 in class file com/otcmarkets/bfd/db/procs/InsertFile
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.lang.ClassLoader.defineClass(ClassLoader.java:465)
at org.voltdb.utils.InMemoryJarfile$JarLoader.loadClass(InMemoryJarfile.java:244)
at org.voltdb.CatalogContext.classForProcedure(CatalogContext.java:169)
at org.voltdb.LoadedProcedureSet.loadProceduresFromCatalog(LoadedProcedureSet.java:94)
at org.voltdb.LoadedProcedureSet.loadProcedures(LoadedProcedureSet.java:73)
at org.voltdb.ExecutionSite.(ExecutionSite.java:733)
at org.voltdb.ExecutionSite.(ExecutionSite.java:668)
at org.voltdb.RealVoltDB.initialize(RealVoltDB.java:518)
at org.voltdb.VoltDB.initialize(VoltDB.java:659)
at org.voltdb.VoltDB.main(VoltDB.java:643)

The verision of java I'm using is java version "1.6.0_32"
Java(TM) SE Runtime Environment (build 1.6.0_32-b05)
Java HotSpot(TM) 64-Bit Server VM (build 20.7-b02, mixed mode) on a linux box running centos.
Also my app jar was built on a mac using ava(TM) SE Runtime Environment (build 1.6.0_31-b04-415-11M3635)
Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01-415, mixed mode) I get the same error in I build the catalog on the mac.


thanks


vin
Magic number
rbetts
Jun 26, 2012
Google seems to think this error means the jar file is corrupt?


I'm a little confused by your last comment - Do you have two jars? An app jar and a catalog jar? What's the app jar? Can you share the corrupt catalog.jar with me/us? You can email me at

rbetts@voltdb.com.
Thanks,
Ryan.
I am having the same problem.
snark
Oct 29, 2012
I am having the same problem. Here is what I found out: when you compile your catalog with voltcompiler and specify the directory with your .class files as the classpath, everything works fine. However, if you use a JAR file (with the same .class files inside), the server gives this error at startup. I am looking at the source code to figure out why that happens, but apparently there's some classloader issue here.


Vlad.
naishe
Feb 1, 2013
--- deleted dupe ---
Exact steps to get rid of this error
naishe
Feb 1, 2013
@snark's answer helped. But this is a pain in neck. Just to note down the exact steps to help anyone looking for this solution. I use Maven and this is what I do:

1. I keep my SQL files in main/resources/voltdb
2. My queries go in bcc.voltdb.*
3. I generate jar with dependencies which has all the Jars, including those of voltdb: client jar and voltdb.jar.

I get the "Incompatible magic number".

I then have to do these painful steps:

#compile:
voltdb compile --classpath="./:/home/goldie/apps/voltdb/lib/*:/home/goldie/apps/voltdb/voltdb/*:/home/goldie/workspace/bcc/voltDBLoadTest/loadTests/target/classes/" -o twitter.jar src/main/resources/voltdb/twitter.sql

#set classpath
export CLASSPATH="./:/home/goldie/apps/voltdb/lib/*:/home/goldie/apps/voltdb/voltdb/*:/home/goldie/workspace/bcc/voltDBLoadTest/loadTests/target/classes/"

#create catalogue
voltdb create catalog twitter.jar host localhost