Forum: Building VoltDB Applications

Post: Basic volt issue: cannot load class for procedure select in the hello world tutorial

Basic volt issue: cannot load class for procedure select in the hello world tutorial
akh2103
Oct 10, 2013
I am trying to get a hang of volt 3.6 CE via the "Hello, World" tutorial code. I compiled the Client, Select
and Client classes from the tutorial sample code https://voltdb.com/docs/GettingStarted/HWsourcefiles.php#insertfig

I made a helloworld.sql file by copying from that same link.

But I am getting an error that Voltdb cannot load class for the procedure "Select"

memsql@memsql-virtual-machine:~/helloworld$ voltdb compile -o helloworld.jar helloworld.sql
ERROR: [Select.class]: Cannot load class for procedure: Select
ERROR: Failed to compile XML
ERROR: Catalog compilation failed.
------------------------------------------
Project compilation failed. See log for errors.
------------------------------------------
ERROR: Command "/usr/bin/java ..." failed with return code 65280.

FATAL: Exiting.

This is what it says in the log

2013-10-10 10:44:33,225 INFO [main] COMPILER: [null]: Created index: SYS_IDX_SYS_PK_10018_10019 on table: HELLOWORLD of type: BALANCED_TREE
2013-10-10 10:44:33,245 INFO [main] COMPILER: [HELLOWORLD.insert]: Compiling Statement: INSERT INTO HELLOWORLD VALUES (?, ?, ?);
2013-10-10 10:44:33,369 INFO [main] COMPILER: [HELLOWORLD.select]: Compiling Statement: SELECT * FROM HELLOWORLD WHERE (DIALECT = ?);
2013-10-10 10:44:33,412 INFO [main] COMPILER: [HELLOWORLD.delete]: Compiling Statement: DELETE FROM HELLOWORLD WHERE (DIALECT = ?);
2013-10-10 10:44:33,433 INFO [main] COMPILER: [HELLOWORLD.update]: Compiling Statement: UPDATE HELLOWORLD SET HELLO = ?, WORLD = ?, DIALECT = ? WHERE (DIALECT = ?);
2013-10-10 10:44:33,463 ERROR [main] COMPILER: [Select.class]: Cannot load class for procedure: Select
2013-10-10 10:44:33,466 ERROR [main] COMPILER: Failed to compile XML
2013-10-10 10:44:33,466 ERROR [main] COMPILER: Catalog compilation failed.

Why am I seeing this error? What does it mean? How can I fix it (both in this instance, and as I go on building volt applications)?
bballard
Oct 10, 2013
Hi Abe,

You can find the complete code for the helloworld example provided in the VoltDB kit under doc/tutorials/helloworld.

Before you compile the catalog, you should first compile any java stored procedures. When you compile them using javac, you can provide a "-d <directory>" parameter to specify the a directory where the compiled .class files will be output. If you don't provide a directory, they will be output in the current directory.

Then, when you compile the schema using "voltdb compile", you can provide the "--classpath <directory>" parameter to specify the directory where the .class files are located. You must provide this parameter unless your schema does not include any java stored procedures.

It looks like your problem is that the "--classpath <directory>" parameter is missing. Since your schema includes the "Select" class, you'll need to specify the javac output directory that you used.

Cheers,
Ben
bballard
Oct 10, 2013
Quick correction:
If you omit the "--classpath <directory>" parameter from the "voltdb compile" command, it does not default to the current directory. Omitting this parameter only works when your schema does not include any java stored procedures.