Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: NAMESPACE_ERR after adding Xalan to classpath

  1. #1
    Join Date
    Oct 2007
    Posts
    14

    Default NAMESPACE_ERR after adding Xalan to classpath

    Adding Xalan to classpath of my working spring-ws application seems to break my XML stack.

    I'm using spring-ws 1.0.0 (and Java 1.5.0_06, JDOM 1.0, SAAJ 1.3), however even when I upgrade to spring-ws 1.5.0 and use all the libraries that come with it the problem persists.

    I need Xalan completely unrelated to spring-ws, and if I add it to classpath it works, but spring-ws can't create single XML message.

    Is anyone using Xalan 2.7.0 and spring-ws together? Does anyone have any theories where the conflict is?

    This is the exception I get:

    org.springframework.ws.client.WebServiceTransforme rException: Transformation error: org.jdom.JDOMException: Exception in startElement: NAMESPACE_ERR: An attempt is made to create or change an object in a way which is incorrect with regard to namespaces.; nested exception is javax.xml.transform.TransformerException: org.jdom.JDOMException: Exception in startElement: NAMESPACE_ERR: An attempt is made to create or change an object in a way which is incorrect with regard to namespaces.
    Caused by:
    javax.xml.transform.TransformerException: org.jdom.JDOMException: Exception in startElement: NAMESPACE_ERR: An attempt is made to create or change an object in a way which is incorrect with regard to namespaces.
    at org.apache.xalan.transformer.TransformerIdentityIm pl.transform(TransformerIdentityImpl.java:501)
    at org.springframework.ws.client.core.WebServiceTempl ate$4.doWithMessage(WebServiceTemplate.java:352)
    at org.springframework.ws.client.core.WebServiceTempl ate.sendAndReceive(WebServiceTemplate.java:395)
    at org.springframework.ws.client.core.WebServiceTempl ate.doSendAndReceive(WebServiceTemplate.java:350)
    at org.springframework.ws.client.core.WebServiceTempl ate.sendSourceAndReceiveToResult(WebServiceTemplat e.java:296)
    ...
    ---------
    org.jdom.JDOMException: Exception in startElement: NAMESPACE_ERR: An attempt is made to create or change an object in a way which is incorrect with regard to namespaces.
    at org.jdom.output.SAXOutputter.startElement(SAXOutpu tter.java:1028)
    at org.jdom.output.SAXOutputter.element(SAXOutputter. java:894)
    at org.jdom.output.SAXOutputter.elementContent(SAXOut putter.java:1093)
    at org.jdom.output.SAXOutputter.elementContent(SAXOut putter.java:1067)
    at org.jdom.output.SAXOutputter.output(SAXOutputter.j ava:666)
    at org.jdom.transform.JDOMSource$DocumentReader.parse (JDOMSource.java:479)
    at org.apache.xalan.transformer.TransformerIdentityIm pl.transform(TransformerIdentityImpl.java:484)
    at org.springframework.ws.client.core.WebServiceTempl ate$4.doWithMessage(WebServiceTemplate.java:352)
    at org.springframework.ws.client.core.WebServiceTempl ate.sendAndReceive(WebServiceTemplate.java:395)
    at org.springframework.ws.client.core.WebServiceTempl ate.doSendAndReceive(WebServiceTemplate.java:350)
    at org.springframework.ws.client.core.WebServiceTempl ate.sendSourceAndReceiveToResult(WebServiceTemplat e.java:296)
    Caused by: org.w3c.dom.DOMException: NAMESPACE_ERR: An attempt is made to create or change an object in a way which is incorrect with regard to namespaces.
    at org.apache.xml.utils.DOMBuilder.startElement(DOMBu ilder.java:374)
    at org.apache.xalan.transformer.TransformerIdentityIm pl.startElement(TransformerIdentityImpl.java:1072)
    at org.jdom.output.SAXOutputter.startElement(SAXOutpu tter.java:1025)
    ... 44 more
    Caused by:
    org.w3c.dom.DOMException: NAMESPACE_ERR: An attempt is made to create or change an object in a way which is incorrect with regard to namespaces.
    at org.apache.xml.utils.DOMBuilder.startElement(DOMBu ilder.java:374)
    at org.apache.xalan.transformer.TransformerIdentityIm pl.startElement(TransformerIdentityImpl.java:1072)
    at org.jdom.output.SAXOutputter.startElement(SAXOutpu tter.java:1025)
    at org.jdom.output.SAXOutputter.element(SAXOutputter. java:894)
    at org.jdom.output.SAXOutputter.elementContent(SAXOut putter.java:1093)
    at org.jdom.output.SAXOutputter.elementContent(SAXOut putter.java:1067)
    at org.jdom.output.SAXOutputter.output(SAXOutputter.j ava:666)
    at org.jdom.transform.JDOMSource$DocumentReader.parse (JDOMSource.java:479)
    at org.apache.xalan.transformer.TransformerIdentityIm pl.transform(TransformerIdentityImpl.java:484)
    at org.springframework.ws.client.core.WebServiceTempl ate$4.doWithMessage(WebServiceTemplate.java:352)
    at org.springframework.ws.client.core.WebServiceTempl ate.sendAndReceive(WebServiceTemplate.java:395)
    at org.springframework.ws.client.core.WebServiceTempl ate.doSendAndReceive(WebServiceTemplate.java:350)
    at org.springframework.ws.client.core.WebServiceTempl ate.sendSourceAndReceiveToResult(WebServiceTemplat e.java:296)
    ...
    Caused by:
    org.w3c.dom.DOMException: NAMESPACE_ERR: An attempt is made to create or change an object in a way which is incorrect with regard to namespaces.
    at com.sun.org.apache.xerces.internal.dom.CoreDocumen tImpl.checkNamespaceWF(CoreDocumentImpl.java:2388)
    at com.sun.org.apache.xerces.internal.dom.AttrNSImpl. setName(AttrNSImpl.java:126)
    at com.sun.org.apache.xerces.internal.dom.AttrNSImpl. <init>(AttrNSImpl.java:111)
    at com.sun.org.apache.xerces.internal.dom.CoreDocumen tImpl.createAttributeNS(CoreDocumentImpl.java:2012 )
    at com.sun.xml.messaging.saaj.soap.SOAPDocumentImpl.c reateAttributeNS(SOAPDocumentImpl.java:161)
    at com.sun.org.apache.xerces.internal.dom.ElementImpl .setAttributeNS(ElementImpl.java:684)
    at com.sun.xml.messaging.saaj.soap.impl.ElementImpl.s etAttributeNS(ElementImpl.java:1213)
    at org.apache.xml.utils.DOMBuilder.startElement(DOMBu ilder.java:359)
    at org.apache.xalan.transformer.TransformerIdentityIm pl.startElement(TransformerIdentityImpl.java:1072)
    at org.jdom.output.SAXOutputter.startElement(SAXOutpu tter.java:1025)
    at org.jdom.output.SAXOutputter.element(SAXOutputter. java:894)
    at org.jdom.output.SAXOutputter.elementContent(SAXOut putter.java:1093)
    at org.jdom.output.SAXOutputter.elementContent(SAXOut putter.java:1067)
    at org.jdom.output.SAXOutputter.output(SAXOutputter.j ava:666)
    at org.jdom.transform.JDOMSource$DocumentReader.parse (JDOMSource.java:479)
    at org.apache.xalan.transformer.TransformerIdentityIm pl.transform(TransformerIdentityImpl.java:484)
    at org.springframework.ws.client.core.WebServiceTempl ate$4.doWithMessage(WebServiceTemplate.java:352)
    at org.springframework.ws.client.core.WebServiceTempl ate.sendAndReceive(WebServiceTemplate.java:395)
    at org.springframework.ws.client.core.WebServiceTempl ate.doSendAndReceive(WebServiceTemplate.java:350)
    at org.springframework.ws.client.core.WebServiceTempl ate.sendSourceAndReceiveToResult(WebServiceTemplat e.java:296)
    ...

  2. #2
    Join Date
    May 2009
    Posts
    2

    Default org.jdom.JDOMException: Exception in startElement: NAMESPACE_ERR:

    Hi,

    I have the same exception did you find a solution for that

  3. #3
    Join Date
    Oct 2007
    Posts
    14

    Default

    With a lot of experimeniting I did, however this was with Java 1.4 so your mileage may vary. (I ended up not needing Xalan with Java 1.5, and in the meantime that specific project was obsoleted.) With Java 1.5 you might not need some of this (at least not endorsed directory).

    You need specific versions of different .jar files. This is what I ended up with:

    * mail.jar - 1.3.2 (SAAJ 1.2 needs it for some reason, SAAJ 1.3 doesn't)
    * saaj-api.jar - 1.2 (older SAAJ because of Java 1.4)
    * saaj-impl.jar - 1.2 (older SAAJ because of Java 1.4)
    * saxon8.jar
    * saxon8-dom.jar - Saxon/spring-ws dependency
    * dom.jar (JAXP 1.3.2 - from older JAXP version!)
    * wss4j.jar - 1.5.3 (Apache WS-Security implementation which works with Java 1.4)
    * xmlsec.jar - 1.4.1 (wss4j.jar dependancy)

    Apart from that, I needed to put this files into my JAVA_HOME/jre/lib/endorsed folder (they come with Xalan 2.7.0):
    serializer.jar
    xalan.jar
    xercesImpl.jar
    xml-apis.jar

    And you need to set this properties (through code or as JVM parameters):
    System.setProperty("javax.xml.parsers.DocumentBuil derFactory", "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl ");
    System.setProperty("javax.xml.parsers.SAXParserFac tory", "org.apache.xerces.jaxp.SAXParserFactoryImpl") ;
    System.setProperty("javax.xml.transform.Transforme rFactory", "net.sf.saxon.TransformerFactoryImpl");

    I also remember that I got this NAMESPACE_ERR when running spring-ws 1.0.* versions with particular versions of Java 1.5 - it was working with Java 1.5 update 06, but broke with newer builds (I think update 10).

    I lost a lot of time on this one, so if you can in any way upgrade to newest spring-ws that's what I would recommend.

  4. #4
    Join Date
    May 2009
    Posts
    2

    Default

    Thanks for the quick response Domchi

    I am using Spring WS 1.5.6 , Xalan 2.7.0 , SAAJ 1.3 , Java 1.5.

    I am also using Weblogic 10.0 although i am using the SUN SAAJ Message factory implementation instead of the Weblogic one as it gives me weird responses with extra attributes and so on.

    I found potential solutions in many blogs but to no avail.

    1. A problem was found in the org.springframework.ws.soap.saaj.support.SaajXmlRe ader class but it was fixed
    as per this thread http://jira.springframework.org/browse/SWS-275

    2. It seemed to be a Xalan 2.6.0 problem in which they were setting the namespace-prefix attribute to true for the SAX Reader. They seemed to have been fixed the problem in 2.7.0.

    As you mentioned i was not using Xalan as i was using Java 1.5 but explicitly used it just in case.

    I guess i am using the latest versions of all the components, however still seem to be stuck with the same problem.

    Just one more observation that i made was that when i used Weblogic, although i got extra attributes, i did not get this error.

    The messageFactory implementation that i am using is
    <bean id="messageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMe ssageFactory">
    <property name="messageFactory">
    <bean class="com.sun.xml.messaging.saaj.soap.ver1_1.SOAP MessageFactory1_1Impl"/>
    </property>
    </bean>

  5. #5
    Join Date
    Oct 2007
    Posts
    14

    Default

    Which Java 1.5 version are you using?

    NAMESPACE_ERR seems to be some sort of "catch-all" generic error when dependencies break. Each time I got it, I solved it on one of the following ways:

    1. upgrading or downgrading Java version (minor)
    2. checking Tomcat endorsed folders - sometimes I had older version of XML parsers in Tomcat
    3. juggling with .jar files until I made it work

  6. #6
    Join Date
    Mar 2010
    Posts
    4

    Default same problem with me and i have made many trials but not working

    same problem wih me and i have made many trials but not working and this is very urgent woulr any one help pleaseeeeeeeeeeeeeeeeeeeeeeee
    exception below
    you are fast response is very much appreciated



    NAMESPACE_ERR: An attempt is made to create or change an object in a way which is incorrect with regard to namespaces.'
    org.springframework.ws.client.WebServiceTransforme rException: Transformation error: org.w3c.dom.DOMException: NAMESPACE_ERR: An attempt is made to create or change an object in a way which is incorrect with regard to namespaces.; nested exception is javax.xml.transform.TransformerException: org.w3c.dom.DOMException: NAMESPACE_ERR: An attempt is made to create or change an object in a way which is incorrect with regard to namespaces.
    at org.springframework.ws.client.core.WebServiceTempl ate.doSendAndReceive(WebServiceTemplate.java:572)
    at org.springframework.ws.client.core.WebServiceTempl ate.sendAndReceive(WebServiceTemplate.java:502)
    at org.springframework.ws.client.core.WebServiceTempl ate.doSendAndReceive(WebServiceTemplate.java:457)
    at org.springframework.ws.client.core.WebServiceTempl ate.sendSourceAndReceiveToResult(WebServiceTemplat e.java:403)
    at org.springframework.ws.client.core.WebServiceTempl ate.sendSourceAndReceiveToResult(WebServiceTemplat e.java:388)
    at com.syngenta.toolbox.kde.service.KdeClientImpl.doW ebServiceCall(KdeClientImpl.java:148)
    at com.syngenta.toolbox.kde.service.KdeClientImpl.exe cute(KdeClientImpl.java:68)
    at com.syngenta.genie.core.blast.service.Impl.KdeBlas tServiceImpl.blastSearch(KdeBlastServiceImpl.java: 45)
    at com.syngenta.genie.core.blast.service.Impl.BlastSe rviceImpl.blastSearch(BlastServiceImpl.java:58)
    at com.syngenta.genie.core.blast.controller.BlastCont roller.blastSearchSubmit(BlastController.java:87)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknow n Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Un known Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.springframework.web.servlet.mvc.multiaction.Mu ltiActionController.invokeNamedMethod(MultiActionC ontroller.java:473)
    at org.springframework.web.servlet.mvc.multiaction.Mu ltiActionController.handleRequestInternal(MultiAct ionController.java:410)
    at org.springframework.web.servlet.mvc.AbstractContro ller.handleRequest(AbstractController.java:153)
    at org.springframework.web.servlet.mvc.SimpleControll erHandlerAdapter.handle(SimpleControllerHandlerAda pter.java:48)
    at org.springframework.web.servlet.DispatcherServlet. doDispatch(DispatcherServlet.java:875)
    at org.springframework.web.servlet.DispatcherServlet. doService(DispatcherServlet.java:807)
    at org.springframework.web.servlet.FrameworkServlet.p rocessRequest(FrameworkServlet.java:571)
    at org.springframework.web.servlet.FrameworkServlet.d oPost(FrameworkServlet.java:511)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:709)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:802)
    at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:269)
    at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:188)
    at org.acegisecurity.util.FilterChainProxy$VirtualFil terChain.doFilter(FilterChainProxy.java:264)
    at org.acegisecurity.intercept.web.FilterSecurityInte rceptor.invoke(FilterSecurityInterceptor.java:107)
    at org.acegisecurity.intercept.web.FilterSecurityInte rceptor.doFilter(FilterSecurityInterceptor.java:72 )
    at org.acegisecurity.util.FilterChainProxy$VirtualFil terChain.doFilter(FilterChainProxy.java:274)
    at org.acegisecurity.ui.ExceptionTranslationFilter.do Filter(ExceptionTranslationFilter.java:110)
    at org.acegisecurity.util.FilterChainProxy$VirtualFil terChain.doFilter(FilterChainProxy.java:274)
    at org.acegisecurity.providers.anonymous.AnonymousPro cessingFilter.doFilter(AnonymousProcessingFilter.j ava:125)
    at org.acegisecurity.util.FilterChainProxy$VirtualFil terChain.doFilter(FilterChainProxy.java:274)
    at org.acegisecurity.ui.AbstractProcessingFilter.doFi lter(AbstractProcessingFilter.java:217)
    at org.acegisecurity.util.FilterChainProxy$VirtualFil terChain.doFilter(FilterChainProxy.java:274)
    at org.acegisecurity.context.HttpSessionContextIntegr ationFilter.doFilter(HttpSessionContextIntegration Filter.java:229)
    at org.acegisecurity.util.FilterChainProxy$VirtualFil terChain.doFilter(FilterChainProxy.java:274)
    at org.acegisecurity.securechannel.ChannelProcessingF ilter.doFilter(ChannelProcessingFilter.java:138)
    at org.acegisecurity.util.FilterChainProxy$VirtualFil terChain.doFilter(FilterChainProxy.java:274)
    at org.acegisecurity.util.FilterChainProxy.doFilter(F ilterChainProxy.java:148)
    at org.acegisecurity.util.FilterToBeanProxy.doFilter( FilterToBeanProxy.java:98)
    at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:215)
    at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:188)
    at org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:213)
    at org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:172)
    at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:117)
    at org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:108)
    at org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter.java:174)
    at org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:875)
    at org.apache.coyote.http11.Http11BaseProtocol$Http11 ConnectionHandler.processConnection(Http11BaseProt ocol.java:665)
    at org.apache.tomcat.util.net.PoolTcpEndpoint.process Socket(PoolTcpEndpoint.java:528)
    at org.apache.tomcat.util.net.LeaderFollowerWorkerThr ead.runIt(LeaderFollowerWorkerThread.java:81)
    at org.apache.tomcat.util.threads.ThreadPool$ControlR unnable.run(ThreadPool.java:689)
    at java.lang.Thread.run(Unknown Source)
    Caused by: javax.xml.transform.TransformerException: org.w3c.dom.DOMException: NAMESPACE_ERR: An attempt is made to create or change an object in a way which is incorrect with regard to namespaces.
    at com.sun.org.apache.xalan.internal.xsltc.trax.Trans formerImpl.transform(Unknown Source)
    at com.sun.org.apache.xalan.internal.xsltc.trax.Trans formerImpl.transform(Unknown Source)
    at org.springframework.ws.client.core.WebServiceTempl ate$5.doWithMessage(WebServiceTemplate.java:459)
    at org.springframework.ws.client.core.WebServiceTempl ate.doSendAndReceive(WebServiceTemplate.java:535)
    ... 55 more
    Caused by: org.w3c.dom.DOMException: NAMESPACE_ERR: An attempt is made to create or change an object in a way which is incorrect with regard to namespaces.
    at com.sun.org.apache.xerces.internal.dom.CoreDocumen tImpl.checkNamespaceWF(Unknown Source)
    at com.sun.org.apache.xerces.internal.dom.AttrNSImpl. setName(Unknown Source)
    at com.sun.org.apache.xerces.internal.dom.AttrNSImpl. <init>(Unknown Source)
    at com.sun.org.apache.xerces.internal.dom.CoreDocumen tImpl.createAttributeNS(Unknown Source)
    at com.sun.xml.messaging.saaj.soap.SOAPDocumentImpl.c reateAttributeNS(SOAPDocumentImpl.java:161)
    at com.sun.org.apache.xerces.internal.dom.ElementImpl .setAttributeNS(Unknown Source)
    at com.sun.xml.messaging.saaj.soap.impl.ElementImpl.s etAttributeNS(ElementImpl.java:1213)
    at com.sun.org.apache.xalan.internal.xsltc.trax.SAX2D OM.startElement(Unknown Source)
    at com.sun.org.apache.xml.internal.serializer.ToXMLSA XHandler.closeStartTag(Unknown Source)
    at com.sun.org.apache.xml.internal.serializer.ToXMLSA XHandler.characters(Unknown Source)
    at org.jdom.output.SAXOutputter.characters(SAXOutputt er.java:1155)
    at org.jdom.output.SAXOutputter.elementContent(SAXOut putter.java:1100)
    at org.jdom.output.SAXOutputter.elementContent(SAXOut putter.java:1067)
    at org.jdom.output.SAXOutputter.element(SAXOutputter. java:897)
    at org.jdom.output.SAXOutputter.elementContent(SAXOut putter.java:1093)
    at org.jdom.output.SAXOutputter.elementContent(SAXOut putter.java:1067)
    at org.jdom.output.SAXOutputter.element(SAXOutputter. java:897)
    at org.jdom.output.SAXOutputter.output(SAXOutputter.j ava:621)
    at org.jdom.transform.JDOMSource$DocumentReader.parse (JDOMSource.java:476)
    at com.sun.org.apache.xalan.internal.xsltc.trax.Trans formerImpl.transformIdentity(Unknown Source)
    ... 59 more
    INFO : calling or

  7. #7
    Join Date
    Mar 2010
    Posts
    4

    Default

    i forget to mention i am usign java 1.5_08 and spring ws
    thanks in advance
    Last edited by rixsyn; Mar 10th, 2010 at 02:22 PM.

  8. #8
    Join Date
    Oct 2007
    Posts
    14

    Default

    Quote Originally Posted by rixsyn View Post
    i forget to mention i am usign java 1.5_08 and spring ws
    thanks in advance
    Did you try using Java 1.5.0_06? That version always works for me when I get NAMESPACE_ERR. If not, next thing I'd try is upgrading to newest Java 1.5.

  9. #9
    Join Date
    Mar 2010
    Posts
    4

    Default

    thank you so much for your quick response.
    Actually i tried to upgrade to 1.5.0_15-b04 and it worked but unfortunately, I am restricted with JDK 1.5.0_08-b03 at work. Is there no way to get it work with this version?

  10. #10
    Join Date
    Oct 2007
    Posts
    14

    Default

    I don't know, since upgrading/downgrading Java has worked for me in the past.

    The problem is probably in this:
    Important: You may experience unpredictable anomalies if your Xalan-Java and Xerces-Java builds are not in synch.

    ...so the next thing I'd try would be experimenting with transformer/builder/parser properties.

    Good luck.

    And if you do manage to pick correct settings, please post your solution here, I'd be most interested since I've been sporadically having this problem for the last four years.

Posting Permissions

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