0 Replies Latest reply on Dec 7, 2007 1:07 AM by Ravi Thokala

    Exception while calling insertBefore() for a static method

    Ravi Thokala Newbie

      Hi,
      I am getting below Exception while i am trying to call insertBefore() for a static method. Please help me out.

      Thanks in advance.

      [java] javassist.CannotCompileException: [source error] not-available: this

      [java] at javassist.CtBehavior.insertBefore(CtBehavior.java:523)

      [java] at com.pg.junit.GenerateClasses.generateUpdatedClass(GenerateClasses.java:150)

      [java] at com.pg.junit.GenerateClasses.generateNewClasses(GenerateClasses.java:108)

      [java] at com.pg.junit.GenerateClasses.runMain(GenerateClasses.java:75)

      [java] at com.pg.junit.GenerateClasses.main(GenerateClasses.java:37)

      [java] Caused by: compile error: not-available: this

      [java] at javassist.compiler.CodeGen.atKeyword(CodeGen.java:1845)

      [java] at javassist.compiler.ast.Keyword.accept(Keyword.java:34)

      [java] at javassist.compiler.CodeGen.atAssignCore(CodeGen.java:846)

      [java] at javassist.compiler.CodeGen.atVariableAssign(CodeGen.java:779)

      [java] at javassist.compiler.CodeGen.atDeclarator(CodeGen.java:713)

      [java] at javassist.compiler.ast.Declarator.accept(Declarator.java:99)

      [java] at javassist.compiler.CodeGen.atStmnt(CodeGen.java:344)

      [java] at javassist.compiler.ast.Stmnt.accept(Stmnt.java:49)

      [java] at javassist.compiler.CodeGen.atStmnt(CodeGen.java:344)

      [java] at javassist.compiler.ast.Stmnt.accept(Stmnt.java:49)

      [java] at javassist.compiler.MemberCodeGen.atTryStmnt(MemberCodeGen.java:140)

      [java] at javassist.compiler.CodeGen.atStmnt(CodeGen.java:360)

      [java] at javassist.compiler.ast.Stmnt.accept(Stmnt.java:49)

      [java] at javassist.compiler.CodeGen.atStmnt(CodeGen.java:344)

      [java] at javassist.compiler.ast.Stmnt.accept(Stmnt.java:49)

      [java] at javassist.compiler.Javac.compileStmnt(Javac.java:558)

      [java] at javassist.CtBehavior.insertBefore(CtBehavior.java:505)

      [java] ... 4 more

      [java] Exception in thread "main" java.lang.NullPointerException

      [java] at com.pg.junit.GenerateClasses.generateNewClasses(GenerateClasses.java:110)

      [java] at com.pg.junit.GenerateClasses.runMain(GenerateClasses.java:75)

      [java] at com.pg.junit.GenerateClasses.main(GenerateClasses.java:37)

      [java] Java Result: 1