Forum: Building VoltDB Applications

Post: Exception in compiling voter example in VoltDB 4.8 in Ubuntu 12

Exception in compiling voter example in VoltDB 4.8 in Ubuntu 12
tariqrahiman
Nov 12, 2014
Exception in compiling voter example in VoltDB 4.8 in Ubuntu 12

1. Installed voltdb 4.8 and tried to compile the sample voter example
2. I get the below exception :
3. VoltDB version is 4.8 and Ubuntu Version is Ubuntu 12.04.5 LTS
4. Exception is

/opt/voltdb/bin$ ./voltdb compile -o voter.jar /opt/voltdb/examples/voter/ddl.sql
log4j:ERROR setFile(null,true) call failed.
java.io.FileNotFoundException: log/volt.log (No such file or directory)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(Unknown Source)
at java.io.FileOutputStream.<init>(Unknown Source)
at org.apache.log4j.FileAppender.setFile(FileAppender.java:294)
at org.apache.log4j.FileAppender.activateOptions(FileAppender.java:165)
at org.apache.log4j.DailyRollingFileAppender.activateOptions(DailyRollingFileAppender.java:223)
at org.apache.log4j.config.PropertySetter.activate(PropertySetter.java:307)
at org.apache.log4j.xml.DOMConfigurator.parseAppender(DOMConfigurator.java:295)
at org.apache.log4j.xml.DOMConfigurator.findAppenderByName(DOMConfigurator.java:176)
at org.apache.log4j.xml.DOMConfigurator.findAppenderByReference(DOMConfigurator.java:191)
at org.apache.log4j.xml.DOMConfigurator.parseChildrenOfLoggerElement(DOMConfigurator.java:523)
at org.apache.log4j.xml.DOMConfigurator.parseRoot(DOMConfigurator.java:492)
at org.apache.log4j.xml.DOMConfigurator.parse(DOMConfigurator.java:1001)
at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:867)
at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:773)
at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:483)
at org.apache.log4j.LogManager.<clinit>(LogManager.java:127)
at org.apache.log4j.Logger.getRootLogger(Logger.java:135)
at org.voltcore.logging.VoltLog4jLogger.<clinit>(VoltLog4jLogger.java:47)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.voltcore.logging.VoltLogger.<init>(VoltLogger.java:255)
at org.voltcore.utils.CoreUtils.<clinit>(CoreUtils.java:76)
at org.voltcore.logging.VoltLogger.<clinit>(VoltLogger.java:39)
at org.voltdb.compiler.VoltCompiler.<clinit>(VoltCompiler.java:148)
log4j:ERROR Either File or DatePattern options are not set for appender [file].
ERROR: [null]: Cannot load class for procedure: voter.procedures.Initialize
caused by:
java.lang.ClassNotFoundException: voter.procedures.Initialize
ERROR: [null]: VoltDB DDL Error: "Cannot load class for procedure: voter.procedures.Initialize
caused by:
java.lang.ClassNotFoundException: voter.procedures.Initialize" in statement starting on lineno: 64
------------------------------------------
Catalog compilation failed.
------------------------------------------
ajgent
Nov 13, 2014
Hi,

Thanks for your including the command and error messages.

It looks like from the command you set default to /opt/voltdb/bin. When you start VoltDB, it creates a log directory and file (log/volt.log) in the current working directory. I suspect you do not have permissions to create the log file under /opt, which is why you get the initial Log4j error

Also, you do not specify a classpath on the command line, so the compiler cannot find the class files for the stored procedures, which is why you get the ClassNotFound exception.

I suggest you copy the voter example directory (and its contents) to a subfolder of your account home. Then set default to your copy of the voter directory, make sure you compile the stored procedure sources, and include -c on the command to make sure the class files are findable by the compiler. For example


/home/me/voter$ /opt/voltdb/bin/voltdb compile -o voter.jar -c ./obj ddl.sql


Let me know if that helps.

Andrew Gent
tariqrahiman
Nov 13, 2014
Thanks Andrew. You were 100% correct in both cases regarding permission and class path. I made the changes suggested by you and now I am up and running.
Great Support as usual from the VoltDB Team

Tariq
waleeed
Feb 20, 2016
It looks like from the command you set default to /opt/voltdb/bin. When you start VoltDB, it creates a log directory and file (log/volt.log) in the current working directory. I suspect you do not have permissions to create the log file under /opt, which is why you get the initial Log4j error

Also, you do not specify a classpath on the command line, so the compiler cannot find the class files for the stored procedures, which is why you get the ClassNotFound exception.