OpenWrt Forum Archive

Topic: OSGi / Java on Asus WL-500d Deluxe?

The content of this topic has been archived on 28 Mar 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi,

I am trying to run the open-source Knopflerfish OSGi-Framework on my Asus WL-500d Deluxe router running OpenWRT White Russian RC5.

I installed SableVM, and tested both 1.13 from http://downloads.openwrt.org/backports/rc5/ and 1.11 from http://openwrt.poulpy.org/ with the same results. I can run simple Java programs wihtout problems, but when I run Knopflerfish it crashes after a few minutes. Sometimes I get a Segmentation Fault, sometimes it just gets back to the shell. I increased verbosity of SableVM and Knopflerfish, but I still get no error message before or after the crash.

Does anyone have similar problems or know how to circumvent this?

At the beginning I thought my device didn't have enough memory, so I created a 128MB Swap-file on a USB-Stick, but it didn't help.

I also tried JamVM (from http://downloads.openwrt.org/people/nbd/ar7/packages/) but it just gives me a Segmentation Fault, even if I run it without parameters.

Anyone got Blackdown or Kaffe VM running on their routers? Or any other Java VM?

Thanks in advance
Leonardo.

You probably lack a full classpath package. Anyway, I don't think running heavy Java programs on such device is possible.

florian_ wrote:

You probably lack a full classpath package. Anyway, I don't think running heavy Java programs on such device is possible.

Hi,

I am using sablevm-classpath-full: the name suggests it is a full classpath package. As long you have enough memory, any Java program should run on the router. Swapping will make everything slower, but it should still work.

I suppose there is a problem with threads in SableVM. I found the following bug report:

http://sablevm.org/lists/sablevm-bugs/2 … 00789.html

According to the SableVM documentation there are "3 flavors of threaded interpretation (switched, threaded and inlined)", so maybe compiling SableVM with a different kind of thread interpretation could solve the problem.

Regards
Leonardo.

Hi all,

humaita reports an error ("java/lang/NoClassDefFoundError:java/lang/Thread") that occurred when using JamVM. This error message occurred because the JamVM does not work with the sablevm-classpath package. That is an error in the dependency of the JamVM package. I will fill out a ticket to report this problem  to the openWRT developers as soon as possible.
To use JamVM you need the original CLASSPATH from http://www.gnu.org/software/classpath/.

Dex

Hi,

I would just like to tell you guys that the OSGi Framework from Knopflerfish works using JamVM. When I run the fullblown Knopflerfish OSGi Framework with all default bundles, which are designed for a big and heavy desktop PC, the Router still has 1MB (of 32MB) free RAM. The memory footprint of a minimal OSGi Framework is about 4MB, leaving about 9MB free RAM.

The problems I had with JamVM were mostly because I installed classpath on a usb stick. The classpath libs were on /mnt/disc0_1/usr/lib - since busybox doesn't have ldconfig and the ipkg installer couldn't symlink because of the FAT filesystem on the stick it didn't work. As a workaround I copied the libs to /tmp and linked them to the /lib. After that I could start java programs by running

jamvm -Xbootclasspath/a:"/mnt/disc0_1/usr/local/classpath/share/classpath/glibj.zip" [CLASSNAME]

I did not manage to solve the problems with sableVM. I tried compiling it myself with other thread interpretations but I still got the same problems.

Regards,
Leonardo.

Hi,

Since Bamboo is written in Java, is it easy to port Bamboo into wireless access router, e.g. OpenWRT which mostly written in C/C++? Why? How about some other DHT algorithms, e.g. CAN or Chord implementations?

Thank you very much!

Hi,

I suppose you mean http://bamboo-dht.org/, right?

Since Bamboo already runs on Linux - and OpenWRT is an embedded Linux distribution - it should not be very hard. And as you can see from my post OpenWRT also has a working Java VM.

Why don't you try to cross-compile following this guide:

http://wiki.openwrt.org/BuildingPackagesHowTo

Regards
Leonardo.

Hi,

I mean http://bamboo-dht.org.  Are there a lot of coding work to do in the porting? Do you have any use case examples? I am not very good at Java programming.  How long it would take to complete the porting from Bamboo into OpenWrt?

Thanks!

Hi,

I am not a developer. It could be you can just compile the source code without any modifications, so you would not need to do any coding. It could also be you need to change a lot so the code compiles. Cant' tell.

I would just download the OpenWRT-SDK and try to compile the software.

You can find the source-code of current ports (including patches where needed) here:

http://svn.openwrt.org/openwrt/branches … t/package/

Regards
Leonardo.

Hi Leonardo,

Thanks for your reply.

Since it is ported from Java to C/C++, there might be memory resource used up when running Bamboo. Running Bamboo requires more RAM, probably requires libraries and features that Java VM does not provide...

The discussion might have continued from here.