By Payara Team

Payara Micro is a new way of running Java EE applications without having to install a full application server.

As Payara Micro requires no installation and has a <60MB runtime footprint it is ideal for running on small platforms like the Raspberry Pi.

This blog will give you a step by step rundown of getting a Payara Micro cluster running on a pair of  Raspberry Pis. However the steps here can be used to test Payara Micro on any Linux platform.

Here’s our two servers Piyara1 and Piyara2. We are using the latest Raspbian, which has Java already installed.

rasbian

So lets log-in and check Java is installed

is the Java on

Installing Payara Micro

Let’s download Payara Micro

wget http://bit.ly/1EUuZoj -O payara-micro.jar

Payara Micro download

OK, now we’ve got Payara installed, let’s boot it up.

java -jar payara-micro.jar

Payara jar

That’s it – Payara Micro running on a Raspberry Pi!

If we run top we can see that there’s still plenty of resources left on the Raspberry Pi.

Raspberry Pi resources 2

 Running a war File

At this stage however we aren’t running any Java EE Applications. So let’s try a demo application by downloading the Prime faces showcase application.

wget http://repository.primefaces.org/org/primefaces/showcase/5.2/showcase-5.2.war

Let’s run that on Payara Micro

java -jar payara-micro.jar --deploy showcase-5.2.war

Payara Micro demo

You will see the message “Deployed 1 wars” and before that “showcase-5.2 was successfully deployed…”

You can then test your deployed Prime Faces showcase by browsing to

http://<your-pi-ip>:8080/showcase-5.2

Primefaces

You can run any war file using the –deploy input parameter to Payara Micro. The parameter can be used multiple times if you have multiple jars. Alternatively you can use the parameter

–deploymentDir to deploy all the war files in a specific directory.

To see all the command line options run;

java -jar payara-micro.jar --help

Image_8

How about clustering?

Clustering is simple with Payara Micro. Just run a second Payara Micro Server on the same network and they will “find” each other and form a cluster.

What you will see in the log output of Payara Micro is something like;

[2015-05-12T17:05:27.331+0000] [Payara 4.1] [INFO] [] [com.hazelcast.cluster.ClusterService] [tid: _ThreadID=36 _ThreadName=hz.glassfish-web.server.generic-operation.thread-0] [timeMillis: 1431450327331] [levelValue: 800] [[
  [192.168.0.23]:5900 [dev] [3.4.2]
Members [2] {
        Member [192.168.0.23]:5900 this
        Member [192.168.0.24]:5900
}
]]

This is Payara Micro forming a cluster and all the members of the cluster are shown in the message. In this case our piyara1 and piyara2 servers. The cluster will include full session replication as well as a clustered Hazelcast Cache accessible using the JSR107 (JCache api) similar to standard Payara.

Image_9

Feedback Wanted

It is incredibly easy to get started with Payara Micro on any platform, there is no installation and no fancy maven packaging you need to get your head around to use Payara Micro. Just download and run.

As this is a new feature of Payara we are looking for feedback. If you have any ideas or you find issues where Payara Micro won’t run your application, please raise them on the GitHub project https://github.com/payara/Payara

Running Java EE Applications with Payara Micro on the Raspberry Pi

About The Author
-

