How to fix an inaccessible ec2 instance after upgrading to Ubuntu 10.04

May 31, 2010 – 20:38

I’ve been hosting this server on an EC2 instance since New Year. Over the long weekend I decided to upgrade it to Ubuntu 10.04. When all the upgrade is done and the instance is restarted, I find myself locked out of the server – can’t ssh, can’t even ping. The instance actually fails to boot up (I found out about that by attaching the root volume to another instance and examining the logs). So it’s clearly a mismatching kernel issue – the instance still boots with the 9.10 stock kernel, which wouldn’t work when the rest of the system has been upgraded to 10.04.

I fixed the problem by following Eric Hammond’s article on how to Move a Running EBS Boot Instance to New Hardware on Amazon EC2. His original article was for scenarios where the instances become inaccessible due to power failures, but the methodology worked out in my case just fine.

When does Ivy:deliver not replace dynamic revisions?

March 28, 2009 – 23:27

When publishing a module, Ivy:deliver (and in turn, publish) has the ability to replace dynamic dependency revisions (e.g. ranges like “2.5+”) with the specific revisions resolved. One thing that is not very obvious is that, since the task relies on the latest resolve results to figure out what exactly those dynamic revisions are resolved to, if the latest resolve is a partial one – meaning only some of the confs are resolved, ivy:deliver may not be able to see all the resolved revisions.

I discovered this when I changed my build script to only resolve ‘master’ before publishing a snapshot to a local repo, because I wanted local publishes to be extremely fast. I guess it’s ok for local snapshots to carry dynamic revisions, but it’s probably a good idea to always do a full resolve before publishing a release.

An Ant Task to Maintain Eclipse Classpaths with Ivy Resolve Results

February 13, 2009 – 00:21

I put together an Ant task(download) that can use the result of the ivy:resolve task to maintain Eclipse’s .classpath file. If your ivy:resolve also generates references to the source jars, this task will also attach them to the corresponding classpath entries in the .classpath file. more…

Eclipse, Mac OS X, JDK 1.6

January 21, 2009 – 09:38

Question: how do you not want to start an unseasonably cold Northern Virginia winter morning?
Answer: have some chill down the spine when you fire up Eclipse on your Mac Book Pro Toy(tm), only to get hit by this mysterious error message:

_NSJVMLoadLibrary: NSAddLibrary failed for /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Libraries/libjvm.dylib
JavaVM FATAL: Failed to load the jvm library.

As the initial “oh crap now we don’t have Bush to blame it on” panic settles in, you realize since the last time Eclipse ran fine, you did go in there and tinkered with that “CurrentJDK” stuff, so that JDK 1.6 instead of 1.5 would be the default.

So you start googling frantically and find, through the first link returned, this neat solution by rkischuk. The only difference is that the file you have to edit is located at:

${ECLIPSE_HOME}/Eclipse.app/Contents/Info.plist

Hmm…, and when Steve Jobs said “Java’s not worth building in,” you thought he was only talking about the iPhone.

Fix broken maven-metadata.xml through Nexus

January 17, 2009 – 21:41

The log4j maven-metadata.xml hosted at ibiblio is missing the latest two versions, 1.1.14 and 1.1.15. It becomes a problem for me as an Ivy user, too, since Ivy 2.0 adds the ability to use maven metadata to list available versions.

Fortunately I have a Nexus repository as the aggregator/proxy to all the external repositories. Brian from the Nexus IRC room pointed me to this solution/workaround: add the fixed maven-metadata.xml to a repo hosted by Nexus – e.g., the “3rd Party” repo coming out of box in Nexus. Then create a group to aggregate the 3rd Party and the public Ibiblio repos. The “virtual” group repo will automatically create a merged maven-metadata.xml on the fly whenever it is requested.

And it works like a charm. Thanks, Brian!

Hibernate more picky on character type discriminators

November 20, 2008 – 22:15

On a project I’m working on, I’ve got one abstract base class and two subclasses, which are mapped to one same table, with a single character column as the discriminator. I got this error when Hibernate initializes:

org.hibernate.MappingException: multiple or zero characters found parsing string

Turns out if the discriminator type is “character”, the base class must have a discriminator-value attribute declared, even though obviously due to the abstractness there will never be any row carrying that discriminator value. And apparently for “string” type discriminators, there isn’t such a limitation.

Weird git gui startup problem

November 9, 2008 – 15:15

This has happened to me for a while every time after I build and install the latest git, but I didn’t really get to the bottom of it until just now. My tinfoil hat umask setting, 0027, finally came around and bit me! more…

Hardy to Intrepid

November 2, 2008 – 18:11

I was planning on giving it a week before upgrading my desktop to the new Ubuntu 8.10 Intrepid Ibex, but couldn’t find better things to do on the mild sunny classic Virginian Saturday afternoon than hunching over a computer in the darkest corner of a basement… more…

Retab files using vim

November 2, 2008 – 17:44

Use tabs as much as possible:
vim -u NONE -c "set noet" -c 'retab! 4' -c wq filename
Use spaces as much as possible:
vim -u NONE -c "set et" -c 'retab! 4' -c wq filename

Eclipse + Vim = Eclim

October 22, 2008 – 19:58

I tried Eclim some time last year. I thought the idea of tackling the eclipse/vim-integration situation from a completely different angle was very clever, but the implementation wasn’t quite there. I couldn’t even get through the installation. more…