microsoft / microsoft/vscode-java-debug

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

Ouverte
#1,525 2 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

ai-triaged question
Langage dominant
TypeScript
Étoiles
591
Forks
429
Merge moyen
1 j 9 h
PR mergées (30 j)
19

Description

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!

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez par la workspace launch.config pour mainClass at.mytoolx.batch.mytoolAppLoader et comparez les lignes de commande Java d’Eclipse et de VS Code affichées dans le rapport. Reproduisez le lancement du débogage local avec l’argument VOR_BGZ50 fourni, puis examinez comment la Java debug extension construit le classpath et les options de débogage. C’est terminé lorsque l’application atteint "Hello World" dans VS Code sans l’exception d’initialisation signalée.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
java, vscode
Domaine
devtools
Type d'issue
Bug
Difficulté
4/5
Temps estimé
3-5 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
30/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.