Skip to main content

Welcome to Geoff Hayward's Weblog

Commenting on Java, JavaFX, Java EE, Joomla, and IoT.

It is easy to generate a SOAP client from a WSDL with Java. Java comes with the tool named 'wsimport'. The wsimport tool is part of the Java JDK, found in the JDK bin folder. By default when you run the tool it will create and keep the compiled .class files. If you do not need the .class files just add -Xnocompile to the command.

wsimport http://localhost:8080/demo?wsdl -Xnocompile


I have been trying to get the JavaFX MediaPlayer to play MP3s. Each of the MP3s, that I have been trying to play, are being retrieved over HTTPS. The java class does not support the HTTPS protocol.

To workaround this problem meant temporarily storing the MP3 on the local disk. And then playing the MP3 from the temporary disk location.

URL url = new URL("https://resource.track.mp3");
Path mp3 = Files.createTempFile("now-playing", ".mp3");
try (InputStream stream = url.openStream()) {
        Files.copy(stream, mp3, StandardCopyOption.REPLACE_EXISTING);

Media media = new Media(mp3.toFile().toURI().toString());
MediaPlayer mediaPlayer = new MediaPlayer(media);;

Do you know of a better solution or workaround that will skip the need to write to disk when the media file is retrieved over HTTPS? Leave a comment if you do.


A colleague ask me how to convert an ArrayList to an Array in Java. Here was my answer:

List<String> results = new ArrayList<>();
results.toArray(new String[results.size()]);

Hope it's helpful. If you know of anymore ways to convert an ArrayList to an Array in Java, leave a comment.

Update: The Java 8 Lambda way: ArrayList to an Array


I have been keen to use Java on the Intel Edison since hearing that the Edison supports Java. At the time of writing this, I could not find much information on how to use Java with the Edison. So I decided to try and get a simple LED blink program going. While a blink program is very simple, the hello world of hardware, it thought me the important bits about using the Edison with Java.

Here is the blink program in action:

And here is the blink program's code:

import mraa.Gpio;

public class EdisonTest {

    static {
        try {
        } catch (UnsatisfiedLinkError e) {
            System.err.println("Native code library failed to load.");

    public static void main(String[] args) throws InterruptedException {
        Gpio gpio = new Gpio(11);
        int state = 1;

        while (true){
            state = (state==1?0:1); 


The command to run the program is java -Djava.library.path=/usr/lib/java/ -jar EdisonTest.jar. I used WinSCP to put the EdisonTest.jar and its lib folder into /home/root/ (where I ran the program from).

If you get any problems check that your manifest file includes the lib folder. And that the lib folder includes the mraa.jar. You can download the mraa.jar and UPM jars from Intel.


It turns out that getting EJB timer beans configured into a WildFly 9 domain cluster is quite easy. This post records how I got EJB timers working on a WildFly 9 cluster with a MySQL database as the timer bean's datasource. The domain profile I used was the 'ha' profile.

Note this post deals with EJB timer beans and assumes you already have a WildFly 9 HA domain configured with a MySQL connection.

All I had to do was configure the "timer-service" element. Here is the configuration that worked for me:

<timer-service thread-pool-name="default" default-data-store="clustered-store">
       <database-data-store name="clustered-store" datasource-jndi-name="java:/MySqlDS" database="mysql" partition="timer"/>

I have read another posts about configuring a 'timer-service' with PostgreSQL that talked about updating the SQL in the '' file. I found that MySQL just worked without the need to change the '' file.

I created an example project to help validate the configuration. Here is the code from the example project:

public class MessageManager {
    private EntityManager em;
    public Message save(Message m){
        return em.merge(m);


public class MessageTimer {
    private MessageManager mm;
    @Schedule(hour = "*", minute = "*", second = "*/10", info ="Runs every 10 seconds", persistent = true)
    public void printDate() { 
        Message m = new Message();
        m.setTime(new java.util.Date().toString());;

public class Message implements Serializable {
    private long id;
    private String time;
    private String server;
    // with getters and setters 


With this code the message table should get exactly one entry, from a cluster bigger than a size of one, every ten seconds. The instance that runs should be seemingly random.

Note: you need to set '' for each server in the HA group via the server's 'System Properties'.


Mailing List

Responsive Media

With the ResponsiveMedia plugin for Joomla it is easy to add 3rd party content from YouTube, Vimeo, and Instagram right in to any Joomla! article.