Thursday, August 5, 2010

Hudson, Ubuntu 10.04 and OpenJDK

Yesterday, I was trying to install and run Hudson server on my Ubuntu 10.04 VM. I was constantly getting the following error message. I even tried to create a slave on this Virtual Machine from my Windows Master, and even that was not working. The error message was :

java.security.ProviderException: Could not initialize NSS
 at sun.security.pkcs11.SunPKCS11.(SunPKCS11.java:201)
 at sun.security.pkcs11.SunPKCS11.(SunPKCS11.java:103)
 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
 at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
 at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
 at sun.security.jca.ProviderConfig$3.run(ProviderConfig.java:262)
 at sun.security.jca.ProviderConfig$3.run(ProviderConfig.java:244)
 at java.security.AccessController.doPrivileged(Native Method)
 at sun.security.jca.ProviderConfig.doLoadProvider(ProviderConfig.java:244)
 at sun.security.jca.ProviderConfig.getProvider(ProviderConfig.java:224)
 at sun.security.jca.ProviderList.getProvider(ProviderList.java:232)
 at sun.security.jca.ProviderList.getService(ProviderList.java:330)
 at sun.security.jca.GetInstance.getInstance(GetInstance.java:157)
 at java.security.Security.getImpl(Security.java:696)
 at java.security.AlgorithmParameters.getInstance(AlgorithmParameters.java:130)

I wasn't able to find anything related to this exception in the Hudson user groups. A simple test to make sure I was running the correct version of Java, helped fix things. The VM was running openJDK, and after linking to the correct Sun JDK the problem went away. I was able to run the master on this VM< and also on a similar VM was able to run the slave as well.

meera@ubuntu:~/src/meera$ java -version
java version "1.6.0_20"
Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
Java HotSpot(TM) Client VM (build 16.3-b01, mixed mode, sharing)

So, if in case you see this error next time, make sure and check which Java you are using.

Tuesday, August 3, 2010

Hudson and CLI

I have been doing some very neat stuff using Hudson the past couple of weeks. This is something which is really awesome, and am amazed at Hudson every time I use it. Hudson has a built-in command line interface which I have been using recently. I didn't find good documentation for doing some simple things like creating a job, copying a job and so on.. Hence, decided to write a blog entry so would help me and many others as  well.

First and foremost is to download the cli library, and you can do so easily from the Hudson-> Manage Hudson ->Hudson CLI link as shown below.

Now, click on the link and you will be presented with another page, were you click the download hudson-cli.jar link.
 

Next, open a command line and browse to where the hudson-cli.jar was downloaded, or even better copy to your favorite location.

At this point you should be able to run commands to create a job, enable a job, disable, copy and also delete a job. So, lets look at some of the commands.

1. Display help
java -jar hudson-cli.jar -s http://localhost:7223/ help


2. Create a Job, use the following command. config.xml is a sample configuration file which hudson needs for creating a job. You can find one in the hudson home folder. You also need to provide the configuration file next to the job name. Double click on the image below to see the parameters for passing in the configuration file. For some reason, each time I tried entering the same, blogpost automatically reformatted the same.
java -jar hudson-cli.jar -s http://localhost:7223/ create-job meera



If you go to the hudson main page, you should be able to see a new job called meera created.


Lets see a few more commands which can be executed:

3. Copy Job
java -jar hudson-cli.jar -s http://localhost:7223/ copy-job meera copy-meera

4. Disable a Job
java -jar hudson-cli.jar -s http://localhost:7223/ disable-job meera

5. Enable a Job

java -jar hudson-cli.jar -s http://localhost:7223/ enable-job meera

6. Delete a Job
java -jar hudson-cli.jar -s http://localhost:7223/ delete-job meera

Once you get an idea of how to use the command line interface, it is very easy to automate many things by using this interface.

I am also working on creating  a JAVA API for using the Hudson Remote API, and also a few build scripts as well. Will keep this blog updated on each of those as soon as I have them working.

Monday, August 2, 2010

Doxygen and Python

I had written several articles on Javalobby on a couple other blogs on using Doxygen. You can read the posts with all the links at Javadoc or Doxygen.

I have been using and working on Python the last couple of months. On Friday, I integrated Doxygen with Pyhton on my Ubuntu machine and hence this post to document the details of the same.
  1. Download and install doxygen using the following command:
  • sudo apt-get install doxygen
  • Once installed, run doxygen -g to generate the default configuration file.  I renamed this as Doxyfile.config.

2.Download and install
  • doxypy from http://code.foosel.org/doxypy

3. Now change to the directory where doxypy is extracted and cd doxypy-0.4.2/run,  
        sudo python setup.py install
4. Now, assuming doxygen and doxypy is correctly installed, run the following command:
       doxygen Doxyfile.conf

Once you have the documentation generated, you can publish the results on the Hudson dashboard. See the earlier link to tutorials to do the same.