Is it possible to run average java app server on e.g. jboss or glassfish server on Raspberry pi? Any limitations? Does anyone have an experience in Java development for raspberry pi?
At least any appropriate JVM for RPi will be nice.
It’s absolutely possible, but should work better with newer versions having more memory (e.g. the 512 MB version of the Pi). In December 2012 Oracle released a Developer Preview of Java SE 8 for ARM. The blog post with the announcement contains links to a number of tutorials which should get you started with plain Java SE or JavaFX, depending on how fancy your interfaces should be.
If you are concerned about the performance of JavaFX on the Raspberry Pi, check the blog post “JavaFX on Raspberry PI”, which contains some information about the performance of JavaFX, comparing it to native applications.
Update: Test results after running Tomcat 7 with Java 8 on the Pi
After I got the 512mb version of the Pi (MODELL B), I installed Java 8 and Tomcat 7.0 without any problems. Tomcat examples were working, and I was able to use the Tomcat manager application without any problems.
With 64 MB of RAM used for the graphics card, I still had 291 MB of free memory (with sshd running):
[email protected] ~/ $ free -m total used free shared buffers cached Mem: 438 146 291 0 10 74 -/+ buffers/cache: 60 377 Swap: 99 0 99
pmap reported a total of 192 MB being used by the Tomcat process.
Raspberry Pi has only 185MB available for the whole JVM. (after boot, with 16MB to video processing).
Then, you need to use aggresive and precise memory options (
-Xmx120M -XX:MaxPermSize=55M -XX:ReservedCodeCacheSize=4M -Djava.awt.headless=true)
I have made an application based on Jetty, Spring 3 and Hibernate/JPA. Just after deployment, it fit in about 15MB of Heap space and 32MB of non heap space (using JProfiler memory analysis)
Each loaded class is permanent memory lost, because PermGen space can’t be garbage collected. A lot of classes are loaded only for initialization support, but will stay loaded forever. Maybe tweeks can be found to consume less PermGen space for each component.
You can indeed. There is a blog post of someone running JBoss EAP (essentially JBoss AS 7) on a raspberry pi.
I use TJWS on Raspberry Pi under JRE 1.7, it works incredibly fast and no memory issues.
Right now, a JVM on the pi is possible but a Java SE edition is hard to find. There may be one for ARM from Oracle, but I haven’t tried it (my pi is still on it’s way) and if memory serves it’s behind a wall.
Another limitation for the pi is the available RAM; apps like jboss and glassfish are going to want more RAM than the pi provides, except under very constrained deployments.
Arun Gupta made a few posts about running JBoss Wildfly on Raspberry Pi.
Ive got tomcat7 running on openjdk with sqlite databases. Processing ok at around a quater speed of my laptop, but opening jsp pages takes 10-15 seconds. Not sure why yet.