Forum: Building VoltDB Applications

Post: ClassNotFoundException trying to start server

ClassNotFoundException trying to start server
sybrandy
Aug 19, 2013
Hello,

I'm getting a strange ClassNotFoundException trying to start a server with a new stored procedure that I wrote. Compilation works fine as does creating the JAR file, but when I do a "voltdb create ...", I get this exception after a couple seconds. I opened up and checked the JAR file to ensure that the class is there and it is. The package name is correct as well.

Is there anything else I should check? I've been staring at this for an our or so without any clue as to why this is occurring.

The full exception looks like this:

java.lang.NoClassDefFoundError: foo.bar.class$1
        at java.lang.Class.getDeclaredConstructors0(Native Method)
        at java.lang.Class.privateGetDeclaredConstructors(Class.java:2444)
        at java.lang.Class.getConstructor0(Class.java:2754)
        at java.lang.Class.newInstance0(Class.java:345)
        at java.lang.Class.newInstance(Class.java:327)
        at org.voltdb.LoadedProcedureSet.loadProceduresFromCatalog(LoadedProcedureSet.java:115)
        at org.voltdb.LoadedProcedureSet.loadProcedures(LoadedProcedureSet.java:74)
        at org.voltdb.iv2.BaseInitiator.configureCommon(BaseInitiator.java:170)
        at org.voltdb.iv2.SpInitiator.configure(SpInitiator.java:109)
        at org.voltdb.RealVoltDB.initialize(RealVoltDB.java:611)
        at org.voltdb.VoltDB.initialize(VoltDB.java:898)
        at org.voltdb.VoltDB.main(VoltDB.java:882)
Caused by: java.lang.ClassNotFoundException: foo.bar.class$1
        at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
        at org.voltdb.utils.InMemoryJarfile$JarLoader.loadClass(InMemoryJarfile.java:254)
sybrandy
Aug 19, 2013
Nevermind. I figured it out. I was using the double-brace initialization to initialize a list and it was creating "class$1" which was not imported into VoltDB.