Hi Sergei,

It is returning the correct type ( RechargeRecords ), and this gets handled
via the aspect without any exception (debugged it with my own eyes), but an
exception is getting thrown after the code completion from within the
framework.

/@Path("/fi/rechargeHistory")
public interface RechargeHistoryService {

    @GET
    @Path("/query/msisdn/{msisdn}")
    @Produces("text/xml")
    public RechargeRecords query(@PathParam("msisdn") long msisdn,
@QueryParam("fromDate") int fromDate, @QueryParam("toDate")int toDate)
throws PAMSException;

}

On Mon, Jan 30, 2012 at 5:04 PM, Sergey Beryozkin <[email protected]>wrote:

> Hi
>
>
> On 30/01/12 14:24, Kiren Pillay wrote:
>
>> Hi All,
>>
>> I have a transaction aspect which returns an object called Response. The
>> Aspect works fine,  ie, when debugging it, the value at the return point
>> is
>> exactly as expected and no exceptions are thrown. However, once this is
>> completed, I am getting a classCast exception with an error trace shown
>> below:
>>
>> za.co.vodacom.pams.messaging.**response.Response cannot be cast to
>> za.co.vodacom.pams.**rechargerecords.**RechargeRecords
>> $Proxy69.query(Unknown Source)
>> sun.reflect.**NativeMethodAccessorImpl.**invoke0(Native Method)
>> sun.reflect.**NativeMethodAccessorImpl.**invoke(**
>> NativeMethodAccessorImpl.java:**39)
>> sun.reflect.**DelegatingMethodAccessorImpl.**invoke(**
>> DelegatingMethodAccessorImpl.**java:25)
>> java.lang.reflect.Method.**invoke(Method.java:597)
>> org.apache.cxf.service.**invoker.AbstractInvoker.**performInvocation(**
>> AbstractInvoker.java:173)
>>
>> At no point in my application code am I doing this cast. RechargeRecords
>> is
>> a subclass of Payload, its a Jaxb generated object.
>>
>> My problem is that I have no line numbers which tells me exactly where
>> this
>> cast occurs. It doesn't look like its in my application code but rather
>> within the cxf AbstractInvoker's proxy. Any ideas to help me resolve this
>> problem (more specifically, finding where the it actually happens) ?
>>
>
> What does the actual resource method return ?
> is it Response or some Payload instance ?
>
> It appears that the resource method is typed to return Payload while
> the aspect returns Response so it confuses the runtime a bit...
>
> Cheers, Sergey
>
>
>
>
>
>
>> Regards
>> Kiren
>> CXF 2.5.1
>>
>>
>> @Around("execution(@za.co.**pams.bs.PAMSTransaction * *(..))")
>> public Object recordStats(**ProceedingJoinPoint point) throws Throwable {
>>
>> Response response = null;
>>
>> if (resultObject instanceof Response) {
>> response = (Response) resultObject;
>> }
>> else
>> if (Payload.class.**isAssignableFrom(resultObject.**getClass())) {
>>
>> response = of.createResponse();
>>
>> Payload payload = (Payload) resultObject;
>> response.setPayload(payload);
>> }
>>
>> try {
>> populateSystemInfo(took, response);
>> response.setMethodSignature(**point.getSignature().toString(**));
>>
>> response.getRequestParams().**addAll(list);
>>
>> auditWorker.**createSuccessfulAuditRecord(**response);
>> }catch (Throwable e) {
>>          response.setDuration(0);  // Test code just to prove no
>> exceptions
>> where thrown here
>> }
>>
>> return response;
>> }
>>
>>
>
> --
> Sergey Beryozkin
>
> Talend Community Coders
> http://coders.talend.com/
>
> Blog: http://sberyozkin.blogspot.com
>

Reply via email to