Results 1 to 7 of 7

Thread: Strange "local part cannot be null when creating a QName" error

  1. #1
    Join Date
    Jan 2006
    Posts
    9

    Question Strange "local part cannot be null when creating a QName" error

    Hello,

    I'm developing a web service with Spring-WS 1.0-RC3-20070810.014637-23, running on Tomcat 5.5 / Sun JDK 1.4.2.

    The web service works well, but I have added a PayloadValidatingInterceptor for the request and the response. Now when I run the web service with a invalid request I have :

    PHP Code:
    org.springframework.web.util.NestedServletExceptionRequest processing failednested exception is java.lang.IllegalArgumentExceptionlocal part cannot be 'null' when creating a QName
        org
    .springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:487)
        
    org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:440)
        
    javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
        
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    root cause java.lang.IllegalArgumentExceptionlocal part cannot be 'null' when creating a QName
        javax
    .xml.namespace.QName.<init>(Unknown Source)
        
    javax.xml.namespace.QName.<init>(Unknown Source)
        
    org.apache.axis.message.PrefixedQName.<init>(PrefixedQName.java:30)
        
    org.apache.axis.message.MessageElement.getElementName(MessageElement.java:1504)
        
    org.springframework.ws.soap.saaj.Saaj12Implementation.getName(Saaj12Implementation.java:68)
        
    org.springframework.ws.soap.saaj.SaajSoapMessage.toString(SaajSoapMessage.java:212)
        
    java.lang.String.valueOf(String.java:2131)
        
    java.lang.StringBuffer.append(StringBuffer.java:370)
        
    org.springframework.ws.server.MessageDispatcher.receive(MessageDispatcher.java:168)
        
    org.springframework.ws.transport.support.WebServiceMessageReceiverObjectSupport.handleConnection(WebServiceMessageReceiverObjectSupport.java:86)
        
    org.springframework.ws.transport.http.WebServiceMessageReceiverHandlerAdapter.handle(WebServiceMessageReceiverHandlerAdapter.java:56)
        
    org.springframework.ws.transport.http.MessageDispatcherServlet.doService(MessageDispatcherServlet.java:157)
        
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:475)
        
    org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:440)
        
    javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
        
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803
    Apparently the exception occurs in MessageDispatcher.receive at this line :

    PHP Code:
    logger.debug("MessageDispatcher with name '" beanName "' sends response [" +
                            
    messageContext.getResponse() + "] for request [" messageContext.getRequest() + "]"); 
    when it tries to toString() a WebServiceMessage.

    I have tried to follows step by step in debug mode to see which message is failing but in debug mode, the code works () and the service returns :

    PHP Code:
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <
    soapenv:Body>
        <
    soapenv:Fault>
          <
    faultcode>soapenv:Client</faultcode><faultstring>Validation error</faultstring>
          <
    faultactor></faultactor>
          <
    detail><spring-ws:ValidationError xmlns:spring-ws="http://springframework.org/spring-ws">cvc-pattern-validValue 'John' is not facet-valid with respect to pattern '[A-Z][A-Z][0-9][0-9][0-9][0-9]' for type 'NationalNumber'.</spring-ws:ValidationError><spring-ws:ValidationError xmlns:spring-ws="http://springframework.org/spring-ws">cvc-type.3.1.3The value 'John' of element 'ns1:NNR' is not valid.</spring-ws:ValidationError></detail>
        </
    soapenv:Fault>
      </
    soapenv:Body>
    </
    soapenv:Envelope
    I imagine it should be a classpath conflict somewhere but I can't find it ... Has somebody already met this issue ??

    Thanks.

  2. #2
    Join Date
    Jan 2006
    Posts
    9

    Default

    Ok I have done some more investigations.

    Here is the call stack just before it crashes because the values passed to PrefixedQName are all null :


    PHP Code:
    Thread [http-8080-Processor24] (Suspended (breakpoint at line 30 in PrefixedQName))
        
    PrefixedQName.<init>(StringStringStringline30
        SOAPFault
    (MessageElement).getElementName() line1504
        Saaj12Implementation
    .getName(SOAPElementline68
        SaajSoapMessage
    .toString() line212
        String
    .valueOf(Object) line2131
        StringBuffer
    .append(Object) line370
        SoapMessageDispatcher
    (MessageDispatcher).receive(MessageContextline168
        WebServiceMessageReceiverHandlerAdapter
    (WebServiceMessageReceiverObjectSupport).handleConnection(WebServiceConnectionWebServiceMessageReceiverline86
        WebServiceMessageReceiverHandlerAdapter
    .handle(HttpServletRequestHttpServletResponseObjectline56
        MessageDispatcherServlet
    .doService(HttpServletRequestHttpServletResponseline157
        MessageDispatcherServlet
    (FrameworkServlet).processRequest(HttpServletRequestHttpServletResponseline475
        MessageDispatcherServlet
    (FrameworkServlet).doPost(HttpServletRequestHttpServletResponseline440
        MessageDispatcherServlet
    (HttpServlet).service(HttpServletRequestHttpServletResponseline710
        MessageDispatcherServlet
    (HttpServlet).service(ServletRequestServletResponseline803
        ApplicationFilterChain
    .internalDoFilter(ServletRequestServletResponseline269
        ApplicationFilterChain
    .doFilter(ServletRequestServletResponseline188
        StandardWrapperValve
    .invoke(RequestResponseline210
        StandardContextValve
    .invoke(RequestResponseline174
        StandardHostValve
    .invoke(RequestResponseline127
        ErrorReportValve
    .invoke(RequestResponseline117
        StandardEngineValve
    .invoke(RequestResponseline108
        CoyoteAdapter
    .service(RequestResponseline151
        Http11Processor
    .process(InputStreamOutputStreamline870
        Http11Protocol$JmxHttp11ConnectionHandler
    (Http11BaseProtocol$Http11ConnectionHandler).processConnection(TcpConnectionObject[]) line665
        PoolTcpEndpoint
    .processSocket(SocketTcpConnectionObject[]) line528
        LeaderFollowerWorkerThread
    .runIt(Object[]) line81
        ThreadPool$ControlRunnable
    .run() line685
        ThreadWithAttributes
    (Thread).run() line534 

    In SOAPFault(MessageElement).getElementName() line: 1504

    this= SOAPFault (id=1330)
    _isDirty= true
    _isRoot= true
    attributes= NullAttributes (id=1276)
    children= ArrayList (id=1332)
    context= null
    detail= Detail (id=1333)
    document= null
    encodingStyle= null
    endEventIndex= -1
    fault= AxisFault (id=1334)
    fixupDeserializer= null
    href= null
    id= null
    locale= null
    message= SOAPEnvelope (id=1323)
    name= null
    namespaces= null
    namespaceURI= null
    objectValue= null
    parent= SOAPBody (id=1319)
    prefix (NodeImpl)= null
    prefix (SOAPFault)= null
    qNameAttrs= null
    recorder= null
    startContentsIndex= 0
    startEventIndex= 0
    textRep= null
    typeQName= null
    Then I click on the upper call :

    In Saaj12Implementation.getName(SOAPElement) line: 68

    element= SOAPFault (id=1268)
    _isDirty= false
    _isRoot= true
    attributes= NullAttributes (id=1276)
    children= ArrayList (id=1277)
    context= null
    detail= Detail (id=1278)
    document= null
    encodingStyle= null
    endEventIndex= -1
    fault= AxisFault (id=1279)
    fixupDeserializer= null
    href= null
    id= null
    locale= null
    message= SOAPEnvelope (id=192)
    name= "Fault"
    namespaces= null
    namespaceURI= "http://schemas.xmlsoap.org/soap/envelope/"
    objectValue= null
    parent= SOAPBody (id=183)
    prefix (NodeImpl)= null
    prefix (SOAPFault)= null
    qNameAttrs= null
    recorder= null
    startContentsIndex= 0
    startEventIndex= 0
    textRep= null
    typeQName= null
    Then back on SOAPFault(MessageElement).getElementName() line: 1504

    this= SOAPFault (id=1330)
    _isDirty= false
    _isRoot= true
    attributes= NullAttributes (id=1276)
    children= ArrayList (id=1332)
    context= null
    detail= Detail (id=1333)
    document= null
    encodingStyle= null
    endEventIndex= -1
    fault= AxisFault (id=1334)
    fixupDeserializer= null
    href= null
    id= null
    locale= null
    message= SOAPEnvelope (id=1323)
    name= "Fault"
    namespaces= null
    namespaceURI= "http://schemas.xmlsoap.org/soap/envelope/"
    objectValue= null
    parent= SOAPBody (id=1319)
    prefix (NodeImpl)= null
    prefix (SOAPFault)= null
    qNameAttrs= null
    recorder= null
    startContentsIndex= 0
    startEventIndex= 0
    textRep= null
    typeQName= null

    Apparently, the fact that I click on SOAPFault(MessageElement).getElementName() does initialize something that is not .... Really really strange !!!!!

  3. #3
    Join Date
    Jan 2006
    Posts
    9

    Default

    I did more test.

    I came at this conclusion :

    - The error is caused by the generated SOAPFault (this SOAPFault contains the request validation erros) that has its variable name set to null.

    - If I run the code directly it failes (because the name is null)

    - If I inspect the SOAPFault in the debugger, the name is not null anymore, it succeed.

    My conclusion is that the inspection of the SOAPFault triggers a method call (maybe the toString()) that init the name variable.

    Now I don't know why it occurs ... And how to fix it.

  4. #4
    Join Date
    Nov 2007
    Posts
    2

    Default

    Did you have any luck solving the problem? I'm having the exact same problem, and I can't figure out what's causing this...


    Code:
    DEBUG [2008-01-11 16:48:35,391] org.springframework.ws.transport.http.MessageDispatcherServlet  - Could not complete request
    java.lang.IllegalArgumentException: local part cannot be "null" when creating a QName
    	at javax.xml.namespace.QName.<init>(Unknown Source)
    	at javax.xml.namespace.QName.<init>(Unknown Source)
    	at org.apache.axis.message.PrefixedQName.<init>(PrefixedQName.java:30)
    Any help would be more than welcome,
    Yannik

  5. #5
    Join Date
    Jan 2006
    Posts
    9

    Default

    No, never found a solution ... I just didn't use spring-ws to implements my webservices.

  6. #6
    Join Date
    Oct 2008
    Posts
    2

    Default

    I had the same problem. I've found that I had on my classpath axis libraries. I removed them and problem is gone...

  7. #7
    Join Date
    Sep 2010
    Posts
    1

    Default

    Ok, the thread is quite old now. But the same problem cost me almost one day now and I regularly ended up to this thread when asking google for help.

    Finally, Nelis was quite close. The source of the problem is an incorrect SOAP request, which body gets converted into a SOAPFault during processing.

    If you did not provide a log4.properties file or if you set it to DEBUG level completely the Spring SoapMessageDispatcher tries to log the string representation of the request. But the request body was wrapped into a SOAPFault object which has it's uri, prefix and localname attributes set to null. This finally causes the "java.lang.IllegalArgumentException: local part cannot be "null" when creating a QName" exception.

    So just add this to your log4.properties:

    # Print only messages of level INFO or above in the package org.springframework.ws.server.MessageTracing.sent
    log4j.logger.org.springframework.ws.server.Message Tracing.sent=INFO

    Or, probably as a quick starter, take this log4.properties as a whole:

    # log4j properties
    log4j.rootLogger=DEBUG, default
    log4j.appender.default=org.apache.log4j.ConsoleApp ender
    log4j.appender.default.layout=org.apache.log4j.Pat ternLayout
    log4j.appender.default.layout.ConversionPattern=%5 p [%t] (%F:%L) - %m%n

    # Print only messages of level INFO or above in the package org.springframework.ws.server.MessageTracing.sent
    log4j.logger.org.springframework.ws.server.Message Tracing.sent=INFO

    Last edited by d.duehr; Sep 10th, 2010 at 03:44 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •