Thursday, June 19, 2008

IBM DB2 Content Manager and Information Integration for Content

These past few days, I've been trying to resolve some IBM Content Manager server update issue. We have a service that connects to IBM DB2 Content Manager (CM) v8.3 using the IBM DB2 Information Integrator for Content (II4C) libraries v8.3, namely: cmb81.jar, cmbsdk81.jar, cmbview81.jar and the jdbc driver db2java.zip.
Then for some new business requirements, we need to point that service to a new IBM Content Manager v8.4 deployed on Red Hat Linux. I thought this was going to be a quick and easy change.
That couldn't be any further from the facts.
First, I catalog a new alias to the new server on my local server. Then I added that alias into my cmbicmsrvs.ini configuration. I thought that was it, just test and redeploy. I was wrong. When I tested that configuration I got the following cryptic error message when I run my connection test:
com.ibm.mm.beans.CMBConnectFailedException: DGL0394A: Error in : DKDatastoreICM.connect; [SERVER = CMDEV, USERID = icmadmin]; ICM7123: This is an internal error.  Run the application again with server trace set to Detail and Data.  Save the server log and see your IBM service representative. (STATE) : [LS RC = 7123, LS reasonCode = 8013]
com.ibm.mm.sdk.common.DKDatastoreAccessError: DGL0394A: Error in : DKDatastoreICM.connect; [SERVER = CMDEV, USERID = icmadmin]; ICM7123: This is an internal error.  Run the application again with server trace set to Detail and Data.  Save the server log and see your IBM service representative. (STATE) : [LS RC = 7123, LS reasonCode = 8013]
 at com.ibm.mm.sdk.server.DKDatastoreICM.logon(DKDatastoreICM.java:3687)
 at com.ibm.mm.sdk.server.DKDatastoreICM.connect(DKDatastoreICM.java:3273)
 at com.ibm.mm.beans.CMBConnection.connect(CMBConnection.java:1685)
To make the story much shorter than what actually happened, I've check and test many things. Eventually I called IBM support and was finally informed that II4C 8.3.0 is not supported with CM 8.4. In order for me to connect to CM 8.4 using II4C 8.3, I must use fixpack (fp) 7 or 8. Fixpack 7 or 8, as a prerequisite need fixpack 3A to be pre-applied. The CM server fix pack are the same for both DB2 II4C and DB2 CM.
To solve my issue, I download the fixpacks and extracted the libraries that I needed from fp 8, use that with the connection test and it worked. Getting it to work with the actual app and isolating the properties and ini file so that it will stand alone without affecting other running services and application is off course a different issue. Being able to connect, however, told me that the basic requirements are in proper order.

_ibmjsp.secure.layouts NPE on WebSphere Adminisrative Console

I was trying to deploy an EAR file to a WebSphere Process Server instance. I went to the WebSphere Adminisrative Console, clicked on Applications, Enterprise Application, local file system, specify the path and clicked next, then another next when I got the following stacktrace:
java.lang.NullPointerException
 at _ibmjsp.secure.layouts._stepsLayout._jspService(_stepsLayout.java:581)
 at com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:93)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
 at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1572)
 at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1521)
 at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:113)
 at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:82)
 at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:759)
 at com.ibm.wsspi.webcontainer.servlet.GenericServletWrapper.handleRequest(GenericServletWrapper.java:121)
 at com.ibm.ws.jsp.webcontainerext.JSPExtensionServletWrapper.handleRequest(JSPExtensionServletWrapper.java:215)
 at com.ibm.ws.jsp.webcontainerext.JSPExtensionProcessor.handleRequest(JSPExtensionProcessor.java:255)
 at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:347)
 at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1070)
 at org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:273)
 at org.apache.struts.tiles.TilesRequestProcessor.processTilesDefinition(TilesRequestProcessor.java:253)
 at org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:308)
 at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
 at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1486)
 at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:528)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
 at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1572)
 at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1521)
 at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:136)
 at com.ibm.ws.console.core.servlet.WSCUrlFilter.continueStoringTaskState(WSCUrlFilter.java:311)
 at com.ibm.ws.console.core.servlet.WSCUrlFilter.doFilter(WSCUrlFilter.java:185)
 at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:142)
 at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:121)
 at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:82)
 at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:759)
 at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3177)
 at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:253)
 at com.ibm.ws.webcontainer.VirtualHost.handleRequest(VirtualHost.java:229)
 at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1970)
 at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:114)
 at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:472)
 at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:411)
 at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:101)
 at com.ibm.ws.ssl.channel.impl.SSLReadServiceContext$SSLReadCompletedCallback.complete(SSLReadServiceContext.java:1704)
 at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java:566)
 at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java:619)
 at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java:952)
 at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java:1039)
 at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1471)
