Tuesday, April 13, 2010

Adding Security Certificate to JVM to handle SecurityCertificateError

Handling SecurityCertificateError exception in JAVA by adding security certificate using Keytools

To add the security certificate for https URL the following steps needs to be followed

  • Take a backup of cacerts file in the following directory (This can be your default JRE directory also) C:\Program Files\IBM\SDP70\runtimes\base_v6\java\jre\lib\security\
  • Save the security certificate in some location for ex c:\certificate.cer
  • Go to Run type cmd
  • Execute CD C:\Program Files\IBM\SDP70\runtimes\base_v6\java\jre\bin (This is the location of the JRE WebSphere uses, in other environments please navigate to the JRE BIN the application uses)
  • Then execute the following command
(SYNTAX Keytool –keystore – import – file -alias<> )

Command
keytool -keystore "C:\Program Files\IBM\SDP70\runtimes\base_v6\java\jre \lib\security\cacerts" -import -file c:\certificate.cer -alias https://your-url.net

  • It will ask for a password , enter changeit
  • The security certificate will be added for the JRE

Now you can access the URL or access the webservice in the URL.

Friday, April 2, 2010

Fire bug - An invaluble tool for debugging

If you have been into web programming, you will know its hard to develop front screens than to write the backend business classes. Also debugging Java Script is also a head headache. Fire Bug is a plugin for firefox that saves valuble time in web application development. It has nice features like inspecting the html elements, it shows the CSS applied. You can also see the Java Script.

You can also view POST headers that are sent to the server. One more interesting feature is you can edit the HTML in the browser and see it work.




The above picture is a snap shot of the Firebug tool. You cant use it in IE , one close too that is a substitue for it in IE is Fiddler , but it no where comes close to Firebug in terms of the richness of features.

Setting JAVA HOME through Command Line in Windows

Hi all,
If you are working on some old windows machines and want to set JAVA_HOME and PATH environment variables follow the steps.

Start --> Run-->CMD .. In the command prompt first type


echo %JAVA_HOME% , if the JAVA_HOME variable is already set the path will be printed.
eg: c:/Program Files/java1.6

else %JAVA_HOME% will be printed.

You can set JAVA_HOME by typing

SET JAVA_HOME = c:/Program Files/Java (The path where your JRE or JDK is installed)

Then you can set the bin path by typing

SET PATH = %PATH%;%JAVA_HOME%\bin what you are doing here is appending the existing set PATH's with JAVA_HOME/bin.

You can also directly set the path to the JAVA Bin directory instead of the above steps like
SET PATH = %PATH%;c:/Program Files/JAVA/bin

Then if you want to view the set path you can type echo %PATH% ..