D
Dave Ficken
We have written a Java web service that runs under Apache Tomcat and
AXIS (SOAP/XML). The problem is that simultaneous concurrent
transactions appear to occasionally overwrite each other, and we can't
figure out why. We've really hit a brick wall! Has anybody come across
this problem and can you offer any suggestion which may help?
A few things:
a. we are just using the default "scope" setting in the AXIS config.
when we try explicitly setting the scope parameter to "request" it
still doesn't seem to make any difference.
b. the problem occurs only occasionally - we don't seem to be able to
reproduce it when we try to.
c. initially the source code included a static class and String
variable, so we removed it thinking this was the problem, but the
problem still happens! There should currently be no instances of
static in our code.
d. we're pretty sure we restarted apache tomcat and redeployed our web
services properly each time. we're sure our code changes were in
effect but we didn't do a reboot - should this be necessary?
I have attached source code below that shows an example of the class
being invoked through AXIS. The method that is invoked by web services
is "doTransaction" which accepts String XML. The problem seems to
occur when private String class member variables of "FooTransaction"
are overwritten by another simultaneous request. FooTransaction also
contains a private vector class member and String data associated with
its elements appear to get overwritten as well.
Any help at all appreciated...
Dave
-----------------
package myPackage;
import java.util.Vector;
import org.apache.xerces.parsers.SAXParser;
import org.xml.sax.*;
import org.xml.sax.helpers.DefaultHandler;
import java.io.*;
import java.util.*;
public final class FooEngine implements ContentHandler{
private String XMLFile;
private FooTransactionRequest eReq = new FooTransactionRequest();
private Vector FooTransactions = new Vector();
private FooTransaction eTrans = new FooTransaction();
private CharArrayWriter contents = new CharArrayWriter();
public FooEngine() { }
public String doTransaction(String XMLInput) {
eReq = new FooTransactionRequest();
/* Create the response object that will store the response to the
client **/
FooTransactionResponse response = new FooTransactionResponse();
try {
/* transaction processing here */
/* ....*/
} catch (Exception e) {
/* Return error response. **/
/* ....*/
}
/* Return XML response. */
String XMLResponse = createXMLResponse(response);
return XMLResponse;
}
// the remaining callback handlers
public void setDocumentLocator(Locator locator) {}
public void startDocument() {}
public void endDocument() {}
public void startPrefixMapping(String prefix, String uri) {}
public void endPrefixMapping(String prefix) {}
public void ignorableWhitespace(char[] text, int start, int length)
throws SAXException {}
public void processingInstruction(String target, String data){}
public void skippedEntity(String name) {}
}
AXIS (SOAP/XML). The problem is that simultaneous concurrent
transactions appear to occasionally overwrite each other, and we can't
figure out why. We've really hit a brick wall! Has anybody come across
this problem and can you offer any suggestion which may help?
A few things:
a. we are just using the default "scope" setting in the AXIS config.
when we try explicitly setting the scope parameter to "request" it
still doesn't seem to make any difference.
b. the problem occurs only occasionally - we don't seem to be able to
reproduce it when we try to.
c. initially the source code included a static class and String
variable, so we removed it thinking this was the problem, but the
problem still happens! There should currently be no instances of
static in our code.
d. we're pretty sure we restarted apache tomcat and redeployed our web
services properly each time. we're sure our code changes were in
effect but we didn't do a reboot - should this be necessary?
I have attached source code below that shows an example of the class
being invoked through AXIS. The method that is invoked by web services
is "doTransaction" which accepts String XML. The problem seems to
occur when private String class member variables of "FooTransaction"
are overwritten by another simultaneous request. FooTransaction also
contains a private vector class member and String data associated with
its elements appear to get overwritten as well.
Any help at all appreciated...
Dave
-----------------
package myPackage;
import java.util.Vector;
import org.apache.xerces.parsers.SAXParser;
import org.xml.sax.*;
import org.xml.sax.helpers.DefaultHandler;
import java.io.*;
import java.util.*;
public final class FooEngine implements ContentHandler{
private String XMLFile;
private FooTransactionRequest eReq = new FooTransactionRequest();
private Vector FooTransactions = new Vector();
private FooTransaction eTrans = new FooTransaction();
private CharArrayWriter contents = new CharArrayWriter();
public FooEngine() { }
public String doTransaction(String XMLInput) {
eReq = new FooTransactionRequest();
/* Create the response object that will store the response to the
client **/
FooTransactionResponse response = new FooTransactionResponse();
try {
/* transaction processing here */
/* ....*/
} catch (Exception e) {
/* Return error response. **/
/* ....*/
}
/* Return XML response. */
String XMLResponse = createXMLResponse(response);
return XMLResponse;
}
// the remaining callback handlers
public void setDocumentLocator(Locator locator) {}
public void startDocument() {}
public void endDocument() {}
public void startPrefixMapping(String prefix, String uri) {}
public void endPrefixMapping(String prefix) {}
public void ignorableWhitespace(char[] text, int start, int length)
throws SAXException {}
public void processingInstruction(String target, String data){}
public void skippedEntity(String name) {}
}