Hi,

Please try the latest Rampart [1] with latest axis2[2]. This [3]
should fix the issue.

Thanks,
Ruchith

[1] http://ws.zones.apache.org/dist/rampart/nightly/
[2] http://ws.zones.apache.org/dist/axis2/nightly/
[3] http://svn.apache.org/viewvc?view=rev&rev=469841

On 10/31/06, Johan Andersson <[EMAIL PROTECTED]> wrote:
Greetings,

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

The problem manifests itself as a nullpointer exception in 
org.apache.axiom.om.impl.dom.jaxp.DocumentBuilderFactoryImpl

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 
org.apache.axiom.omimpl.dom.jaxp.DocumentBuilderFactoryImpl

--- snip ---
   public static void setDOOMRequired(boolean isDOOMRequired) {
        String systemKey = DocumentBuilderFactory.class.getName();
        if (isDOOMRequired) {
            if (!isDOOMRequired()) {
                originalDocumentBuilderFactory = 
DocumentBuilderFactorynewInstance();
                originalDocumentBuilderFactoryClassName = 
originalDocumentBuilderFactory.getClass().getName();
                documentBuilderFactoryTracker.set(Boolean.TRUE);
                System.setProperty(systemKey, 
DocumentBuilderFactoryImpl.class.getName());
            }
        } else {
            String currentFactoryClassName = 
DocumentBuilderFactory.newInstance().getClass().getName();
            if (currentFactoryClassName != null && 
currentFactoryClassName.equals(DocumentBuilderFactoryImpl.class.getName())) {
                System.getProperties().remove(systemKey);
                if (originalDocumentBuilderFactoryClassName != null) {
                    System.setProperty(DocumentBuilderFactory.class.getName(), 
originalDocumentBuilderFactoryClassName);
                }
            }
            documentBuilderFactoryTracker.set(null);
            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:
        org.apache.ws.security.WSSecurityException: Cannot encrypt/decrypt 
data; nested exception is:
        org.w3c.dom.DOMException: HIERARCHY_REQUEST_ERR: An attempt was made to 
insert a node where it is not permitted.
        at 
org.apache.axis2.security.WSDoAllReceiver.processMessage(WSDoAllReceiver.java:183)
        at 
org.apache.axis2.security.handler.WSDoAllHandler.invoke(WSDoAllHandler.java:82)
        at org.apache.axis2.engine.Phase.invoke(Phase.java:381)
        at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:473)
        at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:445)
        at 
org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:284)
        at 
org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:157)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:716)


I compared the source of 
org.apache.axiom.om.impl.dom.jaxp.DocumentBuilderFactoryImpl in Axis 1.0 
release and the latest in SVN
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/jaxp/DocumentBuilderFactoryImpl.java?view=markup
and can see no changes in how this is handled.


I have no idea how to proceed as I cannot really have the system property being 
switched back
and forth and it seems rampart cannot use any other DOM implementation.

Any help is greatly appreciated.

Best regards,
Johan Andersson

Gratis Bredbandsabonnemang från Spray. Beställ på 
http://www.spray.se/gratisbredband/?ccode=ONIAFOOTER eller 020-266 000


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--
www.ruchith.org

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to