4

I'm running a Java Maven Web Application in VS Code. In debug mode when watching variables I get the above exception instead of the variable value. Say my project is named xyz, this is my launch.json:

{
      "version": "0.2.0",
      "configurations": [        
        
        {
            "type": "chrome",
            "request": "launch",
            "name": "xyz",
            "url": "http://localhost:8080/xyz",
            "webRoot": "${workspaceFolder}/xyz/target/xyz"
        }
      ]
    }

pojectName property is not allowed when using type="chrome" and in pom.xml my artifactId is xyz. It looks like the debugger knows my project name, but can't find it? Other debug features work well. Break points hit and step-ins work. What am I missing here?

I also tried launch.json this way, but the browser is just launched without any url and the problem is still there:

"configurations": [
    {
        "type": "chrome",
        "request": "launch",
        "name": "Launch Chrome against localhost",
        "env": {
            "hostName" : "localhost",
            "port": 8080,
            "root": "${workspaceFolder}/xyz/target/xyz",
            "projectName": "xyz"
        }
    }
  ]
1
  • "type": "chrome",? try "type": "java",.
    – JialeDu
    Commented May 3, 2023 at 6:31

1 Answer 1

2

Delete the webroot configuration and change "type": "chrome" to "type": "java".

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "java",
            "name": "Debug (Attach)",
            "request": "attach",
            "hostName": "localhost",
            "port": 8080
        }
    ]
}

1
  • Thank you very much. That's exactly it. Commented May 4, 2023 at 6:24

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.