The stacktrace was unexpected because I've done this installation before and I had no problem previously. The _ibmjsp.secure.layouts._stepsLayout._jspService was quite curious since it didn't seem to have anything to do with what I'm doing.
I went to my package ear file, clean my build environment, recreate the ear and try to redeploy it again. The same thing happened again. Check the log, puzzled, decide to restart the server just in case. Still no change. Reboot the dev box, hoping for the best. And yet nothing changed.
That _ibmjsp.secure.layouts message kept nagging on my mind. Could it be... And of course it is...
You see, all this time I was using Firefox to connect to the admin console and it's ok most of the time. I always got the security certificate warning, always ignore it and it's usually okay. I don't know what's change, but just to eliminates any potential difference, I open Internet Explorer (7), go to the console and try the app installation sequence and this time it works.
I don't have time to figure out what make the response different on firefox, I got the app deployed and that's all that matter for now.

Thursday, June 12, 2008

Unsupported major.minor version 49.0

Today I replaced few jar files and got an "Unsupported major.minor version 49.0" when running my unit tests against the new jars. Immediately I realize that those new jar files are compiled using different version then the one I'm running on.


I'm still using JDK 1.4.2_11, it's old I know. But that's what my app server uses.

The new jars were build using java 5, so I switched the version to run the unit tests and that major.minor version part is gone.

If that's the only issue I have, my problem for the day would've been over and I would have move to the next thing on my list.

Tuesday, June 10, 2008

iPhone 3G official announcement at WWDC 2008



The highly anticipated (and much hyped) iPhone 3G is finally here. Available starting July 11, 2008 and starts at $199 for 8GB. Check out Steve Jobs keynote address at Engadget.

And the WWDC 2008 Coverage roundup.

Saturday, May 31, 2008

JavaFX Facebook Widget Demo

This video is titled Nandini Ramadi - Facebook Demo - JavaOne 2008

It showed a demo of JavaFX based Facebook widget that seems to mash-up facebook, twitter and flickr. Had the demo been smooth, without the network bandwidth problem at Moscone Center, it would've been quite impressive.

The widget was loaded via what seems to be a facebook page and then it was detachable by dragging it from the browser and dropping it on to Windows desktop. Then it appears that the widget was also accessible as a JavaFX Mobile application.


JavaOne 2008 Sun Headlines

I wanted to go to JavaOne this year, but by the time I remember it was a few days away. But here's a youtube video describing the headline. The title was JavaOne Sun Headlines: Java drives Innovation

Tuesday, May 13, 2008

Getting environment variable for deployment environment automation

I want to get an environment variable, let's call it "deploy.env" which is set in the OS environment to tell my application where it is, it could be any of the following values: local, dev, int, qa, uat, prod. The purpose of which is to retrieve a particular setting to be used in that environment.

I tried to use System.getProperties() but it didn't give me the environment variable I need. It just can't access it. So I search the web, got some idea and wrote the following utility class. In my environment it returns what I want.


