2 Replies Latest reply on Jan 6, 2006 10:25 PM by Ben Wang

    targetObject is null. Can't invoke public java.lang.Object A

    Joe Reger Newbie

      Hi there... I'm getting this error:

      [http-8080-2] ERROR org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/].[jsp] - Servlet.service() for servlet jsp threw exception
      org.jboss.util.NestedRuntimeException: CollectionInterceptorUtil.invoke(): targetObject is null. Can't invoke public java.lang.Object AOPClassProxy$1.elementAt(int)
       at org.jboss.cache.aop.collection.CollectionInterceptorUtil.invoke(CollectionInterceptorUtil.java:132)
       at org.jboss.cache.aop.collection.CachedListInterceptor.invoke(CachedListInterceptor.java:125)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
       at AOPClassProxy$1.elementAt(AOPClassProxy$1.java)
       at reger.Accountuser.userCanDoAcl(Accountuser.java:747)

      When I run this code:
      public boolean userCanDoAcl(String aclobjectname, int accountid) {
       if (accountUserAcls!=null){
       for (int i = 0; i < accountUserAcls.size(); i++) {
       AccountUserAcl accountUserAcl = (AccountUserAcl) accountUserAcls.elementAt(i);
       if (accountUserAcl.aclobjectname.equals(aclobjectname) && accountUserAcl.accountid==accountid){
       return true;
       return false;

      The error occurs on the line with "accountUserAcls.elementAt(i)". accountUserAcls is a Vector with an initial null value. This code appears inside an aspectized (JDK1.5) POJO and AccountUserAcl is an acpectized POJO.

      I'm annotating classes like this:

      public class Accountuser {

      Where @Cacheable is:
      package reger.cache.jboss;
      import java.lang.annotation.Target;
      import java.lang.annotation.ElementType;
      public @interface Cacheable {

      And then compiling with aopc via ant, which runs smoothly and appears to instrument properly.

      What exactly is this error telling me? And am I annotating my POJOs properly?

      Thanks for any help you can offer.