Friday, August 17, 2012

MoSKito 1.5.0 goes after threads.

As MoSKito 1.5.0 hits the maven repositorty today, so do some new features about threads.
Here's a short overview on 4 new screens added in 1.5.0 for threading issues.

NOTE: We now do have an official anotheria blog:
This post is moved there:

Thursday, August 16, 2012

Everything gets better once Oracle buys you

Well, almost.
Recently I had to retrieve my sun developer framework account, I wasn't using for 5 years now.
I was hoping I can vote on this ugly bug with localhost and java7 on my mac, I was writing about in previous post. Well - no. However, the process itself was funny enough, since they require you to specify both, username and email, and in my case (and I suppose many other cases) its the same, but its not that easy to figure out.

However, sun's and now oracle's mailing system works much better than the update profile dialog, I was forced to fill and submit:

Well, at least we now know what GlassFish version they are running ;-)

Oracle Kills getLocalhost on MacOS X in Java 7

This is going to be another one of those How things that can't happen actually happen post.
I recently updated my Mac to Java 7. Pretty late though. Right after that DistributeMe services start behaving at least strange. Right after the start a service registers itself in a registry with a unique service identifier, which looks like that:


Where being the ip adress of the machine the service runs on. This adress is used by the client, once the later wants to connect to the service.

After upgrade to Java 7 the service registered itself in the registry with the identifier:


Of course no client were able to resolve the host named unknown. I started investigating where this comes from, and well, it was in one of those sections...

private static String getHostName(){
    InetAddress localhost = InetAddress.getLocalHost();
    String host = localhost.getHostAddress();
    HashMap mappings = configuration.getMappings(); 
    String mappedHost = mappings.get(host);
    return mappedHost == null ? host : mappedHost;
  }catch(UnknownHostException e){
    return "unknown";

Ok, this is certainly not the best idea to return "unknown" here (one of those, can't happen anyway bug), but why the heck did InetAddress.getLocalHost() fail?

I wrote a very small program to verify it:

package localhostbug;


public class PrintLocalhost {
  public static void main(String[] args) throws Exception{
    InetAddress localhost = InetAddress.getLocalHost();
    String host = localhost.getHostAddress();
    System.out.println("host: "+host);

Running it with JAVA6 and JAVA7 shows the difference, watch yourself:

$JAVA6_HOME/bin/java -cp classes localhostbug.PrintLocalhost
$JAVA7_HOME/bin/java -cp classes localhostbug.PrintLocalhost
Exception in thread "main" colin.speedport.ip: colin.speedport.ip: nodename nor servname provided, or not known
 at localhostbug.PrintLocalhost.main(
Caused by: colin.speedport.ip: nodename nor servname provided, or not known
 at Method)
 ... 1 more

After some googling I found a bug in oracle bug database and a similar issue in openjdk. Seems Java and Mac is getting less and less a love story.