Ciao a tutti!
Stavo scrivendo un programma oggi (anzi da giorni) che deve invocare un metodo pubblicato su un web service (tramite Apache Tomcat ecc...). Anticipo che nn è la prima volta che lo faccio! Ma oggi andando ad eseguire il programma (ancora incompleto) mi è stata lanciata l'eccezione: RemoteException!![]()
Qualcuno sa dirmi da cosa può essere causata?
allego la classe che mi da l'eccezione...
import com.cloudgarden.layout.AnchorConstraint;
import com.cloudgarden.layout.AnchorLayout;
import com.mysql.jdbc.exceptions.MySQLIntegrityConstraint ViolationException;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
import javax.swing.WindowConstants;
import javax.xml.namespace.QName;
import javax.xml.rpc.ServiceException;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
public class Registrazione extends javax.swing.JFrame {
private JPanel Registrazione;
private JLabel NameLabel;
private JLabel CognomeLabel;
private JTextField Cognome;
private JTextField Indirizzo;
private JLabel IndEMLabel;
private JPasswordField NuovaPass;
private JLabel NuovaPassLab;
private JLabel IDLabel;
private JTextField UsernameR;
private JLabel NuovaUsernameLabel;
private JButton RegistrerLog;
private JTextField ID;
private JTextField Nome;
public Registrazione() {
initGUI();
}
private void initGUI() {
try {
setDefaultCloseOperation(WindowConstants.EXIT_ON_C LOSE);
setTitle("Registrazione nuovo Cliente");
{
Registrazione = new JPanel();
getContentPane().add(Registrazione, BorderLayout.CENTER);
AnchorLayout RegistrazioneLayout = new AnchorLayout();
Registrazione.setLayout(RegistrazioneLayout);
Registrazione.setPreferredSize(new java.awt.Dimension(497, 392));
}
{
NuovaPass = new JPasswordField();
Registrazione.add(NuovaPass, new AnchorConstraint(308, 890, 384, 579, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
NuovaPass.setPreferredSize(new java.awt.Dimension(154, 28));
NuovaPass.setText("");
}
{
NuovaPassLab = new JLabel();
Registrazione.add(NuovaPassLab, new AnchorConstraint(212, 777, 308, 579, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
NuovaPassLab.setText("Nuova Password");
NuovaPassLab.setPreferredSize(new java.awt.Dimension(98, 35));
}
{
NuovaUsernameLabel = new JLabel();
Registrazione.add(NuovaUsernameLabel, new AnchorConstraint(20, 777, 97, 579, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
NuovaUsernameLabel.setText("Nuova Username");
NuovaUsernameLabel.setPreferredSize(new java.awt.Dimension(98, 28));
}
{
UsernameR = new JTextField();
Registrazione.add(UsernameR, new AnchorConstraint(116, 890, 193, 579, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
UsernameR.setPreferredSize(new java.awt.Dimension(154, 28));
UsernameR.setText("max 11 caratteri");
}
{
RegistrerLog = new JButton();
Registrazione.add(RegistrerLog, new AnchorConstraint(787, 664, 864, 353, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
RegistrerLog.setText("Registra");
RegistrerLog.setPreferredSize(new java.awt.Dimension(154, 28));
RegistrerLog.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
String messaggio="";
try {
Call call = (Call) new Service().createCall();
call.setTargetEndpointAddress(new URL(
"http://localhost:8080/axis/services/"));
call.setOperationName(new QName(
"Richiamo","query"));
Object rispostaWS = call.invoke(new Object[]{Nome.getText(), Cognome.getText(),UsernameR.getText(),NuovaPass.ge tPassword().toString(),ID.getText(),Indirizzo.getT ext()});
int result = ( (Integer)rispostaWS ).intValue();
messaggio = "il Web service ha fornito il seguente risultato: "+ result;
if(result==0){
try { salvaSuFile(UsernameR.getText(),NuovaPass.getPassw ord().toString());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
HomePage hp=new HomePage();
}else{
JOptionPane.showMessageDialog(Registrazione, "Cambiare username!","ERRORE",JOptionPane.INFORMATION_MESSAG E);
}
} catch (MalformedURLException ex) {
messaggio = "errore: l'url non è esatta";
} catch (ServiceException ex) {
messaggio = "errore: la creazione della chiamata è fallita";
} catch (RemoteException ex) {
messaggio = "errore: l'invocazione del WS è fallita";
} finally {
System.out.println(messaggio);
}
}
});
}
{
IDLabel = new JLabel();
Registrazione.add(IDLabel, new AnchorConstraint(442, 367, 519, 43, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
IDLabel.setText("Codice fiscale");
IDLabel.setPreferredSize(new java.awt.Dimension(161, 28));
}
{
ID = new JTextField();
Registrazione.add(ID, new AnchorConstraint(538, 367, 615, 43, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
ID.setPreferredSize(new java.awt.Dimension(161, 28));
}
{
IndEMLabel = new JLabel();
Registrazione.add(IndEMLabel, new AnchorConstraint(442, 734, 519, 579, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
IndEMLabel.setText("Indirizzo E-Mail");
IndEMLabel.setPreferredSize(new java.awt.Dimension(77, 28));
}
{
Indirizzo = new JTextField();
Registrazione.add(Indirizzo, new AnchorConstraint(538, 960, 615, 579, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
Indirizzo.setPreferredSize(new java.awt.Dimension(189, 28));
}
{
Cognome = new JTextField();
Registrazione.add(Cognome, new AnchorConstraint(308, 325, 384, 43, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
Cognome.setPreferredSize(new java.awt.Dimension(140, 28));
}
{
CognomeLabel = new JLabel();
Registrazione.add(CognomeLabel, new AnchorConstraint(212, 198, 308, 43, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
CognomeLabel.setText("Cognome");
CognomeLabel.setPreferredSize(new java.awt.Dimension(77, 35));
}
{
NameLabel = new JLabel();
Registrazione.add(NameLabel, new AnchorConstraint(38, 226, 113, 43, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
NameLabel.setText("Nome");
NameLabel.setPreferredSize(new java.awt.Dimension(91, 28));
}
{
Nome = new JTextField();
Registrazione.add(Nome, new AnchorConstraint(116, 325, 193, 43, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
Nome.setPreferredSize(new java.awt.Dimension(140, 28));
}
pack();
this.setSize(504, 413);
} catch (Exception e) {
e.printStackTrace();
}
}
private void salvaSuFile(String u, String p)throws IOException {
PrintWriter pw=new PrintWriter(new FileWriter("src/registration.txt"));
String s=u +" "+p;
pw.println(s);
pw.close();
}
}