You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Graeme Dougal <gr...@tiderian.com> on 2014/02/07 17:11:04 UTC

class AccountDTO nor any of its super class is known to this context

Hi

Getting the following exception when trying to return an object structure
as follows..

I have a Page<T> object that is constructed as Page<AccountDTO> the Page
class contains a List<T> representing the items in the page.  Meaning I can
use Page<T> to represent any type

When trying to return this from a cxf rest end point I get the error
message

class AccountDTO nor any of its super class is known to this context

Any ideas ?

-- 
Regards

Graeme Dougal

Tiderian Consulting

Office  :+44(191) 215 16 50
Mobile : +44(0) 7860 950 815

Email  : graeme@tiderian.com
Web    : www.tiderian.com

Tiderian Consulting is the trading name of Tiderian Consulting Ltd
registered in England No. 6024579

Registered Office Address : 31 Cloverdale Gardens, High Heaton, Newcastle
Upon Tyne, NE7 7QJ

Re: class AccountDTO nor any of its super class is known to this context

Posted by Graeme Dougal <gr...@tiderian.com>.
CXF Version is 2.7.8


On Fri, Feb 7, 2014 at 9:38 PM, Sergey Beryozkin <sb...@gmail.com>wrote:

> Which CXF version is it ?
>
> Thanks, Sergey
>
> On 07/02/14 17:28, Graeme Dougal wrote:
>
>> Thanks
>>
>> Have configured jaxbprovider as follows
>>
>> <bean id="jaxbProvider"
>> class="org.apache.cxf.jaxrs.provider.JAXBElementProvider">
>>        <property name="singleJaxbContext" value="true"/>
>>        <property name="extraClass">
>>           <list>
>>             <value>...package....AccountDTO</value>
>>           </list>
>>        </property>
>> </bean>
>>
>> but still get same error
>>
>> json provider is configured as
>> <bean id="jsonProvider"
>> class="org.apache.cxf.jaxrs.provider.json.JSONProvider">
>>      <property name="dropRootElement" value="false"/>
>>      <property name="supportUnwrapped" value="true" />
>>          <property name="ignoreNamespaces" value="true" />
>>      </bean>
>>
>> Cheers
>> Graeme
>>
>>
>> On Fri, Feb 7, 2014 at 5:02 PM, Sergey Beryozkin <sberyozkin@gmail.com
>> >wrote:
>>
>>  Hi
>>>
>>> On 07/02/14 16:11, Graeme Dougal wrote:
>>>
>>>  Hi
>>>>
>>>> Getting the following exception when trying to return an object
>>>> structure
>>>> as follows..
>>>>
>>>> I have a Page<T> object that is constructed as Page<AccountDTO> the Page
>>>> class contains a List<T> representing the items in the page.  Meaning I
>>>> can
>>>> use Page<T> to represent any type
>>>>
>>>> When trying to return this from a cxf rest end point I get the error
>>>> message
>>>>
>>>> class AccountDTO nor any of its super class is known to this context
>>>>
>>>> Any ideas ?
>>>>
>>>>   JAXB provider does not build the context dynamically, so try using
>>>>
>>> jaxb.index, ObjectFactory, or JAXBElementProvider.extraClass property to
>>> list the additional classes
>>>
>>> Cheers, Sergey
>>>
>>>
>>
>>
>>
>
> --
> Sergey Beryozkin
>
> Talend Community Coders
> http://coders.talend.com/
>
> Blog: http://sberyozkin.blogspot.com
>



-- 
Regards

Graeme Dougal

Tiderian Consulting

Office  :+44(191) 215 16 50
Mobile : +44(0) 7860 950 815

Email  : graeme@tiderian.com
Web    : www.tiderian.com

Tiderian Consulting is the trading name of Tiderian Consulting Ltd
registered in England No. 6024579

Registered Office Address : 31 Cloverdale Gardens, High Heaton, Newcastle
Upon Tyne, NE7 7QJ

Re: class AccountDTO nor any of its super class is known to this context

