cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "KARR, DAVID (ATTCINW)" <dk0...@att.com>
Subject RE: Need help writing JAXBElementProvider that uses "jaxbElementClassMap"
Date Tue, 08 Sep 2009 19:48:10 GMT
> -----Original Message-----
> From: Sergey Beryozkin [mailto:sergey.beryozkin@iona.com]
> Sent: Saturday, September 05, 2009 1:23 PM
> To: users@cxf.apache.org
> Subject: Re: Need help writing JAXBElementProvider that uses
> "jaxbElementClassMap"
> 
> 
> Hi
> 
> You can extend JaxbElementProvider and override
> AbstractJAXBProvider.convertToJaxbElemenIfNeeded() and implement it
the
> way
> it's done on the trunk [1].
> 
> let me know please how it goes

I'm getting a screwy error trying to implement a copy of
JAXBElementProvider as a subclass of the original JAXBElementProvider,
with the additional definition of the "jaxbElementClassMap" property.

Before making this change, I was just getting the error saying that
"jaxbElementClassMap" wasn't a property of "JAXBElementProvider", which
isn't surprising.

I've defined a class "TempJAXBElementProvider" which extends
"org.apache.cxf.jaxrs.provider.JAXBElementProvider", and I have the
following bean in my beans.xml:

<bean id="jaxbProvider"
class="org.apache.cxf.jaxrs.provider.TempJAXBElementProvider">
    <property name="jaxbElementClassMap" ref="jaxbElementClassMap" />
</bean>

After implementing this class, I'm now getting the following Spring init
failure:

------
[ERROR] ContextLoader - -Context initialization failed
<org.springframework.beans.factory.BeanCreationException: Error creating
bean with name 'org.apache.cxf.resource.ResourceManager' defined in
class path resource [META-INF/cxf/cxf.xml]: Initialization of bean
failed; nested exception is
org.springframework.beans.factory.CannotLoadBeanClassException: Error
loading class [org.apache.cxf.jaxrs.provider.TempJAXBElementProvider]
for bean with name 'jaxbProvider' defined in ServletContext resource
[/WEB-INF/beans.xml]: problem with class file or dependent class; nested
exception is java.lang.NoClassDefFoundError:
org/apache/cxf/jaxrs/provider/JAXBElementProvider>org.springframework.be
ans.factory.BeanCreationException: Error creating bean with name
'org.apache.cxf.resource.ResourceManager' defined in class path resource
[META-INF/cxf/cxf.xml]: Initialization of bean failed; nested exception
is org.springframework.beans.factory.CannotLoadBeanClassException: Error
loading class [org.apache.cxf.jaxrs.provider.TempJAXBElementProvider]
for bean with name 'jaxbProvider' defined in ServletContext resource
[/WEB-INF/beans.xml]: problem with class file or dependent class; nested
exception is java.lang.NoClassDefFoundError:
org/apache/cxf/jaxrs/provider/JAXBElementProvider
----------------

It doesn't make sense that it can't find the class def for
"org/apache/cxf/jaxrs/provider/JAXBElementProvider".  The only change I
made in what jars are supplied is that I added
"geronimo-stax-api_1.0_spec-1.0.1.jar" as that was apparently needed by
some constructs in the copied JAXBElementProvider class.  I'm obviously
still including the cxf-2.2.3.jar file in the WEB-INF/lib.

> 
> cheers, SErgey
> 
> [1]
>
http://svn.apache.org/repos/asf/cxf/trunk/rt/frontend/jaxrs/src/main/ja
> va/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java
> 
> 
> KARR, DAVID (ATTCINW) wrote:
> >
> > I noticed in the following thread
> > <http://www.mail-archive.com/users@cxf.apache.org/msg09175.html>
that
> > there are some changes in the trunk to allow JAXBElementProvider to
> have
> > a "jaxbElementClassMap" property, which will allow me to bind my
REST
> > services to classes I don't control (or are generated), so I can't
> add
> > "@XmlRootElement" to them.  Sergey mentioned in that thread that it
> > would be straightforward to build that JAXBElementProvider before
the
> > next release it's available in.  Would that be possible?
> >
> >
> 
> --
> View this message in context: http://www.nabble.com/Need-help-writing-
> JAXBElementProvider-that-uses-%22jaxbElementClassMap%22-
> tp25303787p25312013.html
> Sent from the cxf-user mailing list archive at Nabble.com.


Mime
View raw message