[jboss-user] [JBoss AOP] - Please help with reflection
bornmw
do-not-reply at jboss.com
Thu Dec 20 19:29:17 EST 2007
Hi!
I have a very stupid problem with reflection.
My exception is:
| java -cp .:/projects/lib/jboss-aop_1.5.5.GA/lib-50/jboss-aop-jdk50.jar:/usr/local/pluto-1.1.4/shared/lib/portlet-api-1.0.jar:/usr/local/pluto-1.1.4/webapps/AOPPortlet/WEB-INF/lib/concurrent.jar:/usr/local/pluto-1.1.4/webapps/AOPPortlet/WEB-INF/lib/javassist-snapshot.jar:/usr/local/pluto-1.1.4/webapps/AOPPortlet/WEB-INF/lib/jboss-common.jar:/usr/local/pluto-1.1.4/webapps/AOPPortlet/WEB-INF/lib/trove.jar ConstrTest
| constructor = public Test()
| Exception in thread "main" java.lang.VerifyError: (class: org/jboss/aop/advice/ViewAspect0, method: invoke signature: (Lorg/jboss/aop/joinpoint/Invocation;)Ljava/lang/Object;) Unable to pop operand off an empty stack
| at java.lang.Class.getDeclaredConstructors0(Native Method)
| at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
| at java.lang.Class.getConstructor0(Class.java:2699)
| at java.lang.Class.newInstance0(Class.java:326)
| at java.lang.Class.newInstance(Class.java:308)
| at org.jboss.aop.advice.PerVmAdvice.generateInterceptor(PerVmAdvice.java:132)
| at org.jboss.aop.advice.PerVmAdvice.generateOptimized(PerVmAdvice.java:56)
| at org.jboss.aop.advice.AdviceFactory.create(AdviceFactory.java:68)
| at org.jboss.aop.Advisor.createInterceptorChain(Advisor.java:618)
| at org.jboss.aop.Advisor.pointcutResolved(Advisor.java:888)
| at org.jboss.aop.Advisor.resolveMethodPointcut(Advisor.java:650)
| at org.jboss.aop.ClassAdvisor.createInterceptorChains(ClassAdvisor.java:607)
| at org.jboss.aop.ClassAdvisor.access$300(ClassAdvisor.java:82)
| at org.jboss.aop.ClassAdvisor$1.run(ClassAdvisor.java:299)
| at java.security.AccessController.doPrivileged(Native Method)
| at org.jboss.aop.ClassAdvisor.attachClass(ClassAdvisor.java:271)
| at org.jboss.aop.AspectManager.initialiseClassAdvisor(AspectManager.java:591)
| at org.jboss.aop.AspectManager.getAdvisor(AspectManager.java:579)
| at Test.<clinit>(Test.java)
| 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:513)
| at java.lang.Class.newInstance0(Class.java:355)
| at java.lang.Class.newInstance(Class.java:308)
| at ConstrTest.main(ConstrTest.java:16)
|
|
My code is:
| ClassLoader loader = Thread.currentThread().getContextClassLoader();
| Class clazz = loader.loadClass("Test");
| for (int j = 0; j < clazz.getConstructors().length; j++) {
| Constructor constructor = clazz.getConstructors()[j];
| System.out.println("constructor = " + constructor);
| }
| Test t = (Test) clazz.newInstance();
| System.out.println("t = " + t);
|
Test is a class that is aspectized at compile-time.
What am I doing wrong? Or is it not possible to construct aspectized classes using reflection at all?
Thanks
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4114845#4114845
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4114845
More information about the jboss-user
mailing list