cktechnical
Saturday, May 07, 2005
 
MyEclipse Error Log
When you get an error while using MyEclipse and it says check the error log. What it means is to check the ".log" file in \workspace\.metadata
Monday, April 25, 2005
 
Hibernate DB Generation From Mapping Files
I use AppFuse to develop my Web Applications. So, I allow my Hibernate mapping files to generate my database for me. I always wanted to know how to get Hibernate to generate a TEXT field in MySQL. I have to type in: length="2147483647" in my mapping for a TEXT field. The answer can also be found in the Hibernate Documentation on the Hibernate website.
Wednesday, April 20, 2005
 
JasperReports printwhenexpression Print When Expression
I use JasperAssistant for my JasperReports and I was trying my darndest to make a Double field on my report not print when it was zero.
I of course started playing with the Print When Expression field available when you select a field test field on your report and click properties. I could not figure out what the Expression should be and what it should return. I was getting very frustrated. I started looking on the Web and couldn't find anything to help me with my Expression.
I started looking at the errors very carefully and discovered that the Expression needs to return a Boolean object. So I started my expression off with new Boolean( ) .
Then I worked on my expression. My field is of type Double so I had to say that
new Boolean( ($V{minimum}).doubleValue() > (new Double(0)).doubleValue() ).
This worked... and I was happy.

I got some help from the following site.
http://www.eclipseplugincentral.com/PNphpBB2+file-viewtopic-t-1433.html
Thursday, April 14, 2005
 
Checking IBM DB2 Connect's Version Number
Preface: I work in the Windows world.

Checking the version number on an installed DB2 Connect seems like it would be a really easy task. Pull up the HELP screen in any of the programs that ship with IBM DB2 Connect and "Voila!" you have your version number.

Doesn't work that way. We get the primary version number on the HELP screens (e.g. 7, 8, etc.) but we don't get the full version number (e.g. 7.01.00.40) which is what we want when we are trying to duplicate our development environment here at work. IBM Db2 Connect is upgraded about twice a day so keeping accurate track of the version numbers is very important. We get a shipment of disks about every other month with a new version number (Version 7.01.00.03 becomes Version 7.01.00.04).

To get the full version number you must go to the Windows Control Panel on an XP box and pull up Administrative Tools. Then click on the Data Sources (ODBC) shortcut. This will pull up the ODBC Data Source Administrator and you can go to the Drivers tab and scroll until you find the IBM DB2 ODBC Driver. Here you can view the Version in its entirety. You can then match this Version number with the Version number on the mountain of disks you have from IBM.

Wednesday, April 13, 2005
 
We Got a HeapDump!
We have had a few heapdumps on our Websphere Application Server 5.1 and I am trying to debug the problem.

The first thing I did was read up on the HeapDump itself on the IBM website. The article looks at Memory Leaks and gives you a few options on how to debug the application in error. I chose to use HeapRoots to analyze the HeapDumps. The article indicated that this was the most popular choice.
I downloaded the HeapRoots JAR file from the HeapRoots website and followed the instructions on how to begin analyzing a HeapDump.
A few notes to myself are needed here (feel free to ignore them):
I ran the HeapRoots analyzer and analyzed the heapAnalysis.txt file. What I found out is that I had an array object that had 21,000+ instances before the dump occurred. That is all I had. Time to dig deeper.

I checked out a thread on WebServerTalk that discusses HeapDumps in Webphere Application Server. In the thread I read about a setting called "verbosegc" that can be set on the Websphere Application Server so that you can monitor Garbage Collection on the server on a Windows box in the native_stderr.log file.

I started down the path of trying to figure out how to set the "verbosegc" setting on my Webphere Application Server. I found the following article on the Webphere website. I have set the setting on my Webphere Application Server and now I am in hover mode while I monitor the Garbage Collection process in the native_stderr.log file.
For in-server Java code, you can turn on tracing for the Java garbage collector by setting the verboseGC server property to true. The trace output describes how often the garbage collector runs, how long it takes, and what objects are deallocated. For information on the encoding of the output, see the documentation for the JDK version that you are running the server with.
I am also going to take a look at HeapAnalyzer that is also mentioned in the
WebServerTalk thread.

Tuesday, March 22, 2005
 
