NetBeans 6.5 RC

I got to know of saying “Never say never and never say always” from some source (which I don’t recall), which is all the more applicable in our fickle Java ecosystem.

I have been using Eclipse all this while and have defended religiously too. But going through the features/options NetBeans latest version 6.5 RC, makes me feel that Eclipse is some (rather a lot) catchup to do when it comes to JEE lineup support.

So being a ardent Eclipse user (to the extent that I have said, I will never use any other IDE), I’m going to give NetBeans 6.5 a try (that’s why never say never) and find out if I can be more productive when doing JEE development.

SSL handshake_failure while doing Mutual Authentication

Friend of mine recently had one issue with SLS Mutual Authentication (aka Client Authentication) that server was failing with error “Re-negotiation handshake failed: Not accepted by client!” and at client side it was throwing following error.

Caused by: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
        at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:150)
        at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:117)
        at com.sun.net.ssl.internal.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:1650)
        at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:925)
        at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:739)
        at com.sun.net.ssl.internal.ssl.AppInputStream.read(AppInputStream.java:75)
        at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
        at java.io.BufferedInputStream.read(BufferedInputStream.java:235)

After all the debugging to make sure all the required system parameters are specified like keyStore and trustStore and wasting lot of time, it was found out that the certificate the client was using had some issues with private/public keypair.

So if you get into this above issue or any other issues related to SSL connectivity, check out the certificate you are using on both sides. Even better try out the SSL Connectivity with simple client/server ssl app and make sure it is working then try out in the real application.

Well for same friend, I actually wrote a simple client/server SSL app which which let’s client/server exchange some user keyedin data.

Here is how to use it.

1. Download the source and class files from here and extract to a folder.

2. Put your certificate files (you can rename your certificate files as client.jks/server.jks or change the parameters in the bat files)

3. Run server.bat, which starts a server on port 7001 (you can pass parameter “true”, which enables the client authentication else disables it)

4. Run client.bat and notice that it is talking to server and finishing the handshake. To confirm client is communicating with server, type some text and notice that it is echoed back by the server.

Here is the sample output.

Client:


C:\Projects\EclipseWorkspace\SSLTest\temp>client

Connecting to the server at localhost:7001
Connected to the server.
Type something and press enter. Whatever you type will be sent to the server, which will echo back.

SSL Handshake Completed with following details:
CipherSuite: SSL_RSA_WITH_RC4_128_MD5
LocalPrincipal: CN=Client Test, OU=Java Unit, O=Java Company, L=Java City, ST=Java State, C=US
RemovePrincipal: CN=Server Test, OU=Java Unit, O=Java Company, L=Java City, ST=Java State, C=US
Session: [Session-1, SSL_RSA_WITH_RC4_128_MD5]
Socket: 1f33675[SSL_RSA_WITH_RC4_128_MD5: Socket[addr=localhost/127.0.0.1,port=7001,localport=3206]]
hello
hello
world
world

Server:

C:\Projects\EclipseWorkspace\SSLTest\temp>server true
Enabling client authentication

Listening for a new connection at port 7001
Connection accepted from /127.0.0.1:3206

SSL Handshake Completed with following details:
CipherSuite: SSL_RSA_WITH_RC4_128_MD5
LocalPrincipal: CN=Server Test, OU=Java Unit, O=Java Company, L=Java City, ST=Java State, C=US
RemovePrincipal: CN=Client Test, OU=Java Unit, O=Java Company, L=Java City, ST=Java State, C=US
Session: [Session-1, SSL_RSA_WITH_RC4_128_MD5]
Socket: 7c6768[SSL_RSA_WITH_RC4_128_MD5: Socket[addr=/127.0.0.1,port=3206,localport=7001]]

Hope this helps.

Google I’m feeling lucky in Firefox Address Bar

Not many might not have used, if not noticed about the Google Lucky search feature. Instead of clicking on Search button, if you click on “I’m Feeling Lucky”, Google would automatically redirect to the first result. This would be very useful many times, if you want to select the url from bookmarks or type the full address. Even better is adding a Search Keyword in Firefox so you can just type “gl ” and have it taken automatically to the url. Here is how to add your firefox.

1. Download this search plugin xml and add to the “Mozilla Firefox\searchplugins” folder. In Windows, it would be “C:\Program Files\Mozilla Firefox\searchplugins”.

2. Open your Firefox browser and select “Manage Search Engines…” in the Search box

3. Select “Google Lucky” on the list of Search Engines and Click on “Edit Keyword”

4. Enter gl as the keyword and Click Ok (twice)

5. You are good to go, give it a try. Type “gl java 1.5 api” and notice that you are taken automatically to the Java 1.5 API Spec in Java.