The local part cannot be null when creating a QName

We are trying to find a mistake. We get the error above in the logs.

Can someone explain what this message means? Are there any typical reasons for receiving this message?

Stacktrace element:

org.apache.axiom.om.OMException: java.lang.IllegalArgumentException: local part cannot be "null" when creating a QName
            at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:206)
            at org.apache.axiom.om.impl.llom.OMNodeImpl.build(OMNodeImpl.java:318)
            at org.apache.axiom.om.impl.llom.OMElementImpl.build(OMElementImpl.java:618)
            at org.apache.axis2.jaxws.message.util.impl.SAAJConverterImpl.toOM(SAAJConverterImpl.java:147)
            at org.apache.axis2.jaxws.message.impl.XMLPartImpl._convertSE2OM(XMLPartImpl.java:77)
            at org.apache.axis2.jaxws.message.impl.XMLPartBase.getContentAsOMElement(XMLPartBase.java:203)
            at org.apache.axis2.jaxws.message.impl.XMLPartBase.getAsOMElement(XMLPartBase.java:255)
            at org.apache.axis2.jaxws.message.impl.MessageImpl.getAsOMElement(MessageImpl.java:464)
            at org.apache.axis2.jaxws.message.util.MessageUtils.putMessageOnMessageContext(MessageUtils.java:202)
            at org.apache.axis2.jaxws.core.controller.AxisInvocationController.prepareRequest(AxisInvocationController.java:370)
            at org.apache.axis2.jaxws.core.controller.InvocationController.invoke(InvocationController.java:120)
            at org.apache.axis2.jaxws.client.proxy.JAXWSProxyHandler.invokeSEIMethod(JAXWSProxyHandler.java:317)
            at org.apache.axis2.jaxws.client.proxy.JAXWSProxyHandler.invoke(JAXWSProxyHandler.java:148)
+3
source share
3 answers

I got the same error message (local part cannot be "null" when creating QName) when trying to create org.w3c.dom.Document from String. The problem disappeared after calling setNamespaceAware (true) in the DocumentBuilderFactory. The following is a snippet of working code.

private static Document getDocumentFromString(final String xmlContent)
  throws Exception
{
    DocumentBuilderFactory documentBuilderFactory =
                                DocumentBuilderFactory.newInstance();
    documentBuilderFactory.setNamespaceAware(true);
    try
    {
        return documentBuilderFactory
                    .newDocumentBuilder()
                    .parse(new InputSource(new StringReader(xmlContent)));
    }
    catch (Exception e)
    {
        throw new RuntimeException(e);
    }
}   
+5
source

, DOM , , createElementNS,

document.createElementNS(namespace, null)

createElementNS setAttrbuteNS , qname - null , , "foo:".

EDIT:

XML, . , foo: foo:bar:baz, XML, , XML.

+1

, , - . , -, maven-enunciate-cxf-plugin: 1.28.

For me, this was triggered after I added a checked exception to my web service subscription:

    @WebMethod(operationName = "enquirySth")
    public IBANResponse enquirySth(String input) throws     I 
   InvalidInputException { ...

I used the JAX-WS Spec for an exception, but did not succeed. In the end, I found this problem in the Enunciate error tracking system, which indicates that this problem is resolved in the current version, but I think it still exists.

Finally, I made the following workaround to fix my problem: adding @XmlRootElement to my FaultBean.

@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "FaultBean",propOrder = {"errorDescription", "errorCode"})
public class FaultBean implements Serializable {
@XmlElement(required = true, nillable = true)
protected String errorDescription;
@XmlElement(required = true, nillable = true)
protected String errorCode;

public FaultBean() {
}

public String getErrorDescription() {
    return this.errorDescription;
}

public void setErrorDescription(String var1) {
    this.errorDescription = var1;
}

public String getErrorCode() {
    return this.errorCode;
}

public void setErrorCode(String var1) {
    this.errorCode = var1;
}
}

What is it. Hope this helps.

0
source

All Articles