Hi

beans.xml is a CDI config files and you pasted spring config (why the error).

To configure ignoreNamespaces just define an openejb-jar.xml and a
resources.xml as in the johnzon sample explained here
https://rmannibucau.wordpress.com/2014/12/02/apache-johnzon-more-configuration-and-tomee-integration/.
Just adapt it to cxf default json provider.



Romain Manni-Bucau
@rmannibucau
http://www.tomitribe.com
http://rmannibucau.wordpress.com
https://github.com/rmannibucau


2015-01-11 14:23 GMT+01:00 Vincenzo D'Amore <[email protected]>:
> Hi All,
>
> I have create a simple RESTful service but when I tried to return json I have 
> this error:
>
>     java.lang.IllegalStateException: Invalid JSON namespace
>
> Looking at TomEE+ 1.7.1 I saw behind jax-rs implementation there is Apache 
> CXF 2.6.4, so I tried to configure property ignoreNamespaces = true.
>
> Unfortunately, I haven't found any documentation on TomEE, and looking at 
> Apache CXF documentation if I want set ignoreNamespaces = true I should set 
> it into `beans.xml`
>
>     <property name="ignoreNamespaces" value="true"/>
>
> Writing something like:
>
>     <jaxrs:server>
>       <jaxrs:providers>
>         <ref bean="jsonProvider"/>
>       </jaxrs:providers>
>     </jaxrs:server>
>     <bean id="jsonProvider" 
> class="org.apache.cxf.jaxrs.provider.json.JSONProvider">
>        <property name="ignoreNamespaces" value="true"/>
>        <property name="namespaceMap" ref="jsonNamespaceMap"/>
>     </bean>
>
> But in this case I got a different error during the TomEE boot:
>
> `Caused by: javax.xml.bind.UnmarshalException: unexpected element 
> (uri:"http://java.sun.com/xml/ns/javaee";, local:"server"). Expected elements 
> are 
> <{http://java.sun.com/xml/ns/javaee}decorators>,<{http://java.sun.com/xml/ns/javaee}interceptors>,<{http://java.sun.com/xml/ns/javaee}alternatives>`
>
> What do you think, should I continue configure cfx or try to use a different 
> implementation (Jersey)?

Reply via email to