[jboss-user] [JBoss AOP] - ClassCastException on invocation parameter casting

pepelu do-not-reply at jboss.com
Tue Feb 6 10:15:09 EST 2007


Hi,

   I have a webapp deployed in jboss and successfully deployed an aspect using the default aop deployer, this is the definition:

  | <aop>
  |         <bind pointcut="execution(*core.services.document.DocumentService->*(..))">
  |                 <interceptor class="core.services.aspect.DocumentInterceptor"/>
  |         </bind>
  | </aop>

DocumentInterceptor implements org.jboss.aop.advice.Interceptor and tries to cast one of the parameters to its origin class like this:

DocumentServiceParameters parameter = (DocumentServiceParameters)(((MethodInvocation)invocation).getArguments()[0]);
  | 
this throws a ClassCastException, but if printed, getClass().getName() shows DocumentParameter as instance class and instanceof returns false if asked:

  | 16:10:02,693 INFO  [STDOUT] 16:10:02,692 INFO  [CertificationService] Fin fullSignatureAndCertificateCheck
  | 16:10:02,693 INFO  [STDOUT] Instancia de parametros: core.services.document.DocumentServiceParameters at 1ad2db5
  | 16:10:02,693 INFO  [STDOUT] Is DocumentServiceParameters? false
  | 16:10:02,694 INFO  [STDOUT] 16:10:02,694 ERROR [SendDocWS] Error ejecutando servicio web Document
  | java.lang.ClassCastException: core.services.document.DocumentServiceParameters
  |         at core.services.aspect.DocumentInterceptor.invoke(Unknown Source)


What's wrong here?, I can do reflection to get my DocumentServiceParameters methods invoked, but should be done the right way...

Is this some kind of classloading bug?




View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4011956#4011956

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4011956



More information about the jboss-user mailing list