Posted by Graeme Dougal <gr...@tiderian.com>.
All working now - hadn't realised that same single jaxb context had to be
configured on the JsonProvider as well

Is there any way of solving this without having to list the extra classes
in the configuration, did anything ever get progressed from this -
https://issues.apache.org/jira/browse/CXF-4359

Cheers
Graeme


On Fri, Feb 7, 2014 at 9:38 PM, Sergey Beryozkin <sb...@gmail.com>wrote:

> Which CXF version is it ?
>
> Thanks, Sergey
>
> On 07/02/14 17:28, Graeme Dougal wrote:
>
>> Thanks
>>
>> Have configured jaxbprovider as follows
>>
>> <bean id="jaxbProvider"
>> class="org.apache.cxf.jaxrs.provider.JAXBElementProvider">
>>        <property name="singleJaxbContext" value="true"/>
>>        <property name="extraClass">
>>           <list>
>>             <value>...package....AccountDTO</value>
>>           </list>
>>        </property>
>> </bean>
>>
>> but still get same error
>>
>> json provider is configured as
>> <bean id="jsonProvider"
>> class="org.apache.cxf.jaxrs.provider.json.JSONProvider">
>>      <property name="dropRootElement" value="false"/>
>>      <property name="supportUnwrapped" value="true" />
>>          <property name="ignoreNamespaces" value="true" />
>>      </bean>
>>
>> Cheers
>> Graeme
>>
>>
>> On Fri, Feb 7, 2014 at 5:02 PM, Sergey Beryozkin <sberyozkin@gmail.com
>> >wrote:
>>
>>  Hi
>>>
>>> On 07/02/14 16:11, Graeme Dougal wrote:
>>>
>>>  Hi
>>>>
>>>> Getting the following exception when trying to return an object
>>>> structure
>>>> as follows..
>>>>
>>>> I have a Page<T> object that is constructed as Page<AccountDTO> the Page
>>>> class contains a List<T> representing the items in the page.  Meaning I
>>>> can
>>>> use Page<T> to represent any type
>>>>
>>>> When trying to return this from a cxf rest end point I get the error
>>>> message
>>>>
>>>> class AccountDTO nor any of its super class is known to this context
>>>>
>>>> Any ideas ?
>>>>
>>>>   JAXB provider does not build the context dynamically, so try using
>>>>
>>> jaxb.index, ObjectFactory, or JAXBElementProvider.extraClass property to
>>> list the additional classes
>>>
>>> Cheers, Sergey
>>>
>>>
>>
>>
>>
>
> --
> Sergey Beryozkin
>
> Talend Community Coders
> http://coders.talend.com/
>
> Blog: http://sberyozkin.blogspot.com
>



-- 
Regards

Graeme Dougal

Tiderian Consulting

Office  :+44(191) 215 16 50
Mobile : +44(0) 7860 950 815

Email  : graeme@tiderian.com
Web    : www.tiderian.com

Tiderian Consulting is the trading name of Tiderian Consulting Ltd
registered in England No. 6024579

Registered Office Address : 31 Cloverdale Gardens, High Heaton, Newcastle
Upon Tyne, NE7 7QJ

Re: class AccountDTO nor any of its super class is known to this context

Posted by Sergey Beryozkin <sb...@gmail.com>.
Which CXF version is it ?

