Announcement Announcement Module
Collapse
No announcement yet.
java.lang.UnsupportedOperationException when retrieving WS response Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • java.lang.UnsupportedOperationException when retrieving WS response

    Hello,

    I am using class WS WebServiceTemplate to call a remote WS end point.
    On the way back of the SOAP call, I come up with an UnsupportedOperationException in AbstractList#add. Here is the end of my stack trace:

    Caused by: java.lang.UnsupportedOperationException
    at java.util.AbstractList.add(AbstractList.java:131)
    at java.util.AbstractList.add(AbstractList.java:91)
    at org.springframework.xml.namespace.SimpleNamespaceC ontext.bindNamespaceUri(SimpleNamespaceContext.jav a:108)
    at org.springframework.xml.stream.StaxStreamXmlReader .startPrefixMapping(StaxStreamXmlReader.java:171)
    at org.springframework.xml.stream.StaxStreamXmlReader .handleStartElement(StaxStreamXmlReader.java:145)
    at org.springframework.xml.stream.StaxStreamXmlReader .parseInternal(StaxStreamXmlReader.java:80)
    at org.springframework.xml.stream.AbstractStaxXmlRead er.parse(AbstractStaxXmlReader.java:128)
    at org.springframework.xml.stream.AbstractStaxXmlRead er.parse(AbstractStaxXmlReader.java:111)
    at com.sun.org.apache.xalan.internal.xsltc.trax.Trans formerImpl.transformIdentity(TransformerImpl.java: 637)
    at com.sun.org.apache.xalan.internal.xsltc.trax.Trans formerImpl.transform(TransformerImpl.java:708)
    ... 80 more

    The cause is pretty clear: method SimpleNamespaceContext#bindNamespaceUri(String prefix, String namespaceUri) contains the following line:
    getPrefixesInternal(namespaceUri).add(prefix); // line 108

    Method getPrefixesInternal(String namespaceUri) in turn contains the following:
    if (defaultNamespaceUri.equals(namespaceUri)) {
    return Collections.singletonList(XMLConstants.DEFAULT_NS_ PREFIX); // line 128
    }

    Method Collections#singletonList returns an *** immutable *** list. Invoking add (in line 108) can only yield an UnsupportedOperationException.

    So I am really stuck. Does someone has any hint? Thanks in advance,

    Ivan

    PS. I use Spring-WS version 1.5.7.
    PPS. I attached the SOAP result.

  • #2
    Someone already raised a Jira issue for the same problem.

    Comment


    • #3
      Thanks very much Tareq. I reverted to version 1.5.6 and my trouble disappeared.

      Comment

      Working...
      X