Show me the code! – By Davanum Srinivas

May 6, 2012

Deploying a Scala based Servlet in Liberty

Filed under: websphere — Tags: , , — Davanum Srinivas @ 8:16 pm

Fetch the scala servlet sample using git:

dims@dims-laptop-520:~$ git clone git://

Take a peek at the servlet code:

package org.peat.scalaservlet

import javax.servlet.http._
import javax.servlet._

class Example extends HttpServlet {

  override def doGet(request: HttpServletRequest, response: HttpServletResponse) = response.getWriter().println( exampleContent )

  def exampleContent(): String = { "Hello world, from a Scala servlet!" }

Build the sample using maven:

dims@dims-laptop-520:~/scala-servlet$ mvn war:war

Follow instructions from the following url to deploy the ScalaServlet.war:

Don’t forget to enable the servlet feature in the defaultServer/server.xml. Once the server is started peek at the logs

dims@dims-laptop-520:~/wlp$ cat ./usr/servers/defaultServer/logs/trace_12.05.04_22.50.54.0.log
[04/May/2012 22:50:54:141 -0700]  00000001 * id= [AUDIT   ] CWWKE0001I: The kernel was launched.
[04/May/2012 22:50:55:645 -0700]  0000001d * id=            [AUDIT   ] CWWKF0007I: A feature update is starting after 1.735 seconds.
[04/May/2012 22:50:55:682 -0700]  00000001 * id= [AUDIT   ] CWWKE0002I: The kernel started after 1.774
[04/May/2012 22:50:56:263 -0700]  00000016 * id=       [AUDIT   ] CWWKZ0058I: Application monitor started after 2.353 seconds.
[04/May/2012 22:50:56:265 -0700]  0000001d * id=            [AUDIT   ] CWWKF0008I: The feature update is complete after 2.356 seconds.
[04/May/2012 22:50:56:314 -0700]  0000001f * id=                    [AUDIT   ] CWWKO0219I: TCP Channel defaultHttpEndpoint has been started and is now listening for requests on host localhost  (IPv4: port 9080.
[04/May/2012 22:50:56:805 -0700]  00000020 * id=                     [AUDIT   ] CWWKT0016I: Web application available (default_host): http://localhost:9080/ScalaServlet/*
[04/May/2012 22:50:56:811 -0700]  00000020 * id=                    [AUDIT   ] SRVE9998A: Application ScalaServlet added to web container.
[04/May/2012 22:50:56:814 -0700]  00000020 * id=              [AUDIT   ] CWWKZ0001I: The application ScalaServlet has started successfully.

All’s well, now just point your browser to http://localhost:9080/ScalaServlet/

May 3, 2012

Developers Kit for Pure Application System

Filed under: Uncategorized — Davanum Srinivas @ 11:54 am

The deployment engine / kit for Pure Application System is available to try as a vmdk –  There is also a developerworks guide with a 5 part series that dives deep as well. See to get started.

January 4, 2012

Follow a user in Lotus Connections 3.0

Filed under: Uncategorized — Tags: , — Davanum Srinivas @ 3:35 pm

One main feature in Lotus Connections 3.0 is the asymmetric follow of someone (like twitter). The API documentation is here. Since sample code is always better here’s a HTTP GET python snippet to lookup the userid, given an email and then a quick HTTP POST to follow that user.

import sys,urllib,urllib2,traceback,base64
from xml.dom import minidom

xml_data_header = """
<?xml version="1.0" encoding="UTF-8"?>
<entry xmlns="">
   <category term="resource-follow" scheme=""></category>
   <category term="profiles" scheme=""></category>
   <category term="profile" scheme=""></category>
   <category term="
xml_data_footer = """
" scheme=""></category>

if len(sys.argv) != 4: 
        print 'Usage: follow <userid> <password> <email-of-user-to-follow>' 

base64string = base64.encodestring('%s:%s' % (sys.argv[1], sys.argv[2]))[:-1]

def getUuidForUser(email):
	uri = "" % email
	req = urllib2.Request(uri)
	req.add_header('Authorization', "Basic %s" % base64string)
	dom = minidom.parse(urllib2.urlopen(req))
	element = dom.getElementsByTagNameNS('', 'userid')[0]

def followUser(uuid):
	uri = ''
	query_string_values = {'source': 'profiles', 'type'  : 'profile'}
	payload = '%s%s%s' % (xml_data_header, uuid, xml_data_footer)

	try :
		if query_string_values:
		    uri = ''.join([uri, '?', urllib.urlencode(query_string_values)])
		req = urllib2.Request(uri, data=payload)
		req.add_header('Authorization', "Basic %s" % base64string)
		response = urllib2.urlopen(req)
	except urllib2.HTTPError, error:

print followUser(getUuidForUser(sys.argv[3]))

October 10, 2011

WAS 7.0 Eclipse plugin (IBM WebSphere Application Server 7.0)

Filed under: websphere — Davanum Srinivas @ 2:14 pm

You can install a Eclipse plugin that works with IBM WebSphere Application Server 7.0 from the Eclipse Marketplace. Yes, In addition to supporting WebSphere Application Server v8.5 Alpha Liberty Profile, v8.0, it also supports the v7.0.

If you don’t have Eclipse Marketplace installed, Add a new site/repository for software updates –

See screen shot below:
Eclipse Plugin for WebSphere 7.0

October 8, 2011

Quick Start for WebSphere Liberty Profile – Deploying a WAR

Filed under: Uncategorized — Davanum Srinivas @ 12:58 pm

Download the WebSphere Application Server V8.5 Alpha Liberty Profile from:

Create a new web app using maven:

Unzip the server:

dims@dims-desktop:~$ unzip -q Downloads/

Let’s use the default server for deploying our war

dims@dims-desktop:~$ cd was4d/usr/servers/defaultServer/

See which features are enabled

dims@dims-desktop:~/was4d/usr/servers/defaultServer$ cat server.xml
<server description="new server">

<!-- Enable features -->


Add support for servlet and jsp’s

dims@dims-desktop:~/was4d/usr/servers/defaultServer$ vi server.xml
dims@dims-desktop:~/was4d/usr/servers/defaultServer$ cat server.xml
<server description="new server">

<!-- Enable features -->


Create a directory for dropping in our WAR

dims@dims-desktop:~/was4d/usr/servers/defaultServer$ mkdir dropins
dims@dims-desktop:~/was4d/usr/servers/defaultServer$ cd dropins/
dims@dims-desktop:~/was4d/usr/servers/defaultServer/dropins$ cp ~/my-webapp.war .
dims@dims-desktop:~/was4d/usr/servers/defaultServer/dropins$ cd ../../../..

Start the server

dims@dims-desktop:~/was4d$ date
Sat Oct 8 13:50:50 EDT 2011
dims@dims-desktop:~/was4d$ bin/was4d start
Starting defaultServer ...

Let’s see how long it took…just a few seconds.

dims@dims-desktop:~/was4d$ date
Sat Oct 8 13:50:56 EDT 2011

That’s it, point your browser to http://localhost:9080/my-webapp/

More information can be found at:

September 20, 2011

IBM SDK Java(TM) Technology Edition Version 7.0 is now available IBM DeveloperWorks

Filed under: Uncategorized — Davanum Srinivas @ 7:07 am

New Java features include:

  • NIO2 asynchronous I/O, JSR 203
  • New java.util.concurrent features including the fork/join framework
  • Better support for dynamic languages with the implementation of Invoke Dynamic, JSR 292
  • Small language changes (Project Coin)

IBM is introducing:

  • Balanced GC policy targeting short and consistent pause times on large heaps
  • More detailed and efficient format for verbose GC
  • Significant diagnostic improvements, including enhancements to javacore.txt contents
  • Shared classes cache supports additional content, better diagnostics, a programmable interface and improved control over file permissions and displaying cache contents
  • Real-time, incremental GC policy included for evaluation
  • Significant improvements in throughput, footprint and startup performance
  • Exploitation of Power7 and z196 hardware
  • Closer alignment with OpenJDK

IBM DeveloperWorks:

September 19, 2011

Apache Axis – 10 years

Filed under: Uncategorized — Davanum Srinivas @ 7:19 pm

My very first patch to Apache Axis was 10 years + 1 week ago:

Apache Axis was started 10 years + 9 months ago:

Roller coaster ride through life in general since then. Good friendships and Good times!

September 13, 2011

Compile/Install msn-pecan on ubuntu

Filed under: Uncategorized — Davanum Srinivas @ 11:30 am

msn-pecan is an alternative to the MSN plugin in pidgin. But the versions in the ubuntu repos are old. Here’s a quick 5 steps to compile/install msn-pecan on ubuntu.

  • sudo apt-get install libpurple-dev git-core
  • git clone git://
  • cd msn-pecan
  • make
  • sudo make install

August 29, 2011

iPhone and a bit of Rain

Filed under: Uncategorized — Davanum Srinivas @ 5:29 pm

Last week we were at the Animal Kingdom down in florida we ran into a bit of rain. I quickly wore a rain jacket and transferred the iPhone to the more drier pocket of the rain jacket, but the iPhone got a bit wet anyway. The iPhone shut off by itself and i could feel the battery draining. Back at the hotel, after a bit of research, found that thankfully the sensors had not tripped. I popped open the sim card and dried it with a hair dryer for about 5-10 mins and dropped it into a snack bag with rice. Left the iPhone alone for a couple of days with periodic drying with the hair dryer and it’s now working as well as it was. Whew!

August 16, 2011

Plugin Development kit for IBM Workload Deployer

Filed under: Uncategorized — Davanum Srinivas @ 8:39 am

is now live! –

The Plugin_Developers_Guide- is as the name suggests developers’ guide for plug-ins and pattern types (virtual applications).

The contains the actual IBM Workload Plug-in Development Kit, the contents are as follows:
-docs/PDKSampleUsersGuide.pdf: contains user guide for sample plugins and pattern type contains build libraries and build scripts to build plugins and pattern types contains sample plugins and pattern type contains Javadocs

If you ask, What is IBM Workload Deployer? see here

« Newer PostsOlder Posts »

Create a free website or blog at


Get every new post delivered to your Inbox.

Join 135 other followers