Forum: Building VoltDB Applications

Post: Problem compiling stored procedures

Problem compiling stored procedures
jjmartinez
Jan 31, 2013
Dear all,

I develop a stored procedure (AddConnections) into a Java package. The package of this class is com.mycompany.dbconnection. When I compile this class with javac, it creates a .class into the class path bin/com/mycompany/dbconnection/

Into myFile.sql I add the next line: CREATE PROCEDURE FROM CLASS AddConnections;

Then I compile with the command: sudo voltdb compile --classpath "./bin/com/mycompany/dbconnection/" -o myFile.jar myFile.sql
(I compile from one folder and into this folder there is the folder called "bin")

I'm using the last version of VoltDB (voltdb3.0)

And it sends me the next error:

Exception in thread "main" java.lang.NoClassDefFoundError: AddConnections (wrong name: com/mycompany/dbconnection/AddConnections)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:787)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:447)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:186)
at org.voltdb.compiler.ProcedureCompiler.compileJavaProcedure(ProcedureCompiler.java:148)
at org.voltdb.compiler.ProcedureCompiler.compile(ProcedureCompiler.java:71)
at org.voltdb.compiler.VoltCompiler.compileDatabaseNode(VoltCompiler.java:804)
at org.voltdb.compiler.VoltCompiler.compileXMLRootNode(VoltCompiler.java:577)
at org.voltdb.compiler.VoltCompiler.compileCatalog(VoltCompiler.java:545)
at org.voltdb.compiler.VoltCompiler.compileInternal(VoltCompiler.java:395)
at org.voltdb.compiler.VoltCompiler.compileFromDDL(VoltCompiler.java:332)
at org.voltdb.compiler.VoltCompiler.main(VoltCompiler.java:1452)
ERROR: Command "/usr/bin/java ..." failed with return code 256
"


Can anyone help me? Thanks in advance

Best Regards, Jesús.
jjmartinez
Feb 1, 2013
Thanks to John Hugg, we've fixed the error

There was a problem with the classpath: On the one hand, into myFile.sql we need to write the complete path of my stored procedure; In the other hand, when we compile, we need only write the /bin path --> sudo voltdb compile --classpath "./bin/" -o myFile.jar myFile.sql

Best Regards, Jesús.
jjmartinez
Feb 1, 2013
Thanks to John Hugg, we've fixed the error

There was a problem with the classpath: On the one hand, into myFile.sql we need to write the complete path of my stored procedure; In the other hand, when we compile, we need only write the /bin path --> sudo voltdb compile --classpath "./bin/" -o myFile.jar myFile.sql

Best Regards, Jesús.