SQL30020N - Execution failed because of a Distributed Protocol Error

The following error showed up in our logs for our Electronic Approval System. Whenever this error hits we get a deadlock on our table (pbba.bbab10t) that causes users to be unable to approve documents. This is a very frustrating error. It has been very tough to track.

The error is as follows:

COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver][DB2] SQL30020N Execution failed because of a Distributed Protocol Error that will affect the successful execution of subsequent commands and SQL statements: Reason Code "1232". SQLSTATE=58009

1232
The command could not be completed because of a permanent error. In most cases, the server will be in the process of an abend.

SQL30020N
Execution failed because of a Distributed Protocol Error that will affect the successful execution of subsequent commands and SQL statements: Reason Code "".
Explanation: A system error occurred that prevented successful execution of the current environment command or SQL statement, as well as any subsequent commands or SQL statements.
The command or statement cannot be processed. The current transaction is rolled back and the application is disconnected from the remote database.
User Response: Record the message number (SQLCODE) and the reason code. Record all error information from the SQLCA, if possible. Attempt to connect the remote database and rerun the application.
If sufficient memory resources exist and the problem continues, invoke the Independent Trace Facility at the operating system command prompt. Refer to the Independent Trace Facility in the Troubleshooting Guide for information on how to use this facility.

The Line of code that was executed before this Exception was thrown is the following:
[3/22/05 14:56:52:391 CST] 9c75565 SystemErr R at webapr.db.DBApprovalController.getCriteriaOrder(DBApprovalController.java(Compiled Code))
[3/22/05 14:56:52:391 CST] 9c75565 SystemErr R at webapr.ApprovalController.isCriterionMatchForSigner(ApprovalController.java(Compiled Code))
[3/22/05 14:56:52:391 CST] 9c75565 SystemErr R at webapr.ApprovalController.createUnitWaitingItems(ApprovalController.java(Compiled Code))
[3/22/05 14:56:52:391 CST] 9c75565 SystemErr R at webapr.ApprovalController.updateWaitingItems(ApprovalController.java(Compiled Code))
[3/22/05 14:56:52:391 CST] 9c75565 SystemErr R at webapr.docvalidation.ValidationPageBean.checkUpdateWaitingItems(ValidationPageBean.java:351)
[3/22/05 14:56:52:391 CST] 9c75565 SystemErr R at webapr.docvalidation.ValidationPageBean.processRequest(ValidationPageBean.java:200)

Later I got the following error log:
[3/22/05 15:23:57:234 CST] 815d565 SystemErr R COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver][DB2] SQL0913N Unsuccessful execution caused by deadlock or timeout. Reason code "00C9008E". SQLSTATE=57033
[3/22/05 15:23:57:234 CST] 815d565 SystemErr R at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throw_SQLException(SQLExceptionGenerator.java:261)[3/22/05 15:23:57:234 CST] 815d565 SystemErr R at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throw_SQLException(SQLExceptionGenerator.java(Inlined Compiled Code))[3/22/05 15:23:57:234 CST] 815d565 SystemErr R at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.check_return_code(SQLExceptionGenerator.java(Compiled Code))[3/22/05 15:23:57:234 CST] 815d565 SystemErr R at COM.ibm.db2.jdbc.app.DB2Statement.execute2(DB2Statement.java(Compiled Code))[3/22/05 15:23:57:234 CST] 815d565 SystemErr R at COM.ibm.db2.jdbc.app.DB2Statement.executeQuery(DB2Statement.java(Compiled Code))[3/22/05 15:23:57:250 CST] 815d565 SystemErr R at edu.uga.busfin.dfs.db.DBAccess.query(DBAccess.java(Compiled Code))[3/22/05 15:23:57:250 CST] 815d565 SystemErr R at webapr.db.DBApprovalController.getCurrentApprovalGroupLevel(DBApprovalController.java:46)[3/22/05 15:23:57:250 CST] 815d565 SystemErr R at webapr.ApprovalController.updateWaitingItems(ApprovalController.java(Compiled Code))[3/22/05 15:23:57:250 CST] 815d565 SystemErr R at webapr.docvalidation.ValidationPageBean.checkUpdateWaitingItems(ValidationPageBean.java:351)[3/22/05 15:23:57:250 CST] 815d565 SystemErr R at webapr.docvalidation.ValidationPageBean.processRequest(ValidationPageBean.java:200)

