Tuesday 9 February 2010

Websphere in memory session count

I have recently been working on an application that uses in memory sessions. Our previous systems had always put session data on a database so it was easy to find out how many active sessions we had at any one time which is always useful when we have issues with a system so we can state how many users have been affected.

To allow us to view this sort of information within WAS, I first had to enable PMI on each WAS server.

This article discusses the overhead of PMI

Now that PMI was enabled, it was simply a case of writing a jython script to run at regular intervals to get the data:

The commands are as follows (I have taken out the commands to strip the data to the format I was specifically after so I will leave that up to your own jython skills to sort out)


servers = AdminTask.listServers( '[-serverType APPLICATION_SERVER]').splitlines()
for server in servers:
# Now just get the app server name - not the whole jytoh config id
newserver = server.split('(')
# get the session manager mbean
ps = AdminControl.queryNames ('WebSphere:type=SessionManager,process=' + newserver[0] + ',*')
# now get the stats for the mbean
AdminControl.getAttribute(ps, 'stats')


And hopefully you will get some output like this:

['', 'Stats name=My_WAR_FILE_NAME, type=servletSessionsModule', '{', 'name=SessionObjectSize, ID=18, description=The average size of the session objects at session level, including only serializable attributes in the cache., unit=BYTE, type=AverageStatistic, avg=1762.5, min=1713, max=1812, total=200925, count=114, sumSq=4.0370855625E10, type=TimeStatistic, avg=1762.5, min=1713, max=1812, total=200925, count=114, sumSq=4.0370855625E10', '}']

As well as the current count I could also check out the session object size which might also be useful if you have a large number of sessions and a small heap size

Sunday 7 February 2010

WMSG1603E - An error occurred trying to read the bundle

I encountered a strange error this weekend whilst installing multiple fix packs across numerous WAS systems. Despite installing these fixes numerous times, this error only occurred on one system.

I was upgrading from WAS 6.1.0.21 to 6.1.0.27 - that included WAS, SDK, IHS and Plugin fixes.

After installing the fix packs when I restarted the server I got the following error:

WMSG1603E: An internal error occurred. It was not possible to register the WebSphere MQ JMS client with the application serve
r due to exception org.osgi.framework.BundleException: An error occurred trying to read the bundle

followed by a java stack which included the following:

WMSG1603E: An internal error occurred. It was not possible to register the WebSphere MQ JMS client with the application serve
r due to exception org.osgi.framework.BundleException: An error occurred trying to read the bundle

A quick search and the reason was obvious. This WAS system does not run as root but when I checked the file permissions on the org.osgi.framework bundles in {WAS_INSTALL_DIR}/profiles/{PROFILE_NAME}/configuration the bundle in question was owned by root:

drwxr-x--- 2 wasadm wasadm 256 07 Feb 10:25 org.eclipse.update
drwxr-xr-x 4 root system 256 07 Feb 10:26 org.eclipse.osgi
drwxr-x--- 3 wasadm wasadm 256 04 Jan 11:24 org.eclipse.core.runtime

A quick change of permissions on the directory and all sub directories followed by a restart and everything came up fine.