SoapUI Google Analytics NullPointerException On Ubuntu


This is just a quick post to consolidate my findings when investigating why a Null Pointer Exception occurs in SoapUI when running on Ubuntu. The error occurs in the analytics code when it tries to obtain the machine’s MAC address. For now, I have hopefully found a quick work around explained below.

I tested this when running SoapUI 5.2.1 (built & run from source code) on a clean install of Ubuntu 14.04.4, Java 1.7u79 and running on VirtualBox.

Problem Description

When starting you may see:


Aside from, a similar error can also be seen in when using different areas of functionality.

Looking at either of those classes where the NPE occurs we can see route cause is the same piece of code:

[code language=”java” gutter=”true” highlight=”1″]

NetworkInterface network = NetworkInterface.getByInetAddress(InetAddress.getLocalHost());
byte mac[] = network.getHardwareAddress();
MessageDigest hasher = MessageDigest.getInstance("SHA-1");
return createHexBinary(hasher.digest(mac));


You can probably see that network is coming back as null.


To understand why, and work around the problem, try running a snippet of the same code with logging added e.g. something like:

[code language=”java” gutter=”true”]



public class Main {

public static void main(String[] args) {

try {
NetworkInterface network = NetworkInterface.getByInetAddress(InetAddress.getLocalHost());
System.out.println("Machine Name="+ InetAddress.getLocalHost());
System.out.println("Network Interface="+network);
byte mac[] = network.getHardwareAddress();
System.out.println("Mac Address="+mac);
MessageDigest hasher = MessageDigest.getInstance("SHA-1");
System.out.println("Hashed Mac"+hasher.digest(mac));
catch(Exception e){
System.out.println("Error generating Analytics session ID – returning empty String"+ e);


Depending on how your hosts file / network settings are, you may see something like:

[code language=”bash” gutter=”false” highlight=”1″]

Machine Name=ubuntutest-VirtualBox/
Network Interface=null
Error generating Analytics session ID – returning empty Stringjava.lang.NullPointerException


The Machine Name will vary on your machine, but the Network Interface can be seen as null and a NullPointerException is caught. The problem seems to be that NetworkInterface.getByInetAddress cannot match the Machine Name to any of the Network Interface values. Running ifconfg shows that there is indeed no match available:

[code language=”bash” gutter=”false”]

ubuntutest@ubuntutest-VirtualBox:~$ ifconfig
eth0 Link encap:Ethernet HWaddr 07:07:27:79:d2:07
inet addr: Bcast: Mask:
inet6 addr: fe80::a00:27ff:fe79:d101/64 Scope:Link
RX packets:21 errors:0 dropped:0 overruns:0 frame:0
TX packets:73 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:3086 (3.0 KB) TX bytes:10810 (10.8 KB)

lo Link encap:Local Loopback
inet addr: Mask:
inet6 addr: ::1/128 Scope:Host
RX packets:46 errors:0 dropped:0 overruns:0 frame:0
TX packets:46 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:3559 (3.5 KB) TX bytes:3559 (3.5 KB)



So without fixing the code, one quick solution is to change the /etc/hosts entry for your machine name to use the same IP address as eth0. So in my case, I did something like:

[code language=”bash” gutter=”false”]

sudo nano /etc/hosts


And added:

[code language=”bash” gutter=”false”]      ubuntutest-VirtualBox


Running the above snippet should then show the Network Interface correctly matched and the Mac Address found e.g.

[code language=”bash” gutter=”false”]

Machine Name=ubuntutest-VirtualBox/
Network Interface=name:eth0 (eth0)
Mac Address=[B@520b368f
Hashed Mac[B@4a5e88f7


Note – adding a host entry pointing to lo ( solves the first problem of matching the Network Interface, but then fails when the code tries to obtain the MAC address with network.getHardwareAddress() – unlike eth0, the interface lo doesn’t have one!

Starting up SoapUI should now occur without the Analytics NPE.

Code Fix

Aside from having / changing your network settings to help the code work, it would probably be better to fix the code in SoapUI to iterate over the possible Network Interfaces until it finds one with a MAC address. I’ll maybe take more of a look at this later.


There are probably more or even better options for solving this problem, but I just wanted to get some options down in response to various SoapUI Community posts featuring this error for users running on Ubuntu. Hopefully this will help somewhat, please come in with any suggestions / corrections / comments!