Forum: Building VoltDB Applications

Post: NullPointerException when running 2.2.2 voltcompiler

NullPointerException when running 2.2.2 voltcompiler
cer
Mar 15, 2012
My application compiles without problem with the 2.1.2 voltcompiler.

When I switch to the 2.2.2 version (I haven't changed the source code or the project files) I get:

$ voltcompiler target/classes src/main/resources/voltdb/by-restaurantid-voltdb-project.xml byrestaurantid.jar

2012-03-15 17:25:24,524 INFO [main] COMPILER: Path to catalog ../sql/common-schema.sql
2012-03-15 17:25:24,525 INFO [main] COMPILER: Path to catalog ../sql/by-restaurantid-schema.sql
Exception in thread "main" java.lang.NullPointerException
at org.hsqldb_voltpatches.VoltXMLElement.append(VoltXMLElement.java:56)
at org.hsqldb_voltpatches.VoltXMLElement.append(VoltXMLElement.java:56)
at org.hsqldb_voltpatches.VoltXMLElement.append(VoltXMLElement.java:56)
at org.hsqldb_voltpatches.VoltXMLElement.toString(VoltXMLElement.java:44)
at java.lang.String.valueOf(String.java:2826)
at java.io.PrintStream.println(PrintStream.java:771)
at org.voltdb.compiler.DDLCompiler.compileToCatalog(DDLCompiler.java:154)
at org.voltdb.compiler.VoltCompiler.compileDatabaseNode(VoltCompiler.java:587)
at org.voltdb.compiler.VoltCompiler.compileXMLRootNode(VoltCompiler.java:483)
at org.voltdb.compiler.VoltCompiler.compileCatalog(VoltCompiler.java:442)
at org.voltdb.compiler.VoltCompiler.compile(VoltCompiler.java:320)
at org.voltdb.compiler.VoltCompiler.main(VoltCompiler.java:1205)
Reproduction
rbetts
Mar 15, 2012
Please email me (rbetts@voltdb.com) your DDL and by-restaurantid-voltdb-project.xml file and I'll file and issue and resolve this.

Sorry for the difficulty,
Ryan.
Sent. Thanks.
cer
Mar 15, 2012
Sent. Thanks.
We don't support FK constraints
jhugg
Mar 15, 2012
Sent. Thanks.


The schema provided uses SQL foreign keys via the "REFERENCES" keyword. VoltDB does not (and never has) supported explicit foreign keys in DDL.

Previous versions of VoltDB would parse this SQL and ignore the foreign key constraint. We made a change for 2.2.2 to improve parser performance and as a result, the code that ignores foreign keys was changed. Now it fails hard and without a clear error message. I've created https://issues.voltdb.com/browse/ENG-2643 to provide a clear error message, rather than the unhelpful crash you saw. Sorry about that.

To get your DDL to parse under 2.2.2, simply remove the "REFERENCES restaurant(id)" text from your DDL wherever it occurs. That should get you identical functionality to 2.2.1.