Search code examples
javawebspherestax

XMLStreamException: The namespace URI has not been bound to a prefix,IBM jre


My project working fine with tomcat server and now I am trying to run project on WebSphere Liberty Profile(WLP) but its giving me below error for stax implementation

     javax.xml.stream.XMLStreamException: The namespace URI "http://www.example.com/ns1" has not bound to a prefix.
  at  com.ibm.xml.xlxp.api.stax.msg.StAXMessageProvider.throwXMLStreamException(StAXMessageProvider.java:59)
  at com.ibm.xml.xlxp.api.stax.XMLStreamWriterBase.writeAttribute(XMLStreamWriterBase.java:464)
  at com.ibm.xml.xlxp.api.stax.XMLOutputFactoryImpl$XMLStreamWriterProxy.writeAttribute(XMLOutputFactoryImpl.java:157)
  at org.apache.olingo.odata2.core.ep.producer.XmlMetadataProducer.writeAnnotationAttributes(XmlMetadataProducer.java:599)
  at org.apache.olingo.odata2.core.ep.producer.XmlMetadataProducer.writeMetadata(XmlMetadataProducer.java:134)

i have set the classloader policy to parent-last in WLP. how to implement stax in IBM jre


Solution

  • Issue is resolved,thanks for your reply. Here is solution:I have added stax2-api and woodstox-core-asl jar into my project and set below property in my project system.properties

    javax.xml.stream.XMLOutputFactory=com.ctc.wstx.stax.WstxOutputFactory
    javax.xml.stream.XMLInputFactory=com.ctc.wstx.stax.WstxInputFactory