Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/spring-boot/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javassist编译导致类文件损坏_Java_Spring Boot_Javassist - Fatal编程技术网

Javassist编译导致类文件损坏

Javassist编译导致类文件损坏,java,spring-boot,javassist,Java,Spring Boot,Javassist,我试图在编译时使用javassist插入一些代码片段 环境 爪哇8 弹簧靴2.2.6 冬眠5.4.12.1决赛 Javassist 我得到的编译错误出现在testCompile步骤: [INFO] ------------------------------------------------------------- [ERROR] COMPILATION ERROR : [INFO] ---------------------------------------------------

我试图在编译时使用javassist插入一些代码片段

环境

  • 爪哇8
  • 弹簧靴2.2.6
  • 冬眠5.4.12.1决赛
  • Javassist
我得到的编译错误出现在
testCompile
步骤:

[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] [PATH]/EPAServiceTest.java:[17,44] cannot access [PACKAGE].EP
  bad class file: [PATH]/EP.class
    bad constant pool entry in RegularFileObject[[PATH]/EP.class]
      expected CONSTANT_Utf8_info or CONSTANT_String_info at index 212
    Please remove or make sure it appears in the correct subdirectory of the classpath.
[ERROR] [PATH]/EPAServiceTest.java:[6,1] cannot find symbol
  symbol:   static makeDTO
  location: class
[INFO] 2 errors 
[INFO] -------------------------------------------------------------
当错误显示无法访问文件时,
EP.class
内容如下:


  // IntelliJ API Decompiler stub source generated from a class file
  // Implementation of methods is not available

package corrupted_class_files;

在大量搜索之后,我发现插件使用的
javassist
版本是
3.18.0-GA
,与hibernate
5.14.12的版本不匹配

因此,我已经将插件
javassist
依赖项覆盖到版本
3.24.0-GA
,该版本通过了编译步骤

<dependency>
  <groupId>org.javassist</groupId>
  <artifactId>javassist</artifactId>
  <version>3.24.0-GA</version>
</dependency>

org.javassist
javassist
3.24.0-GA
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] [PATH]/EPAServiceTest.java:[17,44] cannot access [PACKAGE].EP
  bad class file: [PATH]/EP.class
    bad constant pool entry in RegularFileObject[[PATH]/EP.class]
      expected CONSTANT_Utf8_info or CONSTANT_String_info at index 212
    Please remove or make sure it appears in the correct subdirectory of the classpath.
[ERROR] [PATH]/EPAServiceTest.java:[6,1] cannot find symbol
  symbol:   static makeDTO
  location: class
[INFO] 2 errors 
[INFO] -------------------------------------------------------------

  // IntelliJ API Decompiler stub source generated from a class file
  // Implementation of methods is not available

package corrupted_class_files;
<dependency>
  <groupId>org.javassist</groupId>
  <artifactId>javassist</artifactId>
  <version>3.24.0-GA</version>
</dependency>