Habe ein RMI Programm geschrieben, welches ich morgen in der Schule herzeigen muss, welches Daten aus einer Datenbank auslest und diese dann auf einem Client anzeigt.
Das Programm hat immer gut funktioniert ohne Probleme. Jedenfalls ist am Freitag mein Rechner eingegangen und wurde durch ein Leihgerät bis zur Reperatur ersetzt. Hab alles aufgesetzt und will nochmal schauen ob eh alles geht doch auf einmal bekomme ich diesen Fehler hier.
Der böse Code
Die Methode am Server
Das hier ist meine ServerKlasse
Das Programm hat immer gut funktioniert ohne Probleme. Jedenfalls ist am Freitag mein Rechner eingegangen und wurde durch ein Leihgerät bis zur Reperatur ersetzt. Hab alles aufgesetzt und will nochmal schauen ob eh alles geht doch auf einmal bekomme ich diesen Fehler hier.
Code:
java.rmi.UnmarshalException: Error unmarshaling return; nested exception is:
java.lang.ClassNotFoundException: org.postgresql.util.PSQLException (no security manager: RMI class loader disabled)
at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
at sun.rmi.server.UnicastRef.invoke(Unknown Source)
at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(Unknown Source)
at java.rmi.server.RemoteObjectInvocationHandler.invoke(Unknown Source)
at $Proxy0.getAllCountries(Unknown Source)
at datenbank.Dbzugriff.getAllCountries(Dbzugriff.java:274)
at gui.LoginAndRegistration.JButton_RegistrierenActionPerformed(LoginAndRegistration.java:210)
at gui.LoginAndRegistration.access$3(LoginAndRegistration.java:149)
at gui.LoginAndRegistration$5.actionPerformed(LoginAndRegistration.java:415)
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.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.postgresql.util.PSQLException (no security manager: RMI class loader disabled)
at sun.rmi.server.LoaderHandler.loadClass(Unknown Source)
at sun.rmi.server.LoaderHandler.loadClass(Unknown Source)
at java.rmi.server.RMIClassLoader$2.loadClass(Unknown Source)
at java.rmi.server.RMIClassLoader.loadClass(Unknown Source)
at sun.rmi.server.MarshalInputStream.resolveClass(Unknown Source)
at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
at java.io.ObjectInputStream.readClassDesc(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
... 34 more
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at java.util.ArrayList.addAll(Unknown Source)
at gui.LoginAndRegistration.JButton_RegistrierenActionPerformed(LoginAndRegistration.java:210)
at gui.LoginAndRegistration.access$3(LoginAndRegistration.java:149)
at gui.LoginAndRegistration$5.actionPerformed(LoginAndRegistration.java:415)
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.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)
Der böse Code
Java:
rmiserver = (RMIConnectable) Naming.lookup("rmi://localhost:4567/waren");
ArrayList<String> array = array.addAll(rmiserver.getAllCountries());
Java:
public ArrayList<String> getAllCountries() throws SQLException,
RemoteException {
ArrayList<String> array = new ArrayList<String>();
getConnection();
Statement sqlAnw = verbindung.createStatement();
ResultSet rs = sqlAnw.executeQuery("SELECT * FROM countries ORDER BY land ASC");
l.writeInfo("getCountries-------------------------------------");
while(rs.next())
{
array.add(rs.getString("land"));
}
l.writeText(array.toString());
l.writeInfo("END: getAllCountries-------------------------------------");
closeConnection();
return array;
}
Das hier ist meine ServerKlasse
Java:
package rmi;
import java.rmi.Naming;
import java.rmi.registry.LocateRegistry;
/**
* @author Vincenz Mössenböck
*
*/
public class Server {
/**
* @param args
*/
public static void main(String[] args)
{
try
{
//Remote Objekt erzeugen
LocateRegistry.createRegistry(4567);
RMI_Methoden methoden = new RMI_Methoden();
Naming.rebind("//localhost:4567/waren", methoden);
System.out.println("Konto aktiviert: ");
}
catch(Exception e)
{
e.printStackTrace();
}
}
}