axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Johan Andersson (JIRA)" <>
Subject [jira] Created: (AXIS2-1570) Rampart/Axiom is not thread safe
Date Wed, 01 Nov 2006 08:45:52 GMT
Rampart/Axiom is not thread safe

                 Key: AXIS2-1570
             Project: Apache Axis 2.0 (Axis2)
          Issue Type: Bug
          Components: modules
    Affects Versions: 1.0
         Environment: WinXP, Tomcat 4/5, Websphere 5/6
            Reporter: Johan Andersson

The Axiom DOM (distributed with Axis 1.0) implementation seems to have some threading issues.

The problem manifests itself as a nullpointer exception in

If I apply a moderate amount of load on the server so the number of http processor threads
start increase the NPE will 
happen all of the time whenever a piece of code tries to create a DocumentBuilder (for instance
the WSDL parsing during deployment).
I can reproduce this problem quite reliably.

Nullpointer is caused by the originalDocumentBuilderFactory being null 
--- snip ---
    public DocumentBuilder newDocumentBuilder()
            throws ParserConfigurationException {
         * Determine which DocumentBuilder implementation should be returned
        return isDOOMRequired()
                ? new DocumentBuilderImpl()
                : originalDocumentBuilderFactory.newDocumentBuilder();
--- snip ---

I've tracked the problem to this piece of code in the

--- snip ---
   public static void setDOOMRequired(boolean isDOOMRequired) {
        String systemKey = DocumentBuilderFactory.class.getName();
        if (isDOOMRequired) {
            if (!isDOOMRequired()) {
                originalDocumentBuilderFactory = DocumentBuilderFactory.newInstance();
                originalDocumentBuilderFactoryClassName = originalDocumentBuilderFactory.getClass().getName();
                System.setProperty(systemKey, DocumentBuilderFactoryImpl.class.getName());
        } else {
            String currentFactoryClassName = DocumentBuilderFactory.newInstance().getClass().getName();
            if (currentFactoryClassName != null && currentFactoryClassName.equals(DocumentBuilderFactoryImpl.class.getName()))
                if (originalDocumentBuilderFactoryClassName != null) {
                    System.setProperty(DocumentBuilderFactory.class.getName(), originalDocumentBuilderFactoryClassName);
            originalDocumentBuilderFactory = null;
--- snip ---

Trying to find away to resolve this I realise that the DOOM document builder factory implementation
is in fact manipulating a JVM-wide
system property in a multi-threaded environment (!) which besides the problem I am currently
experiencing could lead to all sorts 
of unwanted side-effects.

As I don't want to allow this to happen I simply commented out the contents of the setDoomRequired()
method hoping that Rampart could work
with my default DOM instead and that I would only suffer some performance loss.

I was wrong in that assumption as I encountered another problem: 

StAXOMBuilder CHARACTERS: [org.apache.axis2.AxisFault: WSDoAllReceiver: security processing
failed; nested exception is: Cannot encrypt/decrypt data; nested exception
	org.w3c.dom.DOMException: HIERARCHY_REQUEST_ERR: An attempt was made to insert a node where
it is not permitted. 
	at org.apache.axis2.engine.Phase.invoke(
	at org.apache.axis2.engine.AxisEngine.invoke(
	at org.apache.axis2.engine.AxisEngine.receive(
	at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(
	at org.apache.axis2.transport.http.AxisServlet.doPost(
	at javax.servlet.http.HttpServlet.service(

I compared the source of in Axis
1.0 release and the latest in SVN
and can see no changes in how this is handled.

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message