cadServer.java:53: unreported exception java.net.MalformedURLException; mus
Posted: Nov 8, 2002 10:18 AM
Advertisement
The informed solution for Daniel in the previous topic for me presented it was solved. Now it presents this same mistake in another line. cadServer.java:53: unreported exception java.net.MalformedURLException; must be caught or declared to be thrown Naming.rebind ("rmi://127.0.0.1:1099/rmiCadastro", x); ^ 1 error import java.rmi.server.*; import java.rmi.*; import java.sql.*; public class cadServer extends UnicastRemoteObject implements cadInterface { public String insRegistro(String rgm, String nome, String endereco, String cidade, String estado, String cep, String email) throws RemoteException { Connection con; Statement stmt; String url = "jdbc:odbc:Cadastro"; String ins = ("insert into tb_Alunos values ('"+rgm+"','"+nome+"','"+endereco+"','"+cidade+"','"+estado+"','"+cep+"','"+ema il+"')"); try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); } catch(java.lang.ClassNotFoundException e) { System.err.print("ClassNotFoundException:"); System.err.println(e.getMessage()); } try { con = DriverManager.getConnection(url,"",""); stmt = con.createStatement(); stmt.executeUpdate(ins); } catch(SQLException ex) { System.err.println("SQLException: " + ex.getMessage()); } String m = "Cadastro realizado com sucesso"; return(m); } public cadServer () throws RemoteException { super(); } public static void main (String a[]) { try { System.setSecurityManager(new RMISecurityManager()); cadServer x = new cadServer(); Naming.rebind ("rmi://127.0.0.1:1099/rmiCadastro", x); } catch (RemoteException re) { System.err.println("Remote Exception: " + re.getMessage()); } } }