[jboss-user] [JBoss AOP] - java.lang.ClassCastException

vbatista do-not-reply at jboss.com
Mon Mar 24 20:50:07 EDT 2008


Hello,
  I have developed an AOP module to inject sessionBeans on my web module (through annotations). My module is working correctly with JBoss-5.0.0Beta2, Beta3 and Beta4. Now I am testing it on JBoss4.2.2 and I am having a ClassCastException


  | java.lang.ClassCastException: com.foo.bar.portal.presentation.DefaultActionBeanContext$portalService_Set
  |         at org.jboss.aop.advice.com.foo.bar.core.aop.aspects.InjectSessionBeanAspect1.invoke(InjectSessionBeanAspect1.java)
  |         at com.foo.bar.portal.presentation.DefaultActionBeanContext$portalService_Set.invokeNext(DefaultActionBeanContext$portalService_Set.java)
  |         at com.foo.bar.portal.presentation.DefaultActionBeanContext.portalService_w_$aop(DefaultActionBeanContext.java)
  |         at com.foo.bar.portal.presentation.DefaultActionBeanContext.<init>(DefaultActionBeanContext.java:40)
  |         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
  |         at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
  |         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
  |         at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
  |         at java.lang.Class.newInstance0(Class.java:350)
  |         at java.lang.Class.newInstance(Class.java:303)
  | 


My classes are being aspectized at compile time.
Here is my Advice:


  | 	public Object get(FieldReadInvocation invocation)
  | 		throws Throwable {
  | 		Field field = invocation.getField();		
  | 		String jndiBinding = null;
  | 		try {
  | 			jndiBinding = field.getAnnotation(InjectSessionBean.class).jndiBinding();			
  | 		} catch (RuntimeException e) {
  | 			log.error("Error getting JNDI Binding from Annotation.", e);
  | 			return null;
  | 		}
  | 		log.debug("getJndiBinding:" + jndiBinding + " for field:" + field);
  | 		
  | 		Object object = aopHelper.getSessionBean(jndiBinding);
  | 		return object;
  | 	}
  | 


Any one has any hint for this problem?
Thanks in advance.
Best regards,
Victor Batista 


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

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



More information about the jboss-user mailing list