IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

GWT et Vaadin Java Discussion :

Exception with gwt et rpc


Sujet :

GWT et Vaadin Java

  1. #1
    Membre habitué Avatar de zemzoum89
    Profil pro
    Étudiant
    Inscrit en
    Janvier 2010
    Messages
    373
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Janvier 2010
    Messages : 373
    Points : 131
    Points
    131
    Par défaut Exception with gwt et rpc
    Bonjour,

    je suis un débutant avec GWT et j'ai voulu faire un truc simple avec rpc mais j'ai eu cette exception la malgré que j'ai tt programé comme le tuto dit:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    22:51:22.217 [ERROR] [gwttutorial] Uncaught exception escaped
    com.google.gwt.event.shared.UmbrellaException: One or more exceptions caught, see full set in UmbrellaException#getCauses
        at com.google.gwt.event.shared.SimpleEventBus.doFire(SimpleEventBus.java:214)
        at com.google.gwt.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:103)
        at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:96)
        at com.google.gwt.user.client.ui.Widget.fireEvent(Widget.java:107)
        at com.google.gwt.event.dom.client.DomEvent.fireNativeEvent(DomEvent.java:116)
        at com.google.gwt.user.client.ui.Widget.onBrowserEvent(Widget.java:155)
        at com.google.gwt.user.client.DOM.dispatchEventImpl(DOM.java:1308)
        at com.google.gwt.user.client.DOM.dispatchEvent(DOM.java:1264)
        at sun.reflect.GeneratedMethodAccessor16.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
        at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
        at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:157)
        at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:326)
        at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:207)
        at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:126)
        at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
        at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269)
        at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
        at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
        at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:214)
        at sun.reflect.GeneratedMethodAccessor13.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
        at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
        at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:157)
        at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:281)
        at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:531)
        at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:352)
        at java.lang.Thread.run(Unknown Source)
    Caused by: java.lang.NullPointerException: null
        at fr.jl2tho.gwt.tutorial.client.AcListBox$5.onClick(AcListBox.java:380)
        at com.google.gwt.user.client.ui.ListenerWrapper$WrappedClickListener.onClick(ListenerWrapper.java:245)
        at com.google.gwt.event.dom.client.ClickEvent.dispatch(ClickEvent.java:54)
        at com.google.gwt.event.dom.client.ClickEvent.dispatch(ClickEvent.java:1)
        at com.google.gwt.event.shared.SimpleEventBus.doFire(SimpleEventBus.java:204)
        at com.google.gwt.event.shared.SimpleEventBus.fireEvent(SimpleEventBus.java:103)
        at com.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:96)
        at com.google.gwt.user.client.ui.Widget.fireEvent(Widget.java:107)
        at com.google.gwt.event.dom.client.DomEvent.fireNativeEvent(DomEvent.java:116)
        at com.google.gwt.user.client.ui.Widget.onBrowserEvent(Widget.java:155)
        at com.google.gwt.user.client.DOM.dispatchEventImpl(DOM.java:1308)
        at com.google.gwt.user.client.DOM.dispatchEvent(DOM.java:1264)
        at sun.reflect.GeneratedMethodAccessor16.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
        at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
        at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:157)
        at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:326)
        at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:207)
        at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:126)
        at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
        at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269)
        at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
        at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
        at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:214)
        at sun.reflect.GeneratedMethodAccessor13.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
        at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
        at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:157)
        at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:281)
        at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:531)
        at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:352)
        at java.lang.Thread.run(Unknown Source)

    Merci beaucoup pour votre aide... Merciiii

  2. #2
    Rédacteur
    Avatar de MrDuChnok
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Juin 2002
    Messages
    2 112
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Produits et services télécom et Internet

    Informations forums :
    Inscription : Juin 2002
    Messages : 2 112
    Points : 4 240
    Points
    4 240
    Par défaut
    Salut,

    A priori, ton erreur viendrait de là : AcListBox.java (ligne 380).
    Pourrais tu nous fournir un peu de code ?

    Merci.
    Si vous jugez mon post utile dans la résolution de votre problème, n'hésitez pas à utiliser le système de vote afin d'améliorer la qualité du forum

  3. #3
    Membre habitué Avatar de zemzoum89
    Profil pro
    Étudiant
    Inscrit en
    Janvier 2010
    Messages
    373
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Janvier 2010
    Messages : 373
    Points : 131
    Points
    131
    Par défaut
    ben oui voila la classe

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    457
    458
    459
    460
    461
    462
    463
    464
    465
    466
    467
    468
    469
    470
    471
    472
    473
    474
    475
    476
    package fr.jl2tho.gwt.tutorial.client;
     
    import com.google.gwt.core.client.GWT;
    import com.google.gwt.i18n.client.NumberFormat;
    import com.google.gwt.user.client.rpc.AsyncCallback;
    import com.google.gwt.user.client.rpc.ServiceDefTarget;
    import com.google.gwt.user.client.ui.AbsolutePanel;
    import com.google.gwt.user.client.ui.Button;
    import com.google.gwt.user.client.ui.ClickListener;
    import com.google.gwt.user.client.ui.DialogBox;
    import com.google.gwt.user.client.ui.FlexTable;
    import com.google.gwt.user.client.ui.FlowPanel;
    import com.google.gwt.user.client.ui.Label;
    import com.google.gwt.user.client.ui.ScrollPanel;
    import com.google.gwt.user.client.ui.SourcesTableEvents;
    import com.google.gwt.user.client.ui.TableListener;
    import com.google.gwt.user.client.ui.TextBox;
    import com.google.gwt.user.client.ui.Widget;
     
    import fr.jl2tho.gwt.tutorial.client.common.NumberText;
    import fr.jl2tho.gwt.tutorial.server.ListeCompteServiceImpl;
     
    @SuppressWarnings("deprecation")
    public class AcListBox extends DialogBox {
     
    private AbsolutePanel posContainer; // AbsolutePanel qui contient tous les
     
    // controles
     
    private FlexTable table;
     
    private int lastTableRow = 0;
     
    private int selectedRow = -1;
     
    private NumberText soldeIT;
     
    private TextBox prenomIT;
     
    private TextBox nomIT;
     
    private Button modifierPB;
     
    private Button ajouterPB;
     
    private Button supprimerPB;
     
    ServiceDefTarget endpoint;
     
    ListeCompteServiceAsync compteService;
     
    private TextBox lineIT;
     
    public AcListBox() {
     
    super();
     
    setText("Academical test for list");
     
    this.setSize("800px", "600px");
     
    posContainer = new AbsolutePanel();
     
    posContainer.setSize("800px", "600px");
     
    setWidget(posContainer);
     
     
     
     
     
    Button closeButton = new Button("Close");
     
    closeButton.addClickListener(new ClickListener() {
     
    public void onClick(Widget sender) {
     
    AcListBox.this.hide();
     
    }
     
    });
     
     
    // Ce paneau n'accepte qu'un seul widget : il faut donc utiliser
     
    // setWidget et non pas add.
     
    posContainer.add(closeButton, 730, 530);
     
    // **************** Debut du code fonctionnel
     
    // ****************************
     
    // 1) Creation de la FlexTable qui contiendra le titre
     
    FlexTable tableH = new FlexTable();
     
    // Setup the table.
     
    tableH.setCellSpacing(0);
     
    tableH.setCellPadding(0);
     
    tableH.setWidth("100%");
     
    tableH.setStyleName("Jl2tho-ListHeader");
     
    // Creation de la ligne de titre et de la definition des colonnes.
     
    tableH.setText(0, 0, "Nom");
     
    tableH.getColumnFormatter().setWidth(0, "300px");
     
    tableH.setText(0, 1, "Prénom");
     
    tableH.getColumnFormatter().setWidth(1, "300px");
     
    tableH.setText(0, 2, "Solde Compte");
     
    tableH.getColumnFormatter().setWidth(2, "149px");
     
    // La 3eme colonne doit afficher des nombres allignes a droite
     
    tableH.getColumnFormatter().addStyleName(2, "Jl2tho-NumberColumn");
     
    // 2) Creation de la FlexTable qui contiendra la liste
     
    table = new FlexTable();
     
    // Setup the table.
     
    table.setCellSpacing(0);
     
    table.setCellPadding(0);
     
    table.setWidth("100%");
     
    table.setStyleName("Jl2tho-List");
     
    // Definit les colonnes de la liste
     
    table.getColumnFormatter().setWidth(0, "300px");
     
    table.getColumnFormatter().setWidth(1, "300px");
     
    table.getColumnFormatter().setWidth(2, "149px");
     
    table.getColumnFormatter().addStyleName(2, "Jl2tho-NumberColumn");
     
     
    // 3) Creation du ScrollPanel qui contient la liste precedente.
     
    // c’est le scollpanel qui assure l’apparition de l’ascenseur.
     
    ScrollPanel listPanel = new ScrollPanel(table);
     
    listPanel.addStyleName("Jl2tho-listePanel");
     
    // Le panneau occupe tout l’espace disponible
     
    listPanel.setHeight("100%");
     
    listPanel.setWidth("100%");
     
    // 4) Creation du FlowPanel qui contient :
     
    // - la table contenant le titre
     
    // - le ScrollPanel contenant la liste.
     
    FlowPanel listFlowPanel = new FlowPanel();
     
    // Il est impératif de définir la taille du FlowPanel
     
    listFlowPanel.setSize("770px", "220px");
     
    // On ne donne pas de position, chaque widget prend tout l’espace
     
    // disponible.
     
    listFlowPanel.add(tableH);
     
    listFlowPanel.add(listPanel);
     
    // 5) On ajoute la liste a la fenetre :
     
    posContainer.add(listFlowPanel, 10, 31);
     
    insertInList("Durand", "Arthur", 1232.30);
     
    insertInList("Dupond", "Daniel", 50000);
     
    insertInList("Dupont", "Thierry", -50.30);
     
    table.addTableListener(new TableListener() {
     
    public void onCellClicked(SourcesTableEvents sender, int row,
     
    int cell) {
     
    // Select the row that was clicked (-1 to account for header
     
    // row).
     
    if (row > 0) {
     
    selectRow(row - 1);
     
    // Ajout pour la copie
     
    nomIT.setText(table.getText(row, 0));
     
    prenomIT.setText(table.getText(row, 1));
     
    if (table.getCellFormatter().getStyleName(row, 2).equals(
     
    "redText")) {
     
    soldeIT.setText("-" + table.getText(row, 2));
     
    } else {
     
    soldeIT.setText(table.getText(row, 2));
     
    }
     
    }
     
    }
     
    });
     
    // Ajout des controles textes :
     
    Label simpleLabel = new Label("Nom");
     
    posContainer.add(simpleLabel, 10, 283);
     
    simpleLabel = new Label("Prénom");
     
    posContainer.add(simpleLabel, 10, 319);
     
    simpleLabel = new Label("Solde compte");
     
    posContainer.add(simpleLabel, 10, 355);
     
    soldeIT = new NumberText();
     
    posContainer.add(soldeIT, 115, 353);
     
    prenomIT = new TextBox();
     
    posContainer.add(prenomIT, 115, 317);
     
    nomIT = new TextBox();
     
    posContainer.add(nomIT, 115, 281);
     
    modifierPB = new Button("Modifier");
     
    modifierPB.setWidth("90px");
     
    posContainer.add(modifierPB, 408, 528);
     
    ajouterPB = new Button("Ajouter");
     
    ajouterPB.setWidth("90px");
     
    posContainer.add(ajouterPB, 506, 528);
     
    supprimerPB = new Button("Supprimer");
     
    supprimerPB.setWidth("90px");
     
    posContainer.add(supprimerPB, 604, 528);
     
    supprimerPB.addClickListener(new ClickListener() {
     
    public void onClick(Widget sender) {
     
    if (selectedRow > 0) {
     
    // Deselectionner l'affichage
     
    styleRow(selectedRow, false);
     
    // supprimer la ligne
     
    table.removeRow(selectedRow);
     
    // effacer les champs de saisi
     
    nomIT.setText("");
     
    prenomIT.setText("");
     
    soldeIT.setText("");
     
    selectedRow = -1;
     
    }
     
    }
     
    });
     
    modifierPB.addClickListener(new ClickListener() {
     
    public void onClick(Widget sender) {
     
    if (table.getCellFormatter().getStyleName(selectedRow + 1, 2)
     
    .equals("redText")) {
     
    table.getCellFormatter().removeStyleName(selectedRow + 1,
     
    2, "redText");
     
    }
     
    table.setText(selectedRow + 1, 0, nomIT.getText());
     
    table.setText(selectedRow + 1, 1, prenomIT.getText());
     
    double newValue = soldeIT.getValuee();
     
    if (newValue < 0) {
     
    table.getCellFormatter().addStyleName(selectedRow + 1, 2,
     
    "redText");
     
    newValue = -newValue;
     
    NumberFormat.getDecimalFormat().format(selectedRow);
     
    }
     
    table.setText(selectedRow + 1, 2, NumberFormat.getFormat(
     
    "#,##0.00").format(newValue));
     
    }
     
    });
     
     
    ajouterPB.addClickListener(new ClickListener() {
     
     
    	public void onClick(Widget sender) {
     
    		System.out.println("Je suis cool avant inser");
    	insertInList(nomIT.getText(),prenomIT.getText(), soldeIT.getValuee());
     
    	// (3) Create an asynchronous callback to handle the result.
    	System.out.println("Je suis cool apres insert");
     
     
    	// (4) Make the call. Control flow will continue immediately and later
     
    	// 'callback' will be invoked when the RPC completes.
     
    	lineIT.setText("Avant");
    	System.out.println("Je suis cool avant");
    	getService().addCompte(nomIT.getText(),prenomIT.getText(), soldeIT.getValuee(), 
     
    			 new AsyncCallback<Object>() {
     
    		public void onSuccess(Object result) {
    			System.out.println("Je suis cool reussi");
    		lineIT.setText(lineIT.getText()+"Reussi");
     
    		}
     
    		public void onFailure(Throwable caught) {
     
    			lineIT.setText(lineIT.getText()+"échoué");
     
    		}
     
    		});
     
    	lineIT.setText(lineIT.getText()+"Apres");
    	System.out.println("Je suis cool apres");
    	}
     
    	});
    }
     
    public void insertInList(String col1, String col2, double col3) {
     
    int i = lastTableRow++;
     
    table.setText(i + 1, 0, col1);
     
    table.setText(i + 1, 1, col2);
     
    setColonneNombre(i, col3);
     
    }
     
    public void setColonneNombre(int row, double colValue) {
     
    if (colValue < 0) {
     
    table.getCellFormatter().addStyleName(row + 1, 2, "redText");
     
    colValue = -colValue;
     
    }
     
    table.setText(row + 1, 2, NumberFormat.getFormat("#,##0.00").format(
     
    colValue));
     
    }
     
    private void selectRow(int row) {
     
    styleRow(selectedRow, false);
     
    styleRow(row, true);
     
    selectedRow = row;
     
    }
     
    private void styleRow(int row, boolean selected) {
     
    if (row != -1) {
     
    if (selected) {
     
    table.getRowFormatter().addStyleName(row + 1,
     
    "jl2tho-SelectedRow");
     
    } else {
     
    table.getRowFormatter().removeStyleName(row + 1,
     
    "jl2tho-SelectedRow");
     
    }
     
    }
     
    }
     
     
     
     
     
    public ListeCompteServiceAsync getService(){
     
    //Creation et initialisation du proxy client permettant l’appel du service : compte
     
    //1) Creation du stub
     
    compteService = (ListeCompteServiceAsync) GWT.create(ListeCompteService.class);
     
    //2) Definir l’URL : elle doit appartenir au meme domaine que la page html Host
     
    endpoint = (ServiceDefTarget) compteService;
     
    String moduleRelativeURL = GWT.getModuleBaseURL() + "/compte";
     
    endpoint.setServiceEntryPoint(moduleRelativeURL);
     
    //Fin initialisation du proxy client.
     
    return compteService;
    }
    }
    Merci beaucoup pour votre aide c'est très gentil...

    Mais cmt avez vous su d'ou vient l'erreur j'ai cherché mais 'jai aps trouvé

  4. #4
    Rédacteur
    Avatar de MrDuChnok
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Juin 2002
    Messages
    2 112
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Produits et services télécom et Internet

    Informations forums :
    Inscription : Juin 2002
    Messages : 2 112
    Points : 4 240
    Points
    4 240
    Par défaut
    Je pense que l'erreur vient de cette ligne là car dans le stackstrace de l'exception on trouve cette information :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    Caused by: java.lang.NullPointerException: null
        at fr.jl2tho.gwt.tutorial.client.AcListBox$5.onClick(AcListBox.java:380)
    Peux tu indiquer où se situe ta ligne 380 dans ton code ? car là c'est un peu fouillis
    Si vous jugez mon post utile dans la résolution de votre problème, n'hésitez pas à utiliser le système de vote afin d'améliorer la qualité du forum

  5. #5
    Membre habitué Avatar de zemzoum89
    Profil pro
    Étudiant
    Inscrit en
    Janvier 2010
    Messages
    373
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Janvier 2010
    Messages : 373
    Points : 131
    Points
    131
    Par défaut
    voici mon code de la ligne 367 à la ligne 390, merci beaucoup pour votre aide:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    	getService().addCompte(nomIT.getText(),prenomIT.getText(), soldeIT.getValuee(), 
     
    			 new AsyncCallback<Object>() {
     
    		public void onSuccess(Object result) {
    			System.out.println("Je suis cool reussi");
    		lineIT.setText(lineIT.getText()+"Reussi");
     
    		}
     
    		public void onFailure(Throwable caught) {
     
    			lineIT.setText(lineIT.getText()+"échoué");
     
    		}
     
    		});
     
    	lineIT.setText(lineIT.getText()+"Apres");
    	System.out.println("Je suis cool apres");
    	}
     
    	});
    }

  6. #6
    Rédacteur
    Avatar de MrDuChnok
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Juin 2002
    Messages
    2 112
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Produits et services télécom et Internet

    Informations forums :
    Inscription : Juin 2002
    Messages : 2 112
    Points : 4 240
    Points
    4 240
    Par défaut
    Ton objet lineIT n'est jamais initialisé.
    Si vous jugez mon post utile dans la résolution de votre problème, n'hésitez pas à utiliser le système de vote afin d'améliorer la qualité du forum

  7. #7
    Membre habitué Avatar de zemzoum89
    Profil pro
    Étudiant
    Inscrit en
    Janvier 2010
    Messages
    373
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Janvier 2010
    Messages : 373
    Points : 131
    Points
    131
    Par défaut
    Si su il est initialisé avant vous n'avez pas cette partie la...

  8. #8
    Rédacteur
    Avatar de MrDuChnok
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Juin 2002
    Messages
    2 112
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Produits et services télécom et Internet

    Informations forums :
    Inscription : Juin 2002
    Messages : 2 112
    Points : 4 240
    Points
    4 240
    Par défaut
    Alors c'est peut être le getText() qui te renvoi une valeur null ?

    Essaye peut être un truc comme ça :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
     
    public void onFailure(Throwable caught) {
      if (lineIT != null) {
        if (lineIT.getText() != null) {
          lineIT.setText(lineIT.getText()+"échoué");
        } else {
          lineIT.setText("échoué");
        }
      } else {
         System.err.println("erreur OnFailure");
      }
    }
    Si vous jugez mon post utile dans la résolution de votre problème, n'hésitez pas à utiliser le système de vote afin d'améliorer la qualité du forum

  9. #9
    Membre habitué Avatar de zemzoum89
    Profil pro
    Étudiant
    Inscrit en
    Janvier 2010
    Messages
    373
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Janvier 2010
    Messages : 373
    Points : 131
    Points
    131
    Par défaut
    Ah non ce n'est pas ça le problème, je viens d'essayer...

  10. #10
    Membre du Club
    Profil pro
    Inscrit en
    Avril 2007
    Messages
    83
    Détails du profil
    Informations personnelles :
    Âge : 35
    Localisation : France

    Informations forums :
    Inscription : Avril 2007
    Messages : 83
    Points : 57
    Points
    57
    Par défaut
    Salut!

    soldeIT.getValuee() dans ton RPC c'est normal? C'est une méthode que tu as créé?

    Sinon, est-ce que tu pourrais poster la partie de code où tu initialises ton lineIT?

    Quand tu fais ce que propose MrDuchnok, tu obtiens la même erreur sur la même instruction ?

    Cdlt,

    Mister Jpa

  11. #11
    Membre averti
    Profil pro
    Lead Tech Agile
    Inscrit en
    Septembre 2004
    Messages
    316
    Détails du profil
    Informations personnelles :
    Âge : 43
    Localisation : France

    Informations professionnelles :
    Activité : Lead Tech Agile

    Informations forums :
    Inscription : Septembre 2004
    Messages : 316
    Points : 417
    Points
    417
    Par défaut
    En voyant tes sysout : "je suis cool réussi" et "je suis cool apres" je me demande si tu as bien saisi le principe des appels asynchrones ?

    Ca expliquerait ton problème d'initialisation.

    Sais tu que "je suis cool apres" peux s'afficher avant ou apres "je suis cool réussi" en fonction de l'environnement d'execution ?

  12. #12
    Membre habitué Avatar de zemzoum89
    Profil pro
    Étudiant
    Inscrit en
    Janvier 2010
    Messages
    373
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Janvier 2010
    Messages : 373
    Points : 131
    Points
    131
    Par défaut
    euuuh non donc la je crois que j'ai pas bien saisie ce principe franchement... pouvez vous m'aider...

  13. #13
    Membre du Club
    Profil pro
    Inscrit en
    Avril 2007
    Messages
    83
    Détails du profil
    Informations personnelles :
    Âge : 35
    Localisation : France

    Informations forums :
    Inscription : Avril 2007
    Messages : 83
    Points : 57
    Points
    57
    Par défaut
    Pour t'expliquer brièvement de ce que moi j'ai compris.

    L'appel au serveur que tu réalises en GWT (RPC) est un appel asynchrone.

    Cela signifie que ton code continue de s'executer, peut-importe le temps que le serveur va mettre à te répondre.

    Pour faire simple, dans ton code :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
     
    	System.out.println("Je suis cool avant");
    	getService().addCompte(nomIT.getText(),prenomIT.getText(), soldeIT.getValuee(), 
     
    			 new AsyncCallback<Object>() {
     
    		public void onSuccess(Object result) {
    			System.out.println("Je suis cool reussi");
    		lineIT.setText(lineIT.getText()+"Reussi");
     
    		}
     
    		public void onFailure(Throwable caught) {
     
    			lineIT.setText(lineIT.getText()+"échoué");
     
    		}
     
    		});
     
    	lineIT.setText(lineIT.getText()+"Apres");
    	System.out.println("Je suis cool apres");
    Tu affiches "je suis cool avant", puis tu fais une envoi une requête à ton serveur. Ton code continue de se dérouler tranquillement, sans se préoccuper de la requête envoyé.
    Après avoir afficher "je suis cool avant", ton code exécutera les deux dernières lignes.

    En parallèle, tu va avoir le retour de ton appel (dans le onSuccess si tu n'a pas levé d'exception, dans le onFailure si tu as levé une exception).

    C'est parce que l'appel est asynchrone et que les deux partie de code sont exécuté en parallèle que pvoncken te dis que les messages ne vont pas nécessairement s'afficher dans l'ordre dans ta console.

    (Que les gens qui s'y connaisse mieux que moi me corrige si je dis une connerie, mais je pense que je suis globalement dans le vrai.)


    De plus, la commande system.out.prinln, ca t'affiche quelque chose dans la console? Placé sur la partie GWT du code cela m'étonne un peu, mais bon, je ne suis pas un expert.


    Pour finir, je me permet de te recoller les questions mon message précédent auquelles tu n'a pas répondu

    soldeIT.getValuee() dans ton RPC c'est normal? C'est une méthode que tu as créé?

    Sinon, est-ce que tu pourrais poster la partie de code où tu initialises ton lineIT?

    Quand tu fais ce que propose MrDuchnok, tu obtiens la même erreur sur la même instruction ?


    Et enfin pour finir, est-ce que tu pourrais nous donner un lien vers le tuto que tu suis?

    Merci, bonne journée

    Mister Jpa

  14. #14
    Membre habitué Avatar de zemzoum89
    Profil pro
    Étudiant
    Inscrit en
    Janvier 2010
    Messages
    373
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Janvier 2010
    Messages : 373
    Points : 131
    Points
    131
    Par défaut
    Merci beaucoup pour votre aide est c'est avec un grand plaisir que je vais répondre à vos questions (meme si c'est pour mon bien lol)

    pour solde.getValuee() : je ne l'ai pas redéfinie c'était une erreur bete de ma part désolé..

    lineIT= new TextBox();
    lineIT.setText("Avant");

    quand j'ai fait ce qu'il ma proposé j'ai eu le meme problème

    le lien est: http://jl2tho.blogspot.com/

    quand j'ai ajusté getValue() et bien sur j'ai fait le nécessaire avec Double.valueOf() j'ai eu cette erreur la et plus l'autre
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    Je suis cool avant inser
    Je suis cool apres insert
    Je suis cool avant
    [WARN] 404 - POST /gwttutorial//compte (127.0.0.1) 1405 bytes
       Request headers
          Host: 127.0.0.1:8888
          Connection: keep-alive
          Referer: http://127.0.0.1:8888/GwtTutorial.html?gwt.codesvr=127.0.0.1:9997
          Accept: */*
          User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.7 (KHTML, like Gecko) Chrome/7.0.517.44 Safari/534.7
          Accept-Encoding: gzip,deflate,sdch
          Accept-Language: fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4
          Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
          Content-Length: 195
          Origin: http://127.0.0.1:8888
          X-GWT-Module-Base: http://127.0.0.1:8888/gwttutorial/
          Content-Type: text/x-gwt-rpc; charset=UTF-8
          X-GWT-Permutation: HostedMode
       Response headers
          Content-Type: text/html; charset=iso-8859-1
          Content-Length: 1405
    Je suis cool apres

  15. #15
    Membre du Club
    Profil pro
    Inscrit en
    Avril 2007
    Messages
    83
    Détails du profil
    Informations personnelles :
    Âge : 35
    Localisation : France

    Informations forums :
    Inscription : Avril 2007
    Messages : 83
    Points : 57
    Points
    57
    Par défaut
    Je crois que tu as un problème de config...

    Tu pourrais montrer le contenu de ton fichier web.xml?

    Et le contenu du fichier "ListeCompteService.java" si je suis ton tutoriel.


    C'est un peu la galère ton tuto au niveau du code, on voit pas grand chose dans l'code c'est tout plat

  16. #16
    Membre habitué Avatar de zemzoum89
    Profil pro
    Étudiant
    Inscrit en
    Janvier 2010
    Messages
    373
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Janvier 2010
    Messages : 373
    Points : 131
    Points
    131
    Par défaut
    voici le web.xml

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE web-app
        PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
        "http://java.sun.com/dtd/web-app_2_3.dtd">
     
    <web-app>
     
      <!-- Servlets -->
     
      <!-- Default page to serve -->
      <welcome-file-list>
        <welcome-file>GwtTutorial.html</welcome-file>
      </welcome-file-list>
     
     
      <servlet>
      <servlet-name>listeCompteServiceImpl</servlet-name>
      <servlet-class>fr.jl2tho.gwt.tutorial.server.ListeCompteServiceImpl</servlet-class>
    </servlet>
    <servlet-mapping>
      <servlet-name>listeCompteServiceImpl</servlet-name>
      <url-pattern>/gwttutorial/compte</url-pattern>
    </servlet-mapping>
     
     
    </web-app>
    et voici l'interface:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    package fr.jl2tho.gwt.tutorial.client;
     
    import com.google.gwt.user.client.rpc.RemoteService;
     
    public interface ListeCompteService extends RemoteService {
     
    	public void addCompte(String nom, String prenom, double compte)
    	throws IllegalArgumentException;
    }
    merci beaucoup pour votre aide...

  17. #17
    Membre du Club
    Profil pro
    Inscrit en
    Avril 2007
    Messages
    83
    Détails du profil
    Informations personnelles :
    Âge : 35
    Localisation : France

    Informations forums :
    Inscription : Avril 2007
    Messages : 83
    Points : 57
    Points
    57
    Par défaut
    Essaye ça :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    package fr.jl2tho.gwt.tutorial.client;
     
    import com.google.gwt.user.client.rpc.RemoteService;
     
    @RemoteServiceRelativePath("compte") 
    public interface ListeCompteService extends RemoteService {
     
    	public void addCompte(String nom, String prenom, double compte)
    	throws IllegalArgumentException;
    }
    Tu rajoutes le @RemoteServiceRelativePath("compte") dans le code de ton interface.

  18. #18
    Membre habitué Avatar de zemzoum89
    Profil pro
    Étudiant
    Inscrit en
    Janvier 2010
    Messages
    373
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Janvier 2010
    Messages : 373
    Points : 131
    Points
    131
    Par défaut
    Bonjour la cfa marche très très bien et svp vous pouvez me dire à quoi sert au juste le lineIT, parce que dans le cours il ne la meme pas ajouté au panel ?... Merci beaucoup beaucoup pour votre aide... c'est très très gentil de votre part...

  19. #19
    Membre du Club
    Profil pro
    Inscrit en
    Avril 2007
    Messages
    83
    Détails du profil
    Informations personnelles :
    Âge : 35
    Localisation : France

    Informations forums :
    Inscription : Avril 2007
    Messages : 83
    Points : 57
    Points
    57
    Par défaut
    Je pense qu'il a du oublié de l'ajouter.

    Parce que vu que tu changes sa valeur au retour de ton RPC, tu aurais tout intérêt à voir ce qu'il y a dedans..

    Tu devrais voir ce tuto plutôt:
    http://code.google.com/intl/fr-FR/we...ngstarted.html

    Evidemment, il faut comprendre l'anglais un minimum =)

    Tu peux mettre le topic en "résolu".

    Bonne journée

    Mister Jpa

  20. #20
    Membre habitué Avatar de zemzoum89
    Profil pro
    Étudiant
    Inscrit en
    Janvier 2010
    Messages
    373
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Janvier 2010
    Messages : 373
    Points : 131
    Points
    131
    Par défaut
    Merci beaucoup pour votre aide... c'est très gentil de votre part merciiiiii

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. GWT + JUnit + RPC
    Par Mitox dans le forum GWT et Vaadin
    Réponses: 4
    Dernier message: 13/03/2012, 12h36
  2. Réponses: 7
    Dernier message: 07/03/2012, 15h28
  3. GWT sans RPC
    Par jose.hello dans le forum GWT et Vaadin
    Réponses: 3
    Dernier message: 22/02/2012, 11h27
  4. Exception while dispatching incoming RPC call
    Par Génoce dans le forum GWT et Vaadin
    Réponses: 4
    Dernier message: 18/11/2010, 14h18
  5. Erreur GWT Appel RPC
    Par miya dans le forum GWT et Vaadin
    Réponses: 16
    Dernier message: 11/03/2010, 15h49

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo