I was interested in putting Mule ESB on my Raspberry Pi 2 but couldn’t find any detailed notes around how to do this.
It was this article which sparked my interest (http://blogs.mulesoft.com/biz/news/raspberry-pi-gets-an-api/) but this talked about a product called “Anypoint Edge” which I couldn’t find any information on.
There were some notes on this post: http://forums.mulesoft.com/questions/989/raspberry-i.html which to a newbie was pretty cryptic at first.
And this tweet here by @keaton_victor.
So I set about giving it a go. Here is what I did.
Step 1: Download Mule Enterprise Edition
Download mule-ee-distribution-standalone-3.7.1.tar.gz to the pi. I actually downloaded it via a browser and then secure copied it to my pi. In Ubuntu I ran:
scp mule-ee-distribution-standalone-3.7.1.tar.gz firstname.lastname@example.org:/home/pi/mule
Step 2: Unzip Mule
SSH to the Pi and unzip the file.
tar -xvzf mule-ee-distribution-standalone-3.7.1.tar.gz
Step 3: Download Java Wrapper
Go to: http://wrapper.tanukisoftware.com/doc/english/download.jsp and download the latest version of Linux armhf Community Edition. For me it was 3.5.27.
To figure out if your Pi device is running armhf or armel run this bodacious command:
readelf -A /proc/self/exe | grep Tag_ABI_VFP_args
If the Tag_ABI_VFP_args tag is found, then you’re running on an armhf system. If nothing is returned, then it’s armel.
Step 4: Find wrapper.conf
Grab ~wrapper-linux-armhf-32-3.5.27/conf/wrapper.conf and copy to ~mule-enterprise-standalone-3.7.1/lib/boot
What does the Java Service Wrapper do? From the README_en.txt file
The Java Service Wrapper is an application which has evolved out of a desire to solve a number of problems common to many Java applications. Some of the Wrapper's features are: * Run a Java application as a Windows Service or Unix Daemon * Java Application Reliability * Automatic Crash, Freeze, and Deadlock Detection and Recovery * On Demand Restarts * Standard, Out of the Box Scripting * Flexible Cross Platform Configuration * Ease Application Installations * Logging * Many more... See our download page for a more detailed feature list. => http://wrapper.tanukisoftware.com/doc/english/download.jsp
Step 5: Start Mule
Run (assuming you are in mule-enterprise-standalone-3.7.1 directory) :
Now you should see:
To test this out, take this helloworld project (helloworld) and place it in the apps folder and in your browser open up http://192.168.1.15:8081/hi (replace with your IP address) and you should see:
If you get Permission denied error:
Caught: java.io.FileNotFoundException: /home/pi/mule/mule-enterprise-standalone-3.7.1/conf/wrapper-additional.conf (Permission denied) java.io.FileNotFoundException: /home/pi/mule/mule-enterprise-standalone-3.7.1/conf/wrapper-additional.conf (Permission denied) at additional.run(additional.groovy:27)
add “sudo” in front of the command
If you get insufficient memory error:
Launching a JVM... Java HotSpot(TM) Client VM warning: ignoring option PermSize=256m; support was removed in 8.0 Java HotSpot(TM) Client VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0 Java HotSpot(TM) Client VM warning: Using the ParNew young collector with the Serial old collector is deprecated and will likely be removed in a future release Java HotSpot(TM) Client VM warning: INFO: os::commit_memory(0x53e00000, 536870912, 0) failed; error='Cannot allocate memory' (errno=12) # # There is insufficient memory for the Java Runtime Environment to continue. # Native memory allocation (mmap) failed to map 536870912 bytes for committing reserved memory. # An error report file with more information is saved as: # /home/pi/mule/mule-enterprise-standalone-3.7.1/hs_err_pid2996.log
Trying decreasing the Java Heap Size in conf/wrapper.conf
This idea came thanks to Aaron Weikle who noted “Also you can modify the memory size in the wrapper.conf to fit for a micro instance as well.” This was in relation to https://www.linkedin.com/grp/post/6936034-6046034101792759808