...
I feel like the error must be the fact that the following sequence of events happens in this old code...

Snippet from ValidationPageBean:
public void processRequest(Object objReqRes){
Object [] objArr = (Object[])objReqRes;
HttpServletRequest request = (HttpServletRequest)objArr[0];
HttpServletResponse response = (HttpServletResponse)objArr[1];
this.request = request;
context = request.getSession().getServletContext();
con = DBUtil.getSysConnection(context); //ESTABLISHES A CONNECTION
...
// Place all of the logic within a try{} so that we may rollback
// the entire transaction if we get an error in our messages object.
try{ (191)
con.setAutoCommit(false); // sets the auto commit to false


Snippet from ApprovalController:
public boolean updateWaitingItems(Document document) {
this.conn = DBUtil.getSysConnection(context); // ESTABLISHES ITS OWN CONNECTION!!!
this.db = new DBApprovalController(this);
setDebug();
this.document = document;
this.groupLevel = db.getCurrentApprovalGroupLevel(conn, document);

My best guess on this error is that the connection that is set to autoCommit(false) in the ValidationPageBean should be used in the ApprovalController object that the ValidationPageBean creates in its checkUpdateWaitingItems method:

private void checkUpdateWaitingItems(ServletContext context, Document document, String validationCode){
if(document.getDocHead().getHeaderElecApprCode().equals("P")){
if(wasDocumentChanged(document, validationCode)){
this.appCon = new ApprovalController(context, this.user);
this.appCon.setConn(con);
if(!this.appCon.updateWaitingItems(document)){
this.appCon.appendMessages(this.messages);
}
}
}
}

Well, after much investigation I found out what the error was. Seems some legacy code was creating a nice little infinite loop when it was comparing units on a document versus units in our tracking table. So, I completely scrapped the old updateWaitingItems logic in the ApprovalController and replaced it with some testable code that works much faster, is more intuitive, and much easier to maintain.
This issue has been resolved and has been moved into our production environment before another user steps into an infinite loop by making changes to a document and submitting it to the approval system.


Thursday, March 17, 2005
 
Websphere Server 5.1 Tweaking
Article that describes how to instantiate the Tivoli Performance Monitor to view the activity on a Websphere Server.
Tivoli Performance Monitor

I still need to figure out what is eating up the memory on our server.
 
Webspher Error: No WebApplicationContext found: no ContextLoaderListener registered?
I was getting the following error when I added a brand new application to the Webpher production machine. The problem is the following: For Servlet 2.2 containers and Servlet 2.3 ones that do not initalize listeners before servlets, use ContextLoaderServlet. See the latter's Javadoc for details. IBM Websphere Application Server 5.1.1 operates its container at Servlet 2.3 and thus the listener is not registered before the servlets and therefore I get errors.
More Here
I fixed this error by changing the following in the web.xml file:

**this used to be the way we started the ContextLoaderListner for Spring but this stopped working.

<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

the servlet method below works fine on the Webspher production server... I need to find out why the listner is not working.
<servlet>
<servlet-name>context</servlet-name>
<servlet-class>org.springframework.web.context.ContextLoaderServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>

[3/17/05 15:33:47:422 CST] 715abdb4 WebGroup E
SRVE0026E: [Servlet Error]-[action]:
java.lang.IllegalStateException: No WebApplicationContext
found: no ContextLoaderListener registered?
at org.springframework.web.context.support.WebApplicationContextU
tils.getRequiredWebApplicationContext
(WebApplicationContextUtils.java:69)
at edu.uga.busfin.budamd.web.ElectronicApprovalBaseDispatchAction
.setServlet(ElectronicApprovalBaseDispatchAction.java:35)
at org.apache.struts.action.RequestProcessor.processActionCreate(RequestProcessor.java:297)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:220)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:397)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:974)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:555)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:200)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:119) at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:276)
at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
at com.ibm.ws.webcontainer.cache.invocation.CacheableInvocationContext.invoke(CacheableInvocationContext.java:114)
at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:186)
at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:618)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:443)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:593)


Powered by Blogger