Help coderanch get a
new server
by contributing to the fundraiser

Bill Rowell

+ Follow
since Feb 27, 2004
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Bill Rowell

Here are the points for each section:
General Considerations: 100 94
Documentation: 70 70
OOD: 30 30
GUI: 40 38
Locking: 80 80
Data Store: 40 40
Network Server: 40 40
Total: 400 392

It's great to finish this exam!
Thanks to everyone for all of your help!
17 years ago
Below is the code we are using to set up the XMLHttPRequest object.
Looking at the results of the alert messages (shown below) I verified that
this.bAsync = false and this.bInDebug = true.

function XmlRequestProcessor(path, qString, method, async, inDebug) {
alert("path = " + path + ",qString= " + qString + ",method= " + method + ",async= " + async + ",inDebug= " + inDebug);
var self = this;
this.oParent = null;
this.oXmlHttpReq = null;
this.sPath = path;
this.sQuery = (!qString)?"":qString;
this.sMethod = (!method || method == "")?"POST":method.toUpperCase();
this.bAsync = async = (typeof async == 'undefined' || async == null)?true:async;
this.bInDebug = inDebug = (typeof inDebug == 'undefined' || inDebug == null)?false:inDebug;
alert("sPath = " + this.sPath + ",sQuery= " + this.sQuery + ",sMethod= " + this.sMethod +
",bAsync= " + this.bAsync + ",bInDebug= " + this.bInDebug);

this.process = null;
if (window.XMLHttpRequest) {
this.getXmlHttpReqObj = ns_xmlReq_getXmlHttpReqObj;
} else if (window.ActiveXObject) {
this.getXmlHttpReqObj = ie_xmlReq_getXmlHttpReqObj;
this.transmitData = ldc_xmlReq_transmitData;
this.appendText = ldc_xmlReq_appendText;
this.appendHtml = ldc_xmlReq_appendHtml;
this.useInnerHtml = ldc_xmlReq_useInnerHtml;
this.applyProcess = ldc_xmlReq_applyProcess;
this.processText = ldc_xmlReq_processText;
this.processHtml = ldc_xmlReq_processHtml;
this.processInnerHtml = ldc_xmlReq_processInnerHtml;
this.createHtmlNode = ldc_xmlReq_createHtmlNode;
this.exeProcess = ldc_xmlReq_executeProcess;
this.copyAttributes = ldc_xmlReq_copyAttributes;

//Seperated out to support the diff between IE and Mozilla
self.oXmlHttpReq = this.getXmlHttpReqObj();
self.oXmlHttpReq.onreadystatechange = function( ) {
}, this.sPath, this.bAsync);

if (self.sMethod == "POST") {
self.oXmlHttpReq.setRequestHeader("Connection", "close");
self.oXmlHttpReq.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
self.oXmlHttpReq.setRequestHeader("Method", "POST " + self.sPath + "HTTP/1.1");
The call is being made in JavaScript.
I am using Ajax in JS to make an simple Struts call to a WebSphere application server to save a small amount of data to a database. In our development environments everything worked fine. However, we are receiving reports from users that even over fast broad band connections, they are seeing white/locked up screens in IE that lock up when making this call. I am able to recreate the white screen in both IE and Firefox in my IDE by putting alert messages in the JS and breakpoints in the Stuts action code but when I release the alert/breakpoint the screen renders OK.

We have considered refreshing the whole page to solve the problem.

Any other ideas you may have to solve this problem would be welcomed.

I'm working on URLyBird 1.3.1 using NetBeans and I'm trying to test whether locking/unlocking is working. I'm comfortable that the code is doing what I think I want it to do. However, I don't really know whether it will work in practice.

I have followed these steps:
  • --- Start up network server
  • --- Place a break point in the method implementing lock(recNo) just at the lockedRecords.notifyAll(); statement, that is, just after placing the entry (key is instance of RoomFileAccess file that implements all of the methods in the Data class and its value is the record number being locked)for the locked record into the container (a WeakHashMap).
  • --- Start network client 1 in the debug mode in NetBeans
  • --- Start network client 2 in the debug mode in Netbeans
  • --- Book a room with network client 1 so thread stops at breakpoint
  • --- Try to book the same room with network client 2

  • I'm expecting that network client 2 will stop in the block in the lock method shown below:

    while (isLockedRoomRecord(recNo)) {
    try {
    } catch (InterruptedException e) {

    However, cbased on the stack trace I don't think it gets that far.

    Below is the partial stack trace of what the network client 2 hits:

    java.rmi.ConnectIOException: error during JRMP connection establishment; nested exception is: Read timed out
    at sun.rmi.transport.tcp.TCPChannel.createConnection(
    at sun.rmi.transport.tcp.TCPChannel.newConnection(
    at sun.rmi.server.UnicastRef.invoke(
    at suncertify.remote.RoomDatabaseImpl_Stub.isBooked(Unknown Source)
    at suncertify.gui.GuiController.bookRoom(
    at suncertify.gui.ClientWindow$BookRoom.actionPerformed(

    I'm not sure what the results mean or even if I'm trying to test the lock/unlock functionality correctly.

    Any suggestions about how to test end-to-end locking/unlocking that you have would be helpful!

    I've run into a problem that has stumped me for a couple of weeks.

    I'm working on URLyBird 1.3.1 and am using a remote design identical to the latest DennyDvD project in SCJD Exam with J2SE 5 as shown below.

    suncertify.db packageAll methods throw RecordNotFoundException except one that throws DuplicateKeyExceptionsuncertify.remote packageAll methods with signature identical to those found in DBMainI run into the following errors for each of the DBMain methods when I compile RoomDatabaseImpl with rmic:I have the standalone client working and the RMI server running. However, when I start the RMI server and then the network client, I run into the exceptionsI understand that all remote methods must be declared to throw RemoteException in the corresponding remote interface. However, when I try to add throwing a RemoteException to the methods in RoomDatabaseImpl, the NetBeans compiler give me an error because I'm overriding a method in DBMain that doesn't throw a RemoteException. I don't understand why I'm running into this problem when the DennysDVD class matching mine, DvDDatabaseImpl class has methods that throw RemoteException although none of the methods in the DBClient class throw a RemoteException. I have been able to get the Denny's DVD project running in my Netbeans IDE.

    I'm open to major changes in my RMI design but, if possible, I'd like to first find out what's wrong with my current design and make minor changes.

    Any sugestions/questions you have are welcome!
    Bill Rowell

    [Andrew: Changed tabs to 2 spaces to attempt to reduce horizontal wrappping. Forced some wrapping for the same reason.]
    [ June 04, 2006: Message edited by: Andrew Monkhouse ]
    Thanks for your advice!
    I just discovered that before I had read the 160-byte record with readFully that I had inadvertently advanced the file pointer by one byte by using the readByte method to read the delete flag. Once I simply read the record into the array and then checked the delete flag within the array (the first element in the array) the EOFExceptions disappeared.
    I'm working on UrlyBird 1.3.1 and continue to run into problems with EOFException when reading the last record in the file. The original file length is 5034 bytes. I add a record at the end of the file (160 bytes long) making it 5194 bytes long and try to read it using the code below:

    byte[] input = new byte[MetaData.getRecordLength()];
    long filePointer = database.getFilePointer();
    long dbLength = database.length();

    database is a RandomAccessFile. When the readFully attempts to read the last record, the length of the input array is 160 (the delete flag is considered part of the record), the filePointer is 5035 bytes, and dbLength is 5194 bytes. Thus it seems as if there should be no EOFException because 5194-5035+1 = 160. The first record is record 0. I check whether
    MetaData.getFileHeaderLength() + (recNo + 1) * MetaData.getRecordLength() > database.length() before performing the readFully().

    Is it possible that the file pointer is going one byte beyond the end of the file after the readFully and is causing an EOFException?

    Does anyone have any idea what might be going on?
    It seems as if I added an extra byte at the end of the file, everything would be OK.

    Thanks for your help!