Feel free to use, but you're on your own, standard no-liability disclaimer apply. Always test your own code first before deploying to any server.

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.InvocationTargetException;
import java.util.Properties;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
* <p>Utility class to access the OS environment variables.</p>
* @author Judah Lim (c)2007
* @copyright(disclaimer) USE AS-IS.
* NO WARRANTIES WHATSOEVER, EITHER EXPRESSED OR IMPLIED.
*/
public class EnvarsUtil {
private static Properties envars;
private static Log logger = LogFactory.getLog(EnvarsUtil.class);

public static void main(String[] args) {
System.out.println(EnvarsUtil.getEnvironmentVariable("deploy.env"));
}

/**
* <p>Retrieve an environment variable from current system environment.</p>
* @param envarName The name of the environment variable to retrieve.
* @return The String value of the environment variable, null if not found.
*/
public static String getEnvironmentVariable(String envarName) {
if(envars == null) {
initEnvironmentVars(false);
return envars.getProperty(envarName);
} else {
return envars.getProperty(envarName);
}
}

/**
* <p>Refresh the cached environment variables</p>
*/
public static void refreshEnvironmentVars() {
initEnvironmentVars(true);
}

/**
* <p>Read the environment variables and cahed them.</p>
* @param refresh set to true to refresh the cache, false otherwise.
* @return the environment variables as Properties.
*/
private static void initEnvironmentVars(boolean refresh) {
if (envars != null && !refresh) return;

Process process = null;
try {
process = osProcess();
} catch (InvocationTargetException e) {
logger.error("System environment values can't be retrieved.", e);
}

BufferedReader bufferedReader =
new BufferedReader(new InputStreamReader(process.getInputStream()));

String line = null;
envars = new Properties();
try {
while ((line = bufferedReader.readLine()) != null) {
int idx = line.indexOf('=');
String key = line.substring(0, idx);
String value = line.substring(idx + 1);
envars.setProperty(key, value);
}
} catch (IOException e) {
logger.error("System environment values can't be processed.", e);
}

// Clean up
process = null;
bufferedReader = null;
line = null;
}

/**
* <p>Run an OS process to get all environment variables.</p>
* @return Process the OS process executed containig the results of execution.
* @throws InvocationTargetException
*/
private static Process osProcess() throws InvocationTargetException {
Process process = null;
Runtime runtime = null;
String osName = null;
try {
runtime = Runtime.getRuntime();
osName = System.getProperty("os.name").toLowerCase();
if (osName.indexOf("windows 9") > -1) {
process = runtime.exec("command.com /c set");
} else if ((osName.indexOf("nt") > -1)
|| (osName.indexOf("windows 2000") > -1)
|| (osName.indexOf("windows xp") > -1)) {
process = runtime.exec("cmd.exe /c set");
} else {
process = runtime.exec("env");
}
runtime = null;
osName = null;
return process;
} catch (IOException e) {
// Clean up
process = null;
runtime = null;
osName = null;
// Convert to InvocationTargetException
throw new InvocationTargetException(e);
}
}
}

Friday, April 04, 2008

Bankrupt Airlines to Hawaii


ATA Airlines shut down its operations (April 3, 2008) more than 2,200 employees lost their jobs just like that. This is just about a few days after Aloha Airlines closes its operations (March 31, 2008).

Yikes, this is going to increase travel cost to Hawaii. All credited to high fuel costs. Crude oil cost of over $100 per barrel definitely doesn't help the cost of jet fuel costs. With competition lower, vacation to paradise island just got a lot more expensive. Thankfully I didn't make any reservation for summer travel with those two airlines.

Imagine the chaos at the counter of the two airlines when they just close business. Travel headache, lost of time money and other things. I heard this couple that supposedly get married in Honolulu, who still have to apply for marriage license in Honolulu and now need to find substitute flight to the islands. That's total chaos.

Bye-bye summer vacation to Hawaii... at least for now. %$#*&^@ fuel price.