Warning: Java caches DNS to IP address lookups forever!

Found an interesting problem this morning after the IP address of a web server was changed in our DNS.

Web browsers could see the site at the new address, the command line of ping server could see the site just fine, but the long-running Java pinger application could not see the server at all. All we received were messages informing us that it could not contact the moved server.

After some digging on the internet I quickly found the reason why:

networkaddress.cache.ttl (default: -1)
Specified in java.security to indicate the caching policy for successful name lookups from the name service.. The value is specified as as integer to indicate the number of seconds to cache the successful lookup.

A value of -1 indicates "cache forever".
Sourced from: J2SE 1.4.2 Networking Properties

This is also mentioned in another post on how to Disable DNS caching.

So you need to restart the JVM to pick up recent DNS changes... or you could change the networkaddress.cache.ttl System property. But this doesn't work in some cases due to bug 6247501 - although the bug is closed, read the comments at the bottom of the page - not sure if the bug was closed after these comments or before...

Technorati Tags: , , , ,

Xalan classes go missing once Java is upgraded from 1.4 to 1.5

We found a bit of a strange problem today at work - some Xalan classes seemed to have disappeared. This week we upgraded some of our Tomcat web servers from Java 1.4 to Java 1.5. Everything appeared to work seamlessly, but today we noticed that one section of one site failed with a 'ClassNotFoundException'.

It was complaining about a couple of Xalan classes. We cracked open the rt.jar file ($JAVA_HOME/jre/lib/rt.jar) of 1.4 to see what used to be there. Lo and behold the Xalan classes were there right in the middle of rt.jar.

We then moved over to our new 1.5 install and cracked open it's rt.jar. This time the Xalan classes were hidden out of the way with a 'com.sun' prefix to every class. Obviously Sun don't want you using their shipped version of Xalan...

We decided that the best thing to do was to download a proper Xalan distro and put that in the application's WEB-INF/lib directory.

We downloaded xalan-j_2_7_0-bin.tar.gz from the UK mirror of Xalan's binaries and extracted xalan.jar & serializer.jar to be copied to our web server.

After a Tomcat restart our problem was solved!

Technorati Tags: , ,

How to restore missing transitions and effects in Windows Movie Maker

I use Windows Movie Maker (WMM) to create little movies of my 2-year old daughter so that I can burn them to DVD. The source of the footage is from my digital camcorder that takes Mini DV tapes.

It had been quite a while since I last edited one of these tapes and so was now using my recently upgraded and reinstalled PC. I opened WMM last night to edit the tape only to be confronted with a message that all the transitions and effects were missing. I don't use many of these effects but fade in/out to black is a must.

I searched around on the internet today to try and find a solution and here is one way that got it working for me:

* Open Windows Explorer (Start -> Programs -> Accessories -> Windows Explorer)
* Browse to C:\WINDOWS\inf
* Locate moviemk.inf
* Right-click on it and select 'Install'
* Pop your WinXP (service pack 2) disk in let Windows reinstall WMM
* Fire up WMM and be amazed that everything is back to normal!

I'm so pleased that I got it working again so quickly, there are many people out there that seem to have the problem and can't find a fix for it - hopefully by blogging this there will be one more solution to try!

Technorati Tags: , ,

Sorry for not blogging!

I'm having major internet connection problems at the moment with my net connection dropping every few minutes (hope it hangs in there whilst I post this!). I'm with Pipex although after tests it's looks like a problem with my BT line...

Will hopefully get a post out soon but what with Christmas shopping, last minute project dashes and no internet I can't promise anything! :)