You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Eclipse Wild Web Developer通过Chrome远程调试无法触发JavaScript断点

解决Eclipse Wild Web Developer无法触发Chrome JavaScript断点的问题

已通过9292端口成功连接Chrome,但设置JavaScript断点时控制台输出错误:

SourceMaps.setBP: /Users/jonathan.fisher/dev/projectx/projectx/src/main/webapp/test.js can't be resolved to a loaded script. It may just not be loaded yet

核心问题是本地文件路径与浏览器加载的脚本路径未正确映射,以下是基于Eclipse JEE Developer Edition的解决步骤:

步骤1:验证项目部署路径映射

  • 右键项目 → 「Properties」→ 「Deployment Assembly」
  • 确认/src/main/webapp已映射到服务器根路径(/),保证浏览器访问test.js的URL为http://localhost:<服务器端口>/test.js,与本地文件路径对应。

步骤2:配置源映射规则

  • 打开「Window」→ 「Preferences」→ 「Language Servers」→ 「JavaScript/TypeScript」→ 「Debugging」
  • 在「Source Map Configuration」中添加映射规则:
    • 本地路径:/Users/jonathan.fisher/dev/projectx/projectx/src/main/webapp
    • 远程URL:http://localhost:<你的Web应用运行端口>/(注意此端口是Web服务端口,而非9292调试端口)

步骤3:禁用浏览器缓存

  • 打开Chrome开发者工具(F12),切换到「Network」面板,勾选「Disable cache」,刷新页面确保test.js重新加载。

步骤4:重启调试会话验证

  • 在test.js的console.log行设置断点,重启Web服务器和Eclipse的Chrome调试会话,访问test.html确认断点触发。

测试文件代码

test.html

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html>
<html>
<head></head>
<body>
    <script src="test.js"></script>
</body>
</html>

test.js

test = function() {
    console.log("############ this function was totally called!");
}

test();

内容的提问来源于stack exchange,提问作者Jonathan S. Fisher

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.16 21:25:30