Java SE embedded on Buffalo NAS box
As a server guy for a long time, I would like to have my code running on any device that has a JVM on it.
And recently, I just bought a small but wonderful Buffalo NAS box for my precious photos and stuffs like this at home. Previously, I had a lot of fun with a similar home/small office NAS product, the WD's My Book World edition, but with very limited CPU and memory when compared with Buffalo's model(200Mhz CPU, 32MB RAM vs 1.6G CPU, 256M RAM), it can only host a PHP environment on it. This time, by instinct, I am looking around to see if I can put a more useful server environment, specifically, the JAVA technology, on it.
The first step is to gain root access of the box, like all other devices if you want to hack it. Google is always my best friend on it. Without much effort, I found a wonderful and dedicated hacker community for my NAS box, following the steps, scratched my head several times, and bingo!, my lovely "#" was dancing on my screen.
The next thing to check is the CPU architecture of the box. It turns out it has an ARMv5 based CPU. Honestly, I didn't expect there is such a build for this quite old and feature limited CPU architecture from the beginning, but it turned out there is one:
ARMv5 Linux - Headless EABI, SoftFP ABI, Little Endian
Just for record, here is the actual JVM version output:
root@LS-WVLF5E:~# java -version java version "1.7.0_21" Java(TM) SE Embedded Runtime Environment (build 1.7.0_21-b11, headless) Java HotSpot(TM) Embedded Client VM (build 23.21-b01, mixed mode)
Then, the database server staff. The Buffalo box is shipped with a quite old 5.0.x MySQL server inside, and at first, I wanted to replace it with a newer community package using optware. After trying hard but still failed to start the new server, I reluctantly started and tested the build-in MySQL server. It turned out working quite stable and also has InnoDB engined built-in. After a little tweak, the database part is ready.
I dropped a pre-build server package(a J2EE application using Spring, Hibernate and all the hot stuff you named it) an an Apache Tomcat package into the NAS, modified the application's settings accordingly, started the server, then watched the log output scrolling on my screen.
But, with a lot exceptions popping out ... This time, it turned out it was caused by the JVM.
The embedded edition of ARMv5 architecture is shipped with very limited character set support, but my application have to deal with Asian languages, so it failed loudly with all the exceptions popping out. By comparing the library folder of different versions of JRE(a standard one and the embedded one), I found out that "charset.jar" was missing. My good luck again!
After putting back the missing jar file, restarted the server, everything ran as smoothly as it could.
Now, the noise from the harddisks of the NAS box happily reminds me that, my crawlers have pulled back another batch of new data.