Jan 17

Windows Vista wireless network configuration with hidden SSID

Posted by James Netherton | Sunday 17 January 2010 12:58 PM | In Windows

I’ve been spending some time trying to get a Laptop running Windows Vista connected to a wireless network where the SSID is not being broadcast. I tried all kinds of different security settings but nothing was working. I then stumbled across the solution in this article:

Non-broadcast Wireless Networks with Microsoft Windows

When configuring the network ensure that the ‘Connect even if the network is not broadcasting’ option is checked. Can’t believe that I never thought of trying that – seems so obvious in hindsight!

Jan 12

Tomcat shutdown.sh leaves server running

Posted by James Netherton | Tuesday 12 January 2010 19:21 PM | In Java

If you’ve been using Tomcat’s shutdown.sh script and find that Tomcat hasn’t stopped, it’s probably because there are some non daemon threads still running. The JVM will not shut down until there are no active non daemon threads.

Try the following to diagnose and resolve the problem….

Find Tomcat’s process id:

ps -ef | grep tomcat

Now kill the Tomcat process using the -3 flag (SIGQUIT signal) to force a thread dump:

kill -3 tomcat process id number goes here

Once the process has stopped take a look at the tomcat log file. You should see some thread dumps which will help to identify the application and code that is hanging on to threads.

Jan 02

Ubuntu Ant FTP task NoClassDefFoundError

Posted by James Netherton | Saturday 02 January 2010 13:10 PM | In Java

I came across a problem when trying to use the Ant FTP task on Ubuntu. Whenever I tried executing my build file I kept getting:

java.lang.ClassNotFoundException: org.apache.commons.net.ftp.FTPClientConfig

The simple fix is to make sure Ant can find the Apache commons-net Jar, either from under the Ant lib directory or in a custom location.

I installed Ant using Aptitude which places all of the shared Ant jars in /usr/share/ant/lib. I was confused because there was a symbolic link to ant-commons-net.jar which I thought should contain the missing classes. Turns out this Jar is actually the Ant FTP task library, you still need to download the commons-net Jar file.

Nov 11

When should I use kill -9 ?

Posted by James Netherton | Wednesday 11 November 2009 21:05 PM | In Linux

When should I use kill -9 ?

The answer is – Rarely! Or at least only in exceptional circumstances…..

The -9 signal is the KILL signal which forces a process to immediately terminate. Many processes perform clean up operations when they terminate, perhaps to close open files, remove temporary files & directories etc. Using the -9 signal prevents a process from executing any of its shut down hooks and could potentially leave your application / system in an inconsistent state.

If a process needs to be killed, it’s often better to use the kill command on its own or use kill -15 (-15 is usually the default signal) which sends the TERM signal to the process. The TERM signal tells a process to gracefully terminate which means it will be able to run any shut down hooks and thus leave your system in a potentially nicer state than it would have been if you’d have used kill -9.

I see kill -9 used in so many inappropriate circumstances, such as in scripts to stop some service or application. Kill -9 should never be used in such cases.

The *nix man pages have a good overview of the kill command. You can also get a list of all kill signals by executing kill -l.

Oct 30

Upgrade to Ubuntu 9.10 leaves Hue setting at -1000

Posted by James Netherton | Friday 30 October 2009 20:46 PM | In Linux

After a few Google searches on this, it seems like this issue is cropping up for people with Nvidia cards…..

I upgraded Ubuntu to 9.10 and found that all of my video content was being displayed with many of the colours totally messed up – pink sky and green skins on people!

For some reason the Hue graphics setting was set to -1000. To fix it, I corrected the setting via the graphics preferences in the Totem media player and everything looked fine afterwards.

Sep 01

Fixing Firefox Problem – Firefox is already running but is not responding

Posted by James Netherton | Tuesday 01 September 2009 19:02 PM | In FireFox

If you start Firefox and you’re presented with the message “Firefox is already running, but is not responding. To open a new window, you must first close the existing Firefox process, or restart your system” don’t panic!

I found the simple solution was to start Firefox via the profile manager which prevented the message from showing up again. To start Firefox from the profile manager simply execute the command below and choose your default browsing profile.

firefox -profilemanager

Aug 17

Connecting JConsole To Eclipse

Posted by James Netherton | Monday 17 August 2009 19:43 PM | In Java

Ever wanted to connect JConsole to an application that has been launched by Eclipse???

It’s quite simple to do. Just ensure you pass the following JVM argument when launching the application…..

-Dcom.sun.management.jmxremote

Start JConsole and you should get the option of connecting the the application you launched from Eclipse.

Jul 21

ColdFusion 9 ORM Problem – java.lang.NoClassDefFoundError: javax/transaction/Synchronization

Posted by James Netherton | Tuesday 21 July 2009 19:59 PM | In ColdFusion

I have the CF9 Beta deployed as a WAR file under Tomcat 6. I was trying to test out the ORM stuff and hit a strange problem. Whenever I tried to call any of the CF ORM functions, the request would suddenly die. Looking at the application server logs I noticed lots of entries like:

