IntelliJ远程调试单元测试报错:找不到FileNotFoundException762_DebugLabel
IntelliJ远程调试单元测试报错:找不到本地变量及jaxb-api.jar缓存文件
错误详情
调试单元测试时持续弹出以下错误:
Cannot find local variable 'FileNotFoundException762_DebugLabel' url= file:/Users/rutgerterheide/.gradle/caches/modules-2/files-2.1/com.sun.xml.bind/jaxb-core/2.3.0/d044c784e41d026778693fb44a8026c1fd9a7506/jaxb-api.jar
检查Finder确认该路径下确实不存在jaxb-api.jar,手动添加缓存文件并非合理解决方案。
已尝试的操作
- 清理
/Users/rutgerterheide/.gradle/caches文件夹并重新构建项目 - 切换IntelliJ项目结构中的JDK版本为1.8
环境信息
- Gradle版本:6.8
- JDK版本:OpenJDK 11
- 项目类型:Spring Boot
- 操作系统:macOS 13.3.1 (22E261)
build.gradle相关配置
configurations { saxon compile.exclude group: 'stax', module: 'stax-api' compile.exclude group: 'com.sun.xml.bind', module: 'jaxb-impl' } dependencies { implementation "javax.xml.bind:jaxb-api:2.3.0" implementation "com.sun.xml.bind:jaxb-core:2.3.0" implementation "com.sun.xml.bind:jaxb-impl:2.3.0" implementation "com.sun.xml.ws:jaxws-ri:2.3.3" }
IntelliJ版本信息
IntelliJ IDEA 2023.1 (Ultimate Edition) Build #IU-231.8109.175, built on March 28, 2023 Runtime version: 17.0.6+10-b829.5 aarch64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. macOS 13.3.1 GC: G1 Young Generation, G1 Old Generation Memory: 2048M Cores: 10 Registry: debugger.new.tool.window.layout=true ide.experimental.ui=true editor.minimap.enabled=true Non-Bundled Plugins: com.jetbrains.jax.ws (231.8109.90) com.intellij.bigdatatools (231.8109.175) aws.toolkit (1.64-231) Kotlin: 231-1.8.20-IJ8109.175
可尝试的解决步骤
1. 强制刷新Gradle依赖
错误路径显示在jaxb-core缓存目录下查找jaxb-api.jar,属于依赖映射异常。执行以下命令强制Gradle重新解析并下载依赖:
./gradlew clean build --refresh-dependencies
2. 统一IntelliJ与Gradle的构建配置
- 打开
File > Settings > Build, Execution, Deployment > Build Tools > Gradle - 将
Build and run using和Run tests using均设置为Gradle,避免IDE与Gradle缓存不一致 - 点击
Refresh all Gradle projects按钮重新同步项目
3. 统一项目JDK版本
项目使用OpenJDK 11,切换至JDK 1.8可能引发依赖加载冲突:
- 打开
File > Project Structure > Project Settings > Project,将Project SDK和Project language level都设置为11 - 检查模块配置:
File > Project Structure > Modules,确保所有模块的Language level与项目保持一致
4. 禁用冲突插件
已安装的JAX-WS插件可能干扰调试流程:
- 打开
File > Settings > Plugins,找到com.jetbrains.jax.ws插件并暂时禁用 - 重启IntelliJ后再次尝试调试
5. 清理IntelliJ系统缓存
IDE自身缓存也可能导致异常:
- 执行
File > Invalidate Caches...,选择Invalidate and Restart,清理缓存后重启IDE
内容的提问来源于stack exchange,提问作者Rutger ter Heide
相关产品推荐
相关产品推荐