Thanks, Sergey
On 07/02/14 17:28, Graeme Dougal wrote:
> Thanks
>
> Have configured jaxbprovider as follows
>
> <bean id="jaxbProvider"
> class="org.apache.cxf.jaxrs.provider.JAXBElementProvider">
>        <property name="singleJaxbContext" value="true"/>
>        <property name="extraClass">
>           <list>
>             <value>...package....AccountDTO</value>
>           </list>
>        </property>
> </bean>
>
> but still get same error
>
> json provider is configured as
> <bean id="jsonProvider"
> class="org.apache.cxf.jaxrs.provider.json.JSONProvider">
>      <property name="dropRootElement" value="false"/>
>      <property name="supportUnwrapped" value="true" />
>          <property name="ignoreNamespaces" value="true" />
>      </bean>
>
> Cheers
> Graeme
>
>
> On Fri, Feb 7, 2014 at 5:02 PM, Sergey Beryozkin <sb...@gmail.com>wrote:
>
>> Hi
>>
>> On 07/02/14 16:11, Graeme Dougal wrote:
>>
>>> Hi
>>>
>>> Getting the following exception when trying to return an object structure
>>> as follows..
>>>
>>> I have a Page<T> object that is constructed as Page<AccountDTO> the Page
>>> class contains a List<T> representing the items in the page.  Meaning I
>>> can
>>> use Page<T> to represent any type
>>>
>>> When trying to return this from a cxf rest end point I get the error
>>> message
>>>
>>> class AccountDTO nor any of its super class is known to this context
>>>
>>> Any ideas ?
>>>
>>>   JAXB provider does not build the context dynamically, so try using
>> jaxb.index, ObjectFactory, or JAXBElementProvider.extraClass property to
>> list the additional classes
>>
>> Cheers, Sergey
>>
>
>
>


-- 
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com

Re: class AccountDTO nor any of its super class is known to this context

Posted by Graeme Dougal <gr...@tiderian.com>.
Thanks

Have configured jaxbprovider as follows

<bean id="jaxbProvider"
class="org.apache.cxf.jaxrs.provider.JAXBElementProvider">
      <property name="singleJaxbContext" value="true"/>
      <property name="extraClass">
         <list>
           <value>...package....AccountDTO</value>
         </list>
      </property>
</bean>

but still get same error

json provider is configured as
<bean id="jsonProvider"
class="org.apache.cxf.jaxrs.provider.json.JSONProvider">
    <property name="dropRootElement" value="false"/>
    <property name="supportUnwrapped" value="true" />
        <property name="ignoreNamespaces" value="true" />
    </bean>

Cheers
Graeme


On Fri, Feb 7, 2014 at 5:02 PM, Sergey Beryozkin <sb...@gmail.com>wrote:

> Hi
>
> On 07/02/14 16:11, Graeme Dougal wrote:
>
>> Hi
>>
>> Getting the following exception when trying to return an object structure
>> as follows..
>>
>> I have a Page<T> object that is constructed as Page<AccountDTO> the Page
>> class contains a List<T> representing the items in the page.  Meaning I
>> can
>> use Page<T> to represent any type
>>
>> When trying to return this from a cxf rest end point I get the error
>> message
>>
>> class AccountDTO nor any of its super class is known to this context
>>
>> Any ideas ?
>>
>>  JAXB provider does not build the context dynamically, so try using
> jaxb.index, ObjectFactory, or JAXBElementProvider.extraClass property to
> list the additional classes
>
> Cheers, Sergey
>



-- 
Regards

Graeme Dougal

Tiderian Consulting

Office  :+44(191) 215 16 50
Mobile : +44(0) 7860 950 815

Email  : graeme@tiderian.com
Web    : www.tiderian.com

Tiderian Consulting is the trading name of Tiderian Consulting Ltd
registered in England No. 6024579

Registered Office Address : 31 Cloverdale Gardens, High Heaton, Newcastle
Upon Tyne, NE7 7QJ

Re: class AccountDTO nor any of its super class is known to this context

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi
On 07/02/14 16:11, Graeme Dougal wrote:
> Hi
>
> Getting the following exception when trying to return an object structure
> as follows..
>
> I have a Page<T> object that is constructed as Page<AccountDTO> the Page
> class contains a List<T> representing the items in the page.  Meaning I can
> use Page<T> to represent any type
>
> When trying to return this from a cxf rest end point I get the error
> message
>
> class AccountDTO nor any of its super class is known to this context
>
> Any ideas ?
>
JAXB provider does not build the context dynamically, so try using 
jaxb.index, ObjectFactory, or JAXBElementProvider.extraClass property to 
list the additional classes

Cheers, Sergey