cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Josh Cummings <josh.cummi...@gmail.com>
Subject NAMESPACE_ERR when trying to use jaxws:client
Date Tue, 30 Mar 2010 18:12:54 GMT
We are trying to upgrade to 2.2.7 and are getting the following error when
CXF tries to load META-INF/cxf/cxf.xml

NAMESPACE_ERR: An attempt is made to create or change an object in a way
which is incorrect with regard to namespaces.

You can reproduce the error by configuring your applicationContext.xml like
this:

<bean id="clientFactory"
class="org.apache.cxf.jaxws.spring.JaxWsProxyFactoryBeanDefinitionParser.JAXWSSpringClientProxyFactoryBean"
lazy-init="false">
        <property name="serviceClass" value="myClass"/>
        <property name="address" value="myAddress"/>
</bean>

<bean id="client" factory-bean="clientFactory" factory-method="create"/>

The workaround is to load the cxf.xml file through Spring's loader by
importing it in the applicationContext.xml, like is done for the server:

<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml" />

We haven't had to import these files in the past when creating a cxf
client.  We've only had to declare them for a cxf server.  Is this an
expected change?

If it is indeed a bug, it seems to be somewhere in between
TunedDocumentLoader and W3CDomStreamWriter when it is parsing cxf.xml's
"beans" root element.

In TunedDocumentLoader, the namespace-aware SAX Parser Factory sets
fNamespacePrefixes to true, which means that, in
AbstractSAXParser.startElement, the namespace attributes aren't removed from
the list of attributes to write.

Then, in StreamWriterContentHandler.startElement, the namespace attributes
are sent to W3CDomStreamWriter.writeAttribute, where a namespaceURI of null
(instead of "http://www.springframework.org/schema/beans", for example) and
a local of "xmlns" is eventually sent to the document where it fails because
of the null namespaceURI.

Please advise if you see a better approach.

Thanks,
Josh

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message