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

AWT/Swing Java Discussion :

java.lang.NullPointerException Swing et requête SQL


Sujet :

AWT/Swing Java

  1. #1
    Membre actif Avatar de janyoura
    Femme Profil pro
    étudiante ingénierie informatique
    Inscrit en
    Mars 2012
    Messages
    365
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : Tunisie

    Informations professionnelles :
    Activité : étudiante ingénierie informatique

    Informations forums :
    Inscription : Mars 2012
    Messages : 365
    Points : 279
    Points
    279
    Par défaut java.lang.NullPointerException Swing et requête SQL
    Bonjour
    J'ai un problème au niveau de l'exctraction des données à partir de la base de données, j'ai vérifié la requete et elle est correcte, je ne comprend pas donc le problème. Que peut-t-il etre? merci
    J2SEACAGui.java
    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
    package workflow.interfaces;
     
    import jade.gui.TimeChooser;
     
    import java.awt.BorderLayout;
    import java.awt.Dimension;
    import java.awt.GridBagConstraints;
    import java.awt.GridBagLayout;
    import java.awt.Insets;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.event.WindowAdapter;
    import java.awt.event.WindowEvent;
    import java.sql.Connection;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.util.Date;
     
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JOptionPane;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JTextArea;
    import javax.swing.JTextField;
    import javax.swing.SwingConstants;
    import javax.swing.border.BevelBorder;
     
    import com.mysql.jdbc.PreparedStatement;
     
    import entites.Entreprise;
    import entites.Proposition;
     
    import workflow.agents.AgentCommercialAchat;
     
     
    public class J2SEACAGui extends JFrame implements ACAGui {
     
    		private AgentCommercialAchat myAgent;
     
    		private String livre;
    		private Entreprise EntrpAch;
    		private int id_entrepriseAch;
    		private String nom_entrepriseAch;
    		private int marge_nego_achat;
    		private String zone_geo;
    		int id_produit;
    		String desiProdAch;
    		String catProdAch;
    		Proposition propositionAch;
    		int id_proposition;
    		Double quantite_souhaite;
    		int qualite_souhaite;
    		Double prix_souhaite;
    		Date date_livraison_souhaite;
    		String mode_paiement;
    		String transport;
    		int id_acompte;
    		Double prix_unit_max;
     
     
    		  private ResultSet rs;
    		  private Connection connection;
     
    		private JTextField titleTF, desiredCostTF, maxCostTF, deadlineTF;
    		private JButton setDeadlineB;
    		private JButton buyB, resetB, exitB;
    		private JTextArea logTA;
     
    		private Date deadline;
     
    		public J2SEACAGui() {
    			super();
     
    			addWindowListener(new	WindowAdapter() {
    				public void windowClosing(WindowEvent e) {
    					myAgent.doDelete();
    				}
    			} );
     
     
     
    			JPanel rootPanel = new JPanel();
    			rootPanel.setLayout(new GridBagLayout());
    	    rootPanel.setMinimumSize(new Dimension(330, 125));
    	    rootPanel.setPreferredSize(new Dimension(330, 125));
     
    	    ///////////
    	    // Line 0
    	    ///////////
     
    	    GridBagConstraints gridBagConstraints = new GridBagConstraints();
    	    gridBagConstraints.gridx = 0;
    	    gridBagConstraints.gridy = 0;
    	    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    	    gridBagConstraints.insets = new java.awt.Insets(5, 3, 0, 3);
     
     
    	    ///////////
    	    // Line 2
    	    ///////////
    	    JLabel l = new JLabel("Delivery Date:");
    	    l.setHorizontalAlignment(SwingConstants.LEFT);
    	    gridBagConstraints = new GridBagConstraints();
    	    gridBagConstraints.gridx = 0;
    	    gridBagConstraints.gridy = 2;
    	    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    	    gridBagConstraints.insets = new java.awt.Insets(5, 3, 0, 3);
    	    rootPanel.add(l, gridBagConstraints);
     
    	    deadlineTF = new JTextField(64);
    	    deadlineTF.setMinimumSize(new Dimension(146, 20));
    	    deadlineTF.setPreferredSize(new Dimension(146, 20));
    	    deadlineTF.setEnabled(false);
    	    gridBagConstraints = new GridBagConstraints();
    	    gridBagConstraints.gridx = 1;
    	    gridBagConstraints.gridy = 2;
    	    gridBagConstraints.gridwidth = 2;
    	    gridBagConstraints.anchor = GridBagConstraints.NORTHWEST;
    	    gridBagConstraints.insets = new Insets(5, 3, 0, 3);
    	    rootPanel.add(deadlineTF, gridBagConstraints);
     
    	    setDeadlineB = new JButton("Set");
    	    setDeadlineB.setMinimumSize(new Dimension(70, 20));
    	    setDeadlineB.setPreferredSize(new Dimension(70, 20));
    			setDeadlineB.addActionListener(new ActionListener(){
    		  	public void actionPerformed(ActionEvent e) {
    		  		Date d = deadline;
    		  		if (d == null) {
    		  			d = new Date();
    		  		}
    		  		TimeChooser tc = new TimeChooser(d);
    		  		if (tc.showEditTimeDlg(J2SEACAGui.this) == TimeChooser.OK) {
    		  			deadline = tc.getDate();
    		  			deadlineTF.setText(deadline.toString());
    		  		}
    		  	}
    			} );
    	    gridBagConstraints = new GridBagConstraints();
    	    gridBagConstraints.gridx = 3;
    	    gridBagConstraints.gridy = 2;
    	    gridBagConstraints.anchor = GridBagConstraints.NORTHWEST;
    	    gridBagConstraints.insets = new Insets(5, 3, 0, 3);
    	    rootPanel.add(setDeadlineB, gridBagConstraints);
     
    			//setCCB.setMinimumSize(new Dimension(70, 20));
    	    //setCCB.setPreferredSize(new Dimension(70, 20));
    	    gridBagConstraints = new GridBagConstraints();
    	    gridBagConstraints.gridx = 0;
    	    gridBagConstraints.gridy = 3;
    	    gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
    	    gridBagConstraints.anchor = GridBagConstraints.NORTHWEST;
    	    gridBagConstraints.insets = new Insets(5, 3, 0, 3);
     
    	    rootPanel.setBorder(new BevelBorder(BevelBorder.LOWERED));
     
    	    getContentPane().add(rootPanel, BorderLayout.NORTH);
     
     
    	    logTA = new JTextArea();
    	    logTA.setEnabled(false);
    	    JScrollPane jsp = new JScrollPane(logTA);
    	    jsp.setMinimumSize(new Dimension(300, 180));
    	    jsp.setPreferredSize(new Dimension(300, 180));
    	    JPanel p = new JPanel();
    	    p.setBorder(new BevelBorder(BevelBorder.LOWERED));
    	    p.add(jsp);
    	    getContentPane().add(p, BorderLayout.CENTER);
     
     
    	    p = new JPanel();
    	    buyB = new JButton("Buy");
    			buyB.addActionListener(new ActionListener(){
    		  	public void actionPerformed(ActionEvent e) {
    		  	//	String title = titleTF.getText();
     
     
    		  			if (deadline != null && deadline.getTime() > System.currentTimeMillis()) {
     
    		  				System.out.println("agent nom: "+ myAgent.getLocalName());
    		  				String agentName = myAgent.getLocalName();
    		  				try {
    		  					PreparedStatement statement;
    		  					statement = (PreparedStatement) connection.prepareStatement("select id_entreprise from entreprise where nom_entr = (?)");
    		  					statement.setString(1,agentName);
    		  					rs=(ResultSet)statement.executeQuery();
    		  					rs.next();
    		  					 id_entrepriseAch = rs.getInt("id_entreprise");}
    		  					catch (SQLException e1) {
    		  						// TODO Auto-generated catch block
    		  						e1.printStackTrace();
    		  					}		
    		  				try {
    		  					PreparedStatement statement;
    		  				//liste proposition
    		  					statement = (PreparedStatement) connection.prepareStatement("select * from proposition where id_entreprise = (?) and etat = (?)");
    		  					statement.setInt(1,id_entrepriseAch); 
    		  					statement.setString(2,"non lancée");
    		  					 rs=(ResultSet)statement.executeQuery();
    		  					rs.next();
    		  					 id_produit = rs.getInt("id_produit");
    		  					 System.out.println("le produit demandé est d'identifiant "+ id_produit);
    		  					 // il manque update etat
    		  					 rs.close();
    		  					 statement.close();
     
    		  					 // table produit
    		  					 statement = (PreparedStatement) connection.prepareStatement("select * from produit where id_produit = (?)");
    		  						statement.setInt(1,id_produit); 
    		  						 rs=(ResultSet)statement.executeQuery(); 
    		  						rs.next();
    		  						 desiProdAch = rs.getString("designation");
    		  						 catProdAch = rs.getString("categorie");
    		  						 System.out.println("Le produit désiré est de la catégorie "+catProdAch+" et de désignation "+ desiProdAch);
    		  						 rs.close();
    		  						 statement.close();
     
    		  						 // table proposition
     
    		  						 statement = (PreparedStatement) connection.prepareStatement("select * from proposition where id_entreprise = (?) and id_produit = (?)");
    		  							statement.setInt(1,id_entrepriseAch); 
    		  							statement.setInt(2, id_produit);
    		  							 rs=(ResultSet)statement.executeQuery();
    		  							 rs.next();
    		  							 id_proposition = rs.getInt(1);
    		  							 quantite_souhaite = rs.getDouble("quantite_souhaite");
    		  							 qualite_souhaite = rs.getInt("qualite_souhaite");
    		  							 date_livraison_souhaite = rs.getDate("date_livraison");
    		  							 mode_paiement = rs.getString("mode_paiement");
    		  							 transport = rs.getString("transport");
    		  							 id_acompte = rs.getInt("id_acompte");
     
    		  							 System.out.println("Succès proposition extraite");
    		  							 rs.close();
    		  							 statement.close();
    		  							 // enregistrement de la proposition "propositionAch"
    		  							 propositionAch = new Proposition(id_proposition, id_entrepriseAch, id_produit, quantite_souhaite, 
    		  							qualite_souhaite, date_livraison_souhaite, mode_paiement, transport, id_acompte);
    		  							 statement = (PreparedStatement) connection.prepareStatement("select * from negocier_achat where id_entreprise = (?) and id_produit = (?)");
    		  								statement.setInt(1,id_entrepriseAch); 
    		  								statement.setInt(2, id_produit);
    		  								 rs=(ResultSet)statement.executeQuery();
    		  								 rs.next();
    		  								prix_souhaite = rs.getDouble("prix_depart_nego");
    		  								marge_nego_achat = rs.getInt("marge_nego_prix");
    		  								 prix_unit_max = rs.getDouble("prix_unit_max");
    		  								 zone_geo = rs.getString("zone_geo");
     
    		  								System.out.println("données: "+id_produit + desiProdAch + catProdAch+quantite_souhaite+qualite_souhaite+prix_souhaite+date_livraison_souhaite+myAgent.getLocalName());
    		  								myAgent.purchase(id_produit, desiProdAch, catProdAch, quantite_souhaite, qualite_souhaite, prix_souhaite, date_livraison_souhaite, myAgent.getLocalName(), marge_nego_achat, prix_unit_max, mode_paiement, zone_geo);
     
     
    		  			} catch (SQLException e1) {
    						// TODO Auto-generated catch block
    						e1.printStackTrace();
    					}	
     
    		  			}
    		  			else {
    		  				// No deadline specified
    			  			JOptionPane.showMessageDialog(J2SEACAGui.this, "Invalid deadline", "WARNING", JOptionPane.WARNING_MESSAGE);
    		  			}
    		  		}
     
     
    			} );
    	    resetB = new JButton("Reset");
    			resetB.addActionListener(new ActionListener(){
    		  	public void actionPerformed(ActionEvent e) {
     
    		  		deadline = null;
    		  	}
    			} );
    	    exitB = new JButton("Exit");
    			exitB.addActionListener(new ActionListener(){
    		  	public void actionPerformed(ActionEvent e) {
    		  		myAgent.doDelete();
    		  	}
    			} );
     
    	    buyB.setPreferredSize(resetB.getPreferredSize());
    	    exitB.setPreferredSize(resetB.getPreferredSize());
     
    	    p.add(buyB);
    	    p.add(resetB);
    	    p.add(exitB);
     
    	    p.setBorder(new BevelBorder(BevelBorder.LOWERED));
    	    getContentPane().add(p, BorderLayout.SOUTH);
     
    	    pack();
     
    	    setResizable(false);
    		}
     
    		public void setAgent(AgentCommercialAchat a) {
    			myAgent = a;
    			setTitle(myAgent.getName());
    		}
     
    		public void showMessage(String message) {
    			logTA.append(message+"\n");
    		}
    	}	
     
    	/**
             * @param args
             */
    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
    public class AgentCommercialAchat extends WorkflowEngineAgent {
     
    	private Vector knownSellers = new Vector();
     
    	private String livre;
    	private Entreprise EntrpAch;
    	private int id_entrepriseAch;
    	private String nom_entrepriseAch;
    	private int marge_nego_achat;
    	private String zone_geo;
    	int id_produit;
    	String desiProdAch;
    	String catProdAch;
    	Proposition propositionAch;
    	int id_proposition;
    	Double quantite_souhaite;
    	int qualite_souhaite;
    	Double prix_souhaite;
    	Date date_livraison_souhaite;
    	String mode_paiement;
    	String transport;
    	int id_acompte;
    	Double prix_unit_max;
     
     
    	  private ResultSet rs;
    	  private Connection connection;
    	  String agentNameAch;
    		private ACAGui myGui;
     
     
    	/**
             * @param args
             */
    	@Override
    	protected void agentSpecificSetup() throws AgentInitializationException{
    		super.agentSpecificSetup();
    		connectToDB();
    		// Create and show the gui
    				myGui = new J2SEACAGui();
    				myGui.setAgent(this);
    				myGui.show();
    		// Printout a welcome message
    				System.out.println("Hello! Buyer-agent "+getAID().getName()+" is ready.");
    				agentNameAch = getAID().getLocalName();
     
                                /////////////////////////////
                                // Notification vendeurs
                               //////////////////////////////
     
    				// Subscribe to the DF to keep the list of sellers up to date
    				ServiceDescription sd = new ServiceDescription();
    				sd.setType(PropositionVocabulary.STOCK_SELLER_AGENT_TYPE);
    				DFAgentDescription dfTemplate = new DFAgentDescription();
    				dfTemplate.addServices(sd);
    				SearchConstraints sc = new SearchConstraints();
    				// Explicitly set the max-results (default is 1)
    				sc.setMaxResults(new Long(10));
    				ACLMessage subscribe = DFService.createSubscriptionMessage(this, getDefaultDF(), dfTemplate, sc);
    				Behaviour b = new SubscriptionInitiator(this, subscribe) {
    					protected void handleInform(ACLMessage inform) {
    						try {
    							DFAgentDescription[] dfds = DFService.decodeNotification(inform.getContent());
    							for (int i = 0; i < dfds.length; ++i) {
    								Iterator services = dfds[i].getAllServices();
    								if (services.hasNext()) {
    									// Registration/Modification
    									knownSellers.addElement(dfds[i].getName());
    									System.out.println("Actualisation sellers notif "+ knownSellers.get(i));
    								} else {
    									// Deregistration
    									knownSellers.removeElement(dfds[i].getName());
    								}
    							}
     
     
    						}
    						catch (FIPAException fe) {
    							fe.printStackTrace();
    						}
    					}
    				};
    	addBehaviour(b);
    			System.out.println("après behaviour add les sellers sont: "+ knownSellers);
     
    	}
    public void connectToDB() {
    		try {
    			Class.forName("com.mysql.jdbc.Driver");
    			connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/dest", "***", "****");
    			System.out.println("Connexion effective !");
     
    		     } catch (ClassNotFoundException e) {
     
    			e.printStackTrace();
    			System.out.println("Erreur driver");
    		} catch (SQLException e) {
     
    			e.printStackTrace();
    			System.out.println("Erreur bd");
    		}
    	}
    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
    agent nom: valeo
    Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    	at workflow.interfaces.J2SEACAGui$3.actionPerformed(J2SEACAGui.java:185)
    	at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    	at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
    	at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    	at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
    	at java.awt.Component.processMouseEvent(Unknown Source)
    	at javax.swing.JComponent.processMouseEvent(Unknown Source)
    	at java.awt.Component.processEvent(Unknown Source)
    	at java.awt.Container.processEvent(Unknown Source)
    	at java.awt.Component.dispatchEventImpl(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Window.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    	at java.awt.EventQueue.access$200(Unknown Source)
    	at java.awt.EventQueue$3.run(Unknown Source)
    	at java.awt.EventQueue$3.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
    	at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
    	at java.awt.EventQueue$4.run(Unknown Source)
    	at java.awt.EventQueue$4.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
    	at java.awt.EventQueue.dispatchEvent(Unknown Source)
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.run(Unknown Source)
    "Scientists dream about doing great things. Engineers do them.”

    La réussite après tant de travail est un sentiment à vivre

    Si ton message est résolu, il y a un bouton qui est fait pour ça :
    Il se trouve tout en bas de la conversation !

    N'oublie pas que si ce message t'as aidé, tu peux voter pour lui en utilisant

  2. #2
    Expert éminent sénior
    Avatar de tchize_
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2007
    Messages
    25 481
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 44
    Localisation : Belgique

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2007
    Messages : 25 481
    Points : 48 806
    Points
    48 806
    Par défaut
    Comme le dit le message d'erreur, t'appelle une méthode sur un objet null. En l'occurence, connection n'est pas initialisé, nulle part dans ta classe.

  3. #3
    Membre actif Avatar de janyoura
    Femme Profil pro
    étudiante ingénierie informatique
    Inscrit en
    Mars 2012
    Messages
    365
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : Tunisie

    Informations professionnelles :
    Activité : étudiante ingénierie informatique

    Informations forums :
    Inscription : Mars 2012
    Messages : 365
    Points : 279
    Points
    279
    Par défaut
    Citation Envoyé par tchize_ Voir le message
    Comme le dit le message d'erreur, t'appelle une méthode sur un objet null. En l'occurence, connection n'est pas initialisé, nulle part dans ta classe.
    la connection est initialisé dans la classe AgentCommercialAchat
    "Scientists dream about doing great things. Engineers do them.”

    La réussite après tant de travail est un sentiment à vivre

    Si ton message est résolu, il y a un bouton qui est fait pour ça :
    Il se trouve tout en bas de la conversation !

    N'oublie pas que si ce message t'as aidé, tu peux voter pour lui en utilisant

  4. #4
    Expert éminent sénior
    Avatar de tchize_
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2007
    Messages
    25 481
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 44
    Localisation : Belgique

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2007
    Messages : 25 481
    Points : 48 806
    Points
    48 806
    Par défaut
    Sauf que l'erreur concerne J2SEACAGui, et le champ connection de cette classe n'est initialisé nulle part.

Discussions similaires

  1. [AWT/ Swing] Erreur "java.lang.NullPointerException"
    Par leconteconte dans le forum Agents de placement/Fenêtres
    Réponses: 9
    Dernier message: 11/12/2012, 14h52
  2. Réponses: 2
    Dernier message: 26/09/2012, 13h02
  3. Réponses: 8
    Dernier message: 11/05/2006, 19h32
  4. [JDIC]Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    Par kedare dans le forum Concurrence et multi-thread
    Réponses: 4
    Dernier message: 06/05/2006, 22h45
  5. java.lang.NullPointerException getparent()
    Par guano dans le forum AWT/Swing
    Réponses: 5
    Dernier message: 17/03/2006, 17h38

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