Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

debug maven app locally does not work with the java debug extension #1525

Open
kraabrsg opened this issue Jan 8, 2025 · 1 comment
Open

Comments

@kraabrsg
Copy link

kraabrsg commented Jan 8, 2025

Hi, we have a maven app, which is deployed to the mainframe, and we building our own application to fit Java Maven apps into our vscode workflow.

So we need to debug java maven apps for quarkus (maybe open liberty) and for mainframe batch.

To Debug the app local i used this minimal snippet which is working fine in eclipse...

@Dependent
public class BGZ50FileCreator extends JhapBatchApp {

    private final static String appName = "VOR_BGZ50";
    @Override
    public String getAppName() {
        return appName;
    }

    @Override
    public void run() throws CheckedBusinessException {
        System.out.println("Hello World");
    }   
}

In Vscode this exception is thrown before "Hello World" is printed

Unable to invoke public void  at.mysecretlib.init()  
...
Caused by: java.lang.reflect.InvocationTargetException
...
Caused by: java.lang.NullPointerException

Image

When comparing eclipse and vscode command for debug:

eclipse:

C:\mypath\jdk\1.8.0.262-3.b10.redhat.windows.x86_64\bin\javaw.exe -agentlib:jdwp=transport=dt_socket,suspend=y,address=localhost:62642 "-javaagent:C:\mypath2\configuration\org.eclipse.osgi\424\0.cp\lib\javaagent-shaded.jar" -Dfile.encoding=UTF-8 -classpath
"C:\mymaven\at\mytool\mytool-batch\2.171.6\mytool-batch-2.171.6.jar;
....
at.mytoolx.batch.mytoolAppLoader VOR_BGZ50

vscode:

c:\mypath\jdk\1.8.0.262-3.b10.redhat.windows.x86_64\bin\javaw.exe' '-agentlib:jdwp=transport=dt_socket,server=n,suspend=y,address=localhost:50209' '-cp' 'C:\myrepo\myproject\target\classes; C:\mymave\at\mytool\mytool-batch\2.171.6\mytool-batch-2.171.6.jar;
...
'at.mytoolx.batch.mytoolAppLoader' 'VOR_BGZ50'

The noteable differences are the missing javaagent, the additional "server=n" and an additional entry as first argument in classpath.

launch.config (in workspace file)

    "configurations": [
      {
        "type": "java",
        "name": "Java",
        "request": "launch",
        "mainClass": "at.mytoolx.batch.mytoolAppLoader",
        "projectName": "myproject",
        "args": "VOR_BGZ50",
        "javaExec": "c:\\mypath\\jdk\\1.8.0.262-3.b10.redhat.windows.x86_64\\bin\\javaw.exe",
        "shortenCommandLine": "none",
      }

Thanks!

@kraabrsg
Copy link
Author

Hi, got it working ($Test) classpath was missing, i guess there is no way change the name of the terminal ?

Image

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant