java.io.IOException: invalid constant type: 18" Solutions Tried: Googled threads for issue on with powermock - mockito & java-8 Excluded java assist from powermock and added java assist 3.19.0-GA Tried different versions of powermock (1.5.4, 1.6.2...) Below is the exception stack trace: java.lang.IllegalStateException: Failed to transform class with name com.StaticClass. Reason: java.io.IOException: invalid constant type: 18

Stack Overflow | Lucky1989 | 1 year ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    PowerMock: invalid constant type: 18

    Stack Overflow | 1 year ago | R. Kuehteubl
    java.lang.IllegalStateException: Failed to transform class with name test.ContentPanelTest. Reason: java.io.IOException: invalid constant type: 18
  2. 0

    Getting the error in Jenkin console java.lang.RuntimeException: java.io.IOException: invalid constant type: 15

    Stack Overflow | 3 weeks ago | nshinde
    java.lang.RuntimeException: java.io.IOException: invalid constant type: 15 JUnit Report below stack trace java.lang.IllegalStateException: Failed to transform class with name amdocs.APILink.backend.services.arCrgAdjnRef00. Reason: null
  3. 0

    The initializationError test in the WebModuleUtilTest class throws an exception when running under Java 8. <error message="Failed to transform class with name org.openmrs.module.web.WebModuleUtilTest. Reason: java.io.IOException: invalid constant type: 18" type="java.lang.IllegalStateException">java.lang.IllegalStateException: Failed to transform class with name org.openmrs.module.web.WebModuleUtilTest. Reason: java.io.IOException: invalid constant type: 18 at org.powermock.core.classloader.MockClassLoader.loadMockClass(MockClassLoader.java:219) at org.powermock.core.classloader.MockClassLoader.loadModifiedClass(MockClassLoader.java:147) at org.powermock.core.classloader.DeferSupportingClassLoader.loadClass(DeferSupportingClassLoader.java:67) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:340) at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.createDelegatorFromClassloader(JUnit4TestSuiteChunkerImpl.java:132) at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.createDelegatorFromClassloader(JUnit4TestSuiteChunkerImpl.java:39) at org.powermock.tests.utils.impl.AbstractTestSuiteChunkerImpl.createTestDelegators(AbstractTestSuiteChunkerImpl.java:217) at org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.&lt;init&gt;(JUnit4TestSuiteChunkerImpl.java:59) at org.powermock.modules.junit4.common.internal.impl.AbstractCommonPowerMockRunner.&lt;init&gt;(AbstractCommonPowerMockRunner.java:32) at org.powermock.modules.junit4.PowerMockRunner.&lt;init&gt;(PowerMockRunner.java:33) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:408) at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:29) at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:21) at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59) at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26) at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59) at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:26) at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:51) at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:115) at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:102) at org.apache.maven.surefire.Surefire.run(Surefire.java:180) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:350) at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1021) Caused by: java.lang.RuntimeException: java.io.IOException: invalid constant type: 18 at javassist.CtClassType.getClassFile2(CtClassType.java:203) at javassist.CtClassType.subtypeOf(CtClassType.java:303) at javassist.bytecode.stackmap.TypeData$TypeName.update(TypeData.java:274) at javassist.bytecode.stackmap.TypeData$TypeName.setType(TypeData.java:203) at javassist.bytecode.stackmap.TypeData.setType(TypeData.java:46) at javassist.bytecode.stackmap.Tracer.checkParamTypes(Tracer.java:913) at javassist.bytecode.stackmap.Tracer.doInvokeMethod(Tracer.java:818) at javassist.bytecode.stackmap.Tracer.doOpcode148_201(Tracer.java:615) at javassist.bytecode.stackmap.Tracer.doOpcode(Tracer.java:101) at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:182) at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:192) at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:192) at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:192) at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:192) at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:192) at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:192) at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:192) at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:192) at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:192) at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:192) at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:192) at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:192) at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:192) at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:192) at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:192) at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:192) at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:192) at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:192) at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:192) at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:192) at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:192) at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:192) at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:192) at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:192) at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:192) at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:192) at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:192) at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:192) at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:192) at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:192) at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:192) at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:192) at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:192) at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:192) at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:192) at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:141) at javassist.bytecode.stackmap.MapMaker.make(MapMaker.java:96) at javassist.bytecode.MethodInfo.rebuildStackMap(MethodInfo.java:416) at javassist.bytecode.MethodInfo.rebuildStackMapIf6(MethodInfo.java:398) at javassist.expr.ExprEditor.doit(ExprEditor.java:112) at javassist.CtClassType.instrument(CtClassType.java:1374) at org.powermock.core.transformers.impl.MainMockTransformer.transform(MainMockTransformer.java:75) at org.powermock.core.classloader.MockClassLoader.loadMockClass(MockClassLoader.java:215) ... 31 more Caused by: java.io.IOException: invalid constant type: 18 at javassist.bytecode.ConstPool.readOne(ConstPool.java:1090) at javassist.bytecode.ConstPool.read(ConstPool.java:1033) at javassist.bytecode.ConstPool.&lt;init&gt;(ConstPool.java:149) at javassist.bytecode.ClassFile.read(ClassFile.java:737) at javassist.bytecode.ClassFile.&lt;init&gt;(ClassFile.java:108) at javassist.CtClassType.getClassFile2(CtClassType.java:190) ... 83 more </error>

    JIRA | 2 years ago | Wesley Brown
    java.io.IOException: invalid constant type: 18" type="java.lang.IllegalStateException">java.lang.IllegalStateException: Failed to transform class with name org.openmrs.module.web.WebModuleUtilTest. Reason: java.io.IOException: invalid constant type: 18
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Junit test with powermock gives initialization error via eclipse but runs through command line

    Stack Overflow | 3 years ago | user3642013
    java.lang.IllegalStateException: Failed to transform class with name com.paychex.mobile.remote.ReportingMobileRemoteTest. Reason: Invalid index
  6. 0

    Problems getting started coding on Admin UI - Development - OpenMRS Talk

    openmrs.org | 11 months ago
    java.lang.IllegalStateException: Failed to transform class with name org.openmrs.util.OpenmrsUtil. Reason: java.io.IOException: invalid constant type: 15

    4 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.io.IOException

      invalid constant type: 18

      at javassist.bytecode.ConstPool.readOne()
    2. Javassist
      NewExpr.replace
      1. javassist.bytecode.ConstPool.readOne(ConstPool.java:1090)
      2. javassist.bytecode.ConstPool.read(ConstPool.java:1033)
      3. javassist.bytecode.ConstPool.<init>(ConstPool.java:149)
      4. javassist.bytecode.ClassFile.read(ClassFile.java:737)
      5. javassist.bytecode.ClassFile.<init>(ClassFile.java:108)
      6. javassist.CtClassType.getClassFile2(CtClassType.java:190)
      7. javassist.CtClassType.getClassFile2(CtClassType.java:203)
      8. javassist.compiler.MemberResolver.lookupMethod(MemberResolver.java:110)
      9. javassist.compiler.MemberResolver.lookupMethod(MemberResolver.java:96)
      10. javassist.compiler.TypeChecker.atMethodCallCore(TypeChecker.java:704)
      11. javassist.expr.NewExpr$ProceedForNew.setReturnType(NewExpr.java:243)
      12. javassist.compiler.JvstTypeChecker.atCallExpr(JvstTypeChecker.java:146)
      13. javassist.compiler.ast.CallExpr.accept(CallExpr.java:45)
      14. javassist.compiler.TypeChecker.atVariableAssign(TypeChecker.java:248)
      15. javassist.compiler.TypeChecker.atAssignExpr(TypeChecker.java:217)
      16. javassist.compiler.ast.AssignExpr.accept(AssignExpr.java:38)
      17. javassist.compiler.CodeGen.doTypeCheck(CodeGen.java:241)
      18. javassist.compiler.CodeGen.atStmnt(CodeGen.java:329)
      19. javassist.compiler.ast.Stmnt.accept(Stmnt.java:49)
      20. javassist.compiler.CodeGen.atStmnt(CodeGen.java:350)
      21. javassist.compiler.ast.Stmnt.accept(Stmnt.java:49)
      22. javassist.compiler.CodeGen.atIfStmnt(CodeGen.java:404)
      23. javassist.compiler.CodeGen.atStmnt(CodeGen.java:354)
      24. javassist.compiler.ast.Stmnt.accept(Stmnt.java:49)
      25. javassist.compiler.Javac.compileStmnt(Javac.java:568)
      26. javassist.expr.NewExpr.replace(NewExpr.java:206)
      26 frames
    3. powermock-core
      MainMockTransformer$PowerMockExpressionEditor.edit
      1. org.powermock.core.transformers.impl.MainMockTransformer$PowerMockExpressionEditor.edit(MainMockTransformer.java:418)
      1 frame
    4. Javassist
      CtClassType.instrument
      1. javassist.expr.ExprEditor.loopBody(ExprEditor.java:211)
      2. javassist.expr.ExprEditor.doit(ExprEditor.java:90)
      3. javassist.CtClassType.instrument(CtClassType.java:1374)
      3 frames
    5. powermock-core
      DeferSupportingClassLoader.loadClass
      1. org.powermock.core.transformers.impl.MainMockTransformer.transform(MainMockTransformer.java:74)
      2. org.powermock.core.classloader.MockClassLoader.loadMockClass(MockClassLoader.java:251)
      3. org.powermock.core.classloader.MockClassLoader.loadMockClass(MockClassLoader.java:266)
      4. org.powermock.core.classloader.MockClassLoader.loadModifiedClass(MockClassLoader.java:180)
      5. org.powermock.core.classloader.DeferSupportingClassLoader.loadClass(DeferSupportingClassLoader.java:68)
      5 frames
    6. Java RT
      Class.forName
      1. java.lang.ClassLoader.loadClass(ClassLoader.java:357)
      2. java.lang.Class.forName0(Native Method)
      3. java.lang.Class.forName(Class.java:340)
      3 frames
    7. powermock-module-junit4-common
      JUnit4TestSuiteChunkerImpl.createDelegatorFromClassloader
      1. org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.createDelegatorFromClassloader(JUnit4TestSuiteChunkerImpl.java:145)
      2. org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.createDelegatorFromClassloader(JUnit4TestSuiteChunkerImpl.java:40)
      2 frames
    8. powermock-core
      AbstractTestSuiteChunkerImpl.createTestDelegators
      1. org.powermock.tests.utils.impl.AbstractTestSuiteChunkerImpl.createTestDelegators(AbstractTestSuiteChunkerImpl.java:244)
      1 frame
    9. powermock-module-junit4-common
      AbstractCommonPowerMockRunner.<init>
      1. org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.<init>(JUnit4TestSuiteChunkerImpl.java:61)
      2. org.powermock.modules.junit4.common.internal.impl.AbstractCommonPowerMockRunner.<init>(AbstractCommonPowerMockRunner.java:32)
      2 frames
    10. powermock-module-junit4
      PowerMockRunner.<init>
      1. org.powermock.modules.junit4.PowerMockRunner.<init>(PowerMockRunner.java:34)
      1 frame
    11. Java RT
      Constructor.newInstance
      1. sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      2. sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
      3. sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      4. java.lang.reflect.Constructor.newInstance(Constructor.java:408)
      4 frames
    12. JUnit
      ClassRequest.getRunner
      1. org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:104)
      2. org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:86)
      3. org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
      4. org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26)
      5. org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
      6. org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:33)
      6 frames
    13. IDEA
      JUnitStarter.main
      1. com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:67)
      1 frame