Saturday, March 6, 2010

Getting in touch with Thrift - Get the turial example running

So - Thrift has been compiled - hopefully it does work (see earlier post). Before I jump to the "Simon says" Puzzle, I wanted first to check if my thrift build is working. Therefore I gave the example of the thrift tutorial a go. The tutorial is still in an early stage:

This tutorial is known to be woefully incomplete, and is a work in progress. This skeleton is illustrative of what is being worked on and will soon be available. [thrift webpage]


Sounds not that promising and indeed there have been some minor obstacles in my way. Prerequisits for the tutorial is the availability of
  • Simple Logging Facade for Java - SLF4J and
  • Log4j if you decide to use log4j behind the facade
jars in the classpath of the system. Instead of building from the provided build file, I decided to create a eclipse project. After setting the scenes, I still got some compile errors in JavaServer.java. Seven occasions like:

[javac] /home/stefan/thriftest/tutorial/java/src/JavaServer.java:57: an enum switch case label must be the unqualified name of an enumeration constant
[javac] case Operation.ADD:


which simply can be solved by replacing case Operation.ADD by case ADD. And two more problems:

[javac] /home/stefan/thriftest/tutorial/java/src/JavaServer.java:69: incompatible types
[javac] found : tutorial.Operation
[javac] required: int
[javac] io.what = work.op;
[javac] ^
[javac] /home/stefan/thriftest/tutorial/java/src/JavaServer.java:77: incompatible types
[javac] found : tutorial.Operation
[javac] required: int
[javac] io.what = work.op;

I omitted those by commenting those lines as they anyway don't add to the functionality of the server.

After this manual changes the tutorial seems to be running fine. Ready for Simon says puzzle.