Saturday, June 28, 2008

Changing Context Path of Hudson

Just a quick tip for whoever wants to change the context path of Hudson stand-alone continuous integration server. It runs on Winstone, simply adds the --prefix=/${context.path} to the start-up command.

Yes, they named it "prefix".

- yc

'publickey' SSH Authorization fails if 'authorized_keys' file is writable by non-owners

I didn't realize this. SSH kept prompting me to fill in password even though I forced it to use just 'publickey' authorization:

$ ssh -i id_kimmy -v
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering public key: /home/yclian/.ssh/id_rsa
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /home/yclian/.ssh/identity
debug1: Trying private key: /home/yclian/.ssh/id_dsa
debug1: Next authentication method: password's password:

ssh -i id_kimmy -o 'PreferredAuthentications publickey' -v
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering public key: /home/yclian/.ssh/id_rsa
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /home/yclian/.ssh/identity
debug1: Trying private key: /home/yclian/.ssh/id_dsa
debug1: No more authentication methods to try.
Permission denied (publickey,password).

Fixed by revoking write permissions (chmod 700) to the authrozied_keys file. Very simple logic, brrr.

Some links that I came across:

- yc

Friday, June 27, 2008

Maven does NOT support SOCKS for HTTP

I have a internal repository which can only be accessed through SOCKS, so I thought, if I set up a <proxy> in settings.xml with SOCKS_5 as its protocol, it shall work -- to download artifacts from the repository through the proxy. By the way, the documentation is not clear about what you should specify for the protocol. I used SOCKS_5 because ProxyInfo sounded right.

After a few attempts, I realized from the error logs that Maven did not go through the SOCKS proxy I defined, it basically skipped it. I hooked my IDE to the process to for some debugging to realize that Wagon (the transport abstraction of Maven) chose to use LightweightHttpWagon to download the artifacts and would only know how to deal with HTTP based proxy. Wagon chose it by looking up for Plexus component with the role-hint of http, damn.

I believe I could create a local repository by mounting the remote end using FUSE/sshfs. I didn't anyway, I made HTTPd to allow external connections to the repository with basic auth enabled (the server uses Archiva anyway). That's quick and at least I wouldn't have to guess why scp or file wasn't working later.

Playing with Maven is a pain, sometimes.. or most of the time if it doesn't work.

P/S: If you can really make Maven to work with HTTP+SOCKS, let me know and tell me that I'm wrong.

- yc

Monday, June 16, 2008

WTF is wrong with RMI

Yes, WTF is wrong with RMI. Taken from the "Getting Started using RMI" page:

Note: Before you start the rmiregistry, you must make sure that the shell or window in which you will run the registry either has no CLASSPATH set or has a CLASSPATH that does not include the path to any classes that you want downloaded to your client, including the stubs for your remote object implementation classes.

If you start the rmiregistry, and it can find your stub classes in its CLASSPATH, it will ignore the server's java.rmi.server.codebase property, and as a result, your client(s) will not be able to download the stub code for your remote object. For an explanation of how code downloading works in RMI, please take a look at the tutorial on Dynamic code downloading using RMI.

UPDATED: Omg :) That's documentation for 1.4.2. If you refer to the latest one, it actually highlights on the classDir. So ultimately, my problem of not referring to a newer documentation.

Not paying much attention to these lines, it got me wasted a few valuable hours to get a simple example working. I have a Hello interface and a HelloImpl implementation with a main method in it to do the binding.

I kept getting either:

java.lang.ClassNotFoundException: foo.Hello
at Method)


java.lang.ClassNotFoundException: foo.HelloImpl_Stub
at Method)

Whenever I ran:
java -classpath classes/ foo.HelloImpl

The error is misleading. It made me wondered why Java would complain about ClassNotFoundException when those classes were in the classpath! To put that paragraph in bullet points:

  • Please set the CLASSPATH variable before you run rmiregistry, e.g.
    export CLASSPATH=classes/
    rmiregistry &
    java -classpath classes/ foo.HelloImpl

  • Or, please set the -Djava.rmi.server.codebase system property to point to your classpath when you start your application, e.g.
    rmiregistry &
    java -Djava.rmi.server.codebase=file:classes/ -classpath classes/ foo.HelloImpl

Yes, it was actually my problem of not reading the documentation clearly. But can't just the Java guys fix it so that it will pick up from the classpath without setting either the environment variable or system property?

- yc, rants!!

Sunday, June 8, 2008

Can't call method "value" on an undefined value at /usr/share/perl5/IO/Uncompress/ line 64

I tried to install SocialText Open about two weeks ago and it had then screwed up my CPAN. This is the error that showed whenever I tried to install a module:
Can't call method "value" on an undefined value at /usr/share/perl5/IO/Uncompress/ line 64

For not being a Perl user (I'm a Java guy after all and a Linux end-user), I went to #perl of to seek for some help and I was asked to raise a bug instead in the Ubuntu site. I didn't do it nor tried to fix it after that as I was stuck with other higher priority tasks.

I have a little bit more time this afternoon so I asked Google for an answer and it appeared to have more results this time (two weeks ago, it had just two entries). That basically has concluded that this is a pretty new problem on Debian/Ubuntu.

Removing libcompress-raw-zlib-perl solved my problem, as suggested by nxadm. You may also want to try other options provided by other blog readers if you hit into similiar issue.

Good luck messing with Perl.

- yc

Saturday, June 7, 2008

PGP Signing and Encrypting Emails

In our company, we use PGP to sign or sometimes encrypt emails due to the agreement with customers who demand high security. However, as for my personal mails, I have never put PGP into the equation.

So I spent some time in the afternoon to set up PGP for my personal accounts (and got the chance to play around with revocation too). I got myself to set up Enigmail too, a Thunderbird extension to manage PGP keys and your mails with them. As a Linux user, I actually use GnuPG more (and it works, I'm not sure why uploading keys to MIT server failed a few times on my browser and Enigmail) and here are the commands to share, for GnuPG and support for OpenPGP:
gpg --gen-key
gpg --export >
gpg --export-secret-keys >
gpg --armor --export >
gpg --armor --export-secret-keys >
gpg --armor -a --export >
gpg --armor -a --export-secret-keys >

Remember to protect these files, e.g. chmod 700 *.

I will be digitally signing my emails from now on anyway and whenever necessary encrypt them. Here is my public key for, which you can also find in the MIT key server:
Version: PGP Key Server 0.9.6
Comment: PGP public key for


I have a question, where would be the best place to store my private keys? I actually had them packed in a protected zip and sent over the wire to somewhere. The sites returned by Google suggest to do paper or disk backup.

Now if every one in this world uses PGP and applications are built with its support, will people still be the victims of phishing?

- yc

Friday, June 6, 2008

Some Status Update

Haven't been blogging much as I have been busy with some stuff lately, although I have been heavily blogging in CustomWare's intranet, like one blog or two blogs per day. This is a quick blog to update you about what I'm up to these days.

We, the Malaysian Java User Group, just had a meeting two weeks back and we want to keep this momentum up. Naresh has volunteered himself to speak on Spring and what we have to do right now is to bake when and where it will be.

The Malaysian Flex User Group had a "write a review for Flex builder 3 and win a free license" event not too long ago. I got one. :) Here is the review.