java.lang.NoClassDefFoundError: javax/transaction/Synchronization

For some reason I didn’t seem to have jta.jar (required library for Hibernate), so I added it manually to the CF lib directory and everything started working properly.

Wonder if anyone else has had this problem???

May 02

Installing Firefox Java Plugin on 64 Bit Ubuntu

Posted by James Netherton | Saturday 02 May 2009 21:40 PM | In Java, Testing

Finally! – I’ve got Java working in Firefox again after upgrading to Ubuntu X64. Lots of guides I found mention installing the 32Bit version of Firefox and the Java runtime. There’s no need for any of this. Just follow the simple guide here:

http://yokohead.com/2009/02/installing-java-x64-in-ubuntu-810/

Apr 22

Debugging a Java Web Start application from Eclipse

Posted by James Netherton | Wednesday 22 April 2009 17:52 PM | In Java

I just spent some time debugging a weird problem that was only occurring when an application was launched via Java Web Start. Something I found useful was being able to attach the Eclipse Java debugger to the application process. Here’s how to set this up.

From the command line execute (In windows use set instead of export):

export JAVAWS_VM_ARGS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y"

In Eclipse, configure a new debug configuration by choosing menu options Run -> Debug Configurations. Find the ‘Remote Java Application’ section, right click and choose ‘New’.

Change the port number to whatever you specified when setting up the JAVAWS_VM_ARGS environment variable. Click the apply button and close the window.

Now start your application:

javaws http://hostname:port/yourjnlpfile.jnlp

You can now attach the Eclipse debugger to the process by running the debug configuration you just set up. Set some breakpoints in your code and you should find the application suspends at the relevant points where you can debug the application as per normal.

Mar 25

Installing Java 1.5 on Mac OS X Panther

Posted by James Netherton | Wednesday 25 March 2009 21:49 PM | In Java, Mac

There is no official support for running / installing Java versions greater than 1.4 on Mac OS X Panther. Here’s how I installed and configured my old Mac Mini G4 OS X Panther machine to run Java 1.5.

1. Download and install Pacifist

2. Download Java 1.5 from the Apple website and run the .dmg file

3. Start Pacifist. Drag the .pkg install file from the mounted Java .dmg file. Select the root of the package hierarchy and click the install button

4. When prompted to overwrite existing files choose ‘Leave Alone’

5. When the installation process has completed you can now set the default Java VM to 1.5. Open a terminal session and run the following:

cd /System/Library/Frameworks/JavaVM.framework/Versions
sudo ln -fhsv 1.5 CurrentJDK

Confirm that everything has worked by executing java -version from the command line.

Feb 20

Eclipse Tip – Show heap status

Posted by James Netherton | Friday 20 February 2009 21:57 PM | In Programming

I can’t believe I never knew about this!

In Eclipse choose menu option Window -> preferences. Then check the option ‘Show Heap Status’. A new item will appear within the window status bar which shows the amount of heap space currently being used. The cool bit is that there’s a button that allows you to run the garbage collector to free up some heap space.

It comes in handy if you find Eclipse starts getting slow when it approaches the maximum allowed limit of heap space.

Feb 13

Party Like It’s 1234567890

Posted by James Netherton | Friday 13 February 2009 22:08 PM | In Linux

*nix geeks will soon be celebrating the moment when Unix time reports the magic 1234567890 sequence of numbers. It’ll occur at 23:31:30 UTC. To keep track of things, run the following from the command line :)

watch -n 1 date +%s

Feb 03

Installing The Java Web Browser Plugin On Ubuntu

Posted by James Netherton | Tuesday 03 February 2009 19:09 PM | In Linux

For some reason Ubuntu by default installs the Java 1.6 open JDK but doesn’t seem to include the Java web browser plugin for Firefox. It took me a while to figure out how to add it. Run the following from the command line:

sudo apt-get install sun-java6-plugin

Jan 26

Deploying ColdFusion on Tomcat under Ubuntu

Posted by James Netherton | Monday 26 January 2009 7:00 AM | In ColdFusion, Linux

I spent ages trying to get ColdFusion working properly with Tomcat 6 on Unbuntu. Tomcat wouldn’t start the ColdFusion application sever and the logs were getting full of exceptions moaning about the inability to access certain resources. For example:

java.security.AccessControlException: access denied (java.util.PropertyPermission coldfusion.classPath read)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:342)
at java.security.AccessController.checkPermission(AccessController.java:553)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
at java.lang.SecurityManager.checkPropertyAccess(SecurityManager.java:1302)
at java.lang.System.getProperty(System.java:669)

Eventually I came across a solution posted to House Of Fusion in 2007. Open up your catalina.policy file, comment out what’s in there and add the line:

permission java.security.AllPermission;

It’s a bit of a hack – but it works! This is obviously something that you wouldn’t want to do on a production machine!