zut69
Messages postés354Date d'inscriptionlundi 26 juillet 2004StatutMembreDernière intervention26 juin 2012
-
9 juin 2008 à 19:16
zut69
Messages postés354Date d'inscriptionlundi 26 juillet 2004StatutMembreDernière intervention26 juin 2012
-
16 juin 2008 à 21:01
Bonsoir,
J'essaie d'envoyer des informations par POST en Java à un fichier php, j'ai écrit mon code, mais je ne trouve pas ce qui ne va pas, j'utilise la librairie HTTPClient d'Apache.
Voici l'erreur retournée par la console, suivie de ma source:
Exception in thread "AWT-EventQueue-1" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
at org.apache.commons.httpclient.HttpMethodBase.<clinit>(Unknown Source)
at cryptage.Applet_TM.actionPerformed(Applet_TM.java:61)
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.Component.dispatchEvent(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)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
... 26 more
public class Applet_TM extends JApplet implements ActionListener
{
JButton button1 = new JButton();
boolean successful=true;
JOptionPane jop = new JOptionPane();
public void init()
{
button1.setLabel("Parcourir...");
this.getContentPane().add(button1, BorderLayout.SOUTH);
button1.setBounds(20,200,98,30);
button1.addActionListener(this);
}
public void actionPerformed(ActionEvent ae)
{
if(ae.getSource().equals(button1))
{
String contenu = null;
String contenu_crypte = null;
String temp = null;
int i = 0; //nb de lignes
try
{
JFileChooser fileDialog = new JFileChooser();
int retour = fileDialog.showSaveDialog(this); // 1 si aucun fichier soumis, sinon 0
fileDialog.show( );
System.out.println(fileDialog.getSelectedFile());
FileReader fichier = new FileReader(fileDialog.getSelectedFile());
BufferedReader br = new BufferedReader(fichier);
temp = new String();
contenu = new String();
HttpClient client = new HttpClient();
client.executeMethod(methodePost);
//affiche la réponse du serveur
System.out.println(new String(methodePost.getResponseBody()));
}
catch(IOException e)
{
System.out.println("Erreur IOException!");
e.printStackTrace(); // affiche les infos sur l erreur
}
}
}
}
zut69
Messages postés354Date d'inscriptionlundi 26 juillet 2004StatutMembreDernière intervention26 juin 20121 13 juin 2008 à 19:16
Merci pour ta réponse,
J'ai esssayé, mais il me dit logging...jar is never used en warning, et meme en testant ça passe pas!
Une autre idée?
T'aurais msn si jamais? Parce que j'aurais vraiment besoin d'aide pour ça et ce serait plus simple.
Ou si t'as une autre idée...