3 Comments

  • Bonzadog
    Reply

    I could not get it to run on Raspberry Pi B (apt-get updated and upgraded) kept getting
    retry laters :

    015-05-21 17:43:18 (733 KB/s) – `payara-micro.jar’ saved [57591565/57591565]

    root@rpi229:/home/pi# java -jar payara-micro.jar
    Found populator: org.glassfish.kernel.embedded.EmbeddedDomainXml
    [2015-05-21T17:45:52.267+0200] [Payara 4.1] [WARNING] [NCLS-MON-00504] [javax.enterprise.system.tools.monitor] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1432223152267] [levelValue: 900] Encountered exception during agent attach

    [2015-05-21T17:46:05.145+0200] [Payara 4.1] [WARNING] [NCLS-MNTG-00201] [javax.enterprise.monitoring] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1432223165145] [levelValue: 900] Flashlight listener registration failed for listener class: com.sun.enterprise.v3.services.impl.monitor.stats.ThreadPoolStatsProvider , will retry later

    [2015-05-21T17:46:05.324+0200] [Payara 4.1] [WARNING] [NCLS-MNTG-00201] [javax.enterprise.monitoring] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1432223165324] [levelValue: 900] Flashlight listener registration failed for listener class: com.sun.enterprise.v3.services.impl.monitor.stats.KeepAliveStatsProvider , will retry later

    [2015-05-21T17:46:05.652+0200] [Payara 4.1] [WARNING] [NCLS-MNTG-00201] [javax.enterprise.monitoring] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1432223165652] [levelValue: 900] Flashlight listener registration failed for listener class: com.sun.enterprise.v3.services.impl.monitor.stats.FileCacheStatsProvider , will retry later

    [2015-05-21T17:46:05.854+0200] [Payara 4.1] [WARNING] [NCLS-MNTG-00201] [javax.enterprise.monitoring] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1432223165854] [levelValue: 900] Flashlight listener registration failed for listener class: com.sun.enterprise.v3.services.impl.monitor.stats.ConnectionQueueStatsProvider , will retry later

    [2015-05-21T17:46:10.795+0200] [Payara 4.1] [WARNING] [NCLS-MNTG-00201] [javax.enterprise.monitoring] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1432223170795] [levelValue: 900] Flashlight listener registration failed for listener class: com.sun.enterprise.v3.services.impl.monitor.stats.ThreadPoolStatsProvider , will retry later

    [2015-05-21T17:46:11.056+0200] [Payara 4.1] [WARNING] [NCLS-MNTG-00201] [javax.enterprise.monitoring] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1432223171056] [levelValue: 900] Flashlight listener registration failed for listener class: com.sun.enterprise.v3.services.impl.monitor.stats.KeepAliveStatsProvider , will retry later

    [2015-05-21T17:46:11.489+0200] [Payara 4.1] [WARNING] [NCLS-MNTG-00201] [javax.enterprise.monitoring] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1432223171489] [levelValue: 900] Flashlight listener registration failed for listener class: com.sun.enterprise.v3.services.impl.monitor.stats.FileCacheStatsProvider , will retry later

    [2015-05-21T17:46:11.700+0200] [Payara 4.1] [WARNING] [NCLS-MNTG-00201] [javax.enterprise.monitoring] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1432223171700] [levelValue: 900] Flashlight listener registration failed for listener class: com.sun.enterprise.v3.services.impl.monitor.stats.ConnectionQueueStatsProvider , will retry later

    [2015-05-21T17:46:12.710+0200] [Payara 4.1] [INFO] [NCLS-CORE-00087] [javax.enterprise.system.core] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1432223172710] [levelValue: 800] Grizzly Framework 2.3.19 started in: 2,160ms – bound to [/0.0.0.0:8080]

    [2015-05-21T17:46:12.752+0200] [Payara 4.1] [INFO] [NCLS-CORE-00058] [javax.enterprise.system.core] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1432223172752] [levelValue: 800] Network listener https-listener on port 8443 disabled per domain.xml

    [2015-05-21T17:46:12.829+0200] [Payara 4.1] [WARNING] [NCLS-MNTG-00201] [javax.enterprise.monitoring] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1432223172829] [levelValue: 900] Flashlight listener registration failed for listener class: com.sun.enterprise.v3.services.impl.monitor.stats.ThreadPoolStatsProviderGlobal , will retry later

    [2015-05-21T17:46:12.936+0200] [Payara 4.1] [WARNING] [NCLS-MNTG-00201] [javax.enterprise.monitoring] [tid: _ThreadID=1 _ThreadName=main] [timeMillis: 1432223172936] [levelValue: 900] Flashlight listener registration failed for listener class: com.sun.enterprise.v3.services.impl.monitor.stats.KeepAliveStatsProviderGlobal , will retry later

Leave a Reply to Bonzadog Cancel reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>