Friday, 19 June 2009

Problems with T2 ( and, no, I don't mean rogue cyborgs or airport terminal buildings )

Having just gone through the process to migrate my WebSphere Portal Server 6.1.0.2 environment from the out-of-the-box Apache Derby ( fka Cloudscape ) database to DB2 UDB, I was annoyed to be seeing errors such as this: -

Failure in loading T2 native library db2jcct2, reason: java.lang.UnsatisfiedLinkError: db2jcct2 (Not found in java.library.path)DSRA0010E: SQL State = null, Error Code = -99,999. View JVM logs for further details.

when trying to use/test JDBC datasource connections.

The SystemErr.log gave me this: -

[19/06/09 18:05:25:062 BST] 00000035 SystemErr     R java.sql.SQLException: Failure in loading T2 native library db2jcct2, reason: java.lang.UnsatisfiedLinkError: db2jcct2 (Not found in java.library.path)DSRA0010E: SQL State = null, Error Code = -99,999

and SystemOut.log gave me much the same: -

java.sql.SQLException: Failure in loading T2 native library db2jcct2, reason: java.lang.UnsatisfiedLinkError: db2jcct2 (Not found in java.library.path)DSRA0010E: SQL State = null, Error Code = -99,999

all of which is nice and consistent.

At this point, I thought "D'oh, I've seen this before once or fifty-eleven trillion times (ish)".

It's the same old DB2 vs. Java on Unix challenge - Java ( in this case, WebSphere ) is running as root whereas the DB2 libraries, path, instance etc. are also "owned" by the DB2 instance owner ( db2inst in my case ).

Therefore, the trick is to allow root to use the DB2 instance's profile, by adding the line: -

. /home/db2inst1/sqllib/db2profile

to the root user's profile.

There are two or three ways to do this - in my particular case, I chose to modify /etc/profile which would mean that ALL users on my box will be able to access DB2. An alternative approach would to amend /root/.bash_profile or /root/.bashrc.

I'm sure a Linux sysadmin will tell me that there is a right and wrong way to do this, especially where bash isn't being used but ...... it works for me.

Having made this changed, I logged out and back in as root, started my portal server and all is now well.

1 comment:

Unknown said...

Thanks for posting this. Was banging my head against the wall trying to figure out why my application didn't work when ported to a new environment.

Note to self - use kubectl to query images in a pod or deployment

In both cases, we use JSON ... For a deployment, we can do this: - kubectl get deployment foobar --namespace snafu --output jsonpath="{...