Wednesday, November 14, 2012

MQ on a shoestring - Connection Details

Now that the necessary software has been installed, we can continue the configuration. The next item on the list is the connection details. The MQ admin needs to provide at least five pieces of information. If your admin keeps to IBM naming conventions, the setting should look similar to the following:


The username and password is required when connecting to an AS400. There may be ways to drop this requirement but within my organisation it was mandatory for all AS400 connections.

Moving back the code, add the following references.


You should be able cut and paste this and call it with relative ease.



As you can see from the above code there is a dedicated MQException. When raised, they include an additional piece of information; the ReasonCode. The following link provides an explanation of the codes and should give you enough information to do more research.

Wednesday, November 7, 2012

Marvelution APIv2 plugin fails with java.lang.NullPointerException

One of the Jenkins plugins I installed was for Marvelution JIRA Hudson Integration. All the other plugins loaded with no issues except this one. Specifically it failed to load the hudson-apiv2-plugin-5.0.4 plugin.

31/10/2012 3:06:03 PM org.apache.wink.server.internal.servlet.RestServlet init SEVERE: null java.lang.NullPointerException at com.marvelution.hudson.plugins.apiv2.wink.HudsonWinkApplication.getClassesFromPackage(HudsonWinkApplication.java:102) at com.marvelution.hudson.plugins.apiv2.wink.HudsonWinkApplication.getClasses(HudsonWinkApplication.java:78) at org.apache.wink.server.internal.application.ApplicationProcessor.process(ApplicationProcessor.java:84) at org.apache.wink.server.internal.DeploymentConfiguration.addApplication(DeploymentConfiguration.java:339)
...

Searching on the error pointed me to a ticket on Marvelution's JIRA but had been closed without a resolution posted.

Looking through the log file I found this entry.

INFO: Loading classes from Classpath Package: file:/C:/Program%20Files%20(x86)/Jenkins/plugins/hudson-apiv2-plugin-5.0.4/WEB-INF/classes/com/marvelution/hudson/plugins/apiv2/resources

When I did the initial install of Jenkins, I clicked through the default options which put Jenkins in C:/Program Files (x86)/Jenkins This got me thinking that the RestServlet didn't like the embedded spaces. I moved my Jenkins installation to C:\Jenkins and the problem was resolved.

INFO: Loading classes from Classpath Package: file:/C:/Jenkins/plugins/hudson-apiv2-plugin-5.0.4/WEB-INF/classes/com/marvelution/hudson/plugins/apiv2/resources
31/10/2012 4:33:12 PM org.apache.wink.common.internal.registry.metadata.ProviderMetadataCollector isProvider

In one of the posts on Marvelution, the poster mentions that the plugin works on production but not on their new test installation. I suspect they clicked through the install process the same way I did on their new 64bit Windows server.

Finally, a quick note on moving Jenkins.
  1. Stop Jenkins
  2. Move Jenkins directory to new location
  3. If you're using a windows service, search the registry for Jenkins.exe and amend the paths where necessary.
  4. Restart Jenkins

Wednesday, October 31, 2012

Putting TeamCity behind mod_proxy

As part of a new project I wanted to evaluate Jenkins and TeamCity on the same server. I decided that changing the root directory and placing them behind Apache using mod_proxy would be the way to go. The goal was to have two urls; http://myserver/tc and http://myserver/jenkins.

Setting up Jenkins was a simple affair but TeamCity was less straightforward. My search of putting TeamCity behind mod_proxy threw up this post: http://devnet.jetbrains.net/thread/275501. The solution posted at the end of the thread is the way to go but it didn't work on my Windows setup.

When you do the initial install, your directory structure will look similar to this:


Default TeamCity Directory Structure on Windows
Following the instructions in the post, step 1 moves the ROOT to tc (or whatever name you selected). This would give you .\webapps\tc\ROOT\. In fact you should rename ROOT to tc and end up with the structure below.


Modified TeamCity Directory Structure
My mistake was to take the move literally. I created the tc directory then called MOVE. The commands mv and MOVE will rename the current object if the destination doesn't exist.

Hopefully this will save you some time.