• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

My GUI be affected by RMI???!!!

 
AutinHorse
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I define a 'DataAccess' interfce first,then use a local data access class and another RMI interface implements or extends it. In the 'main' method, choose to use local or RMI according to arguments, then cast it to DataAccess, then use it as parameter to initial GUI. GUI use JFrame and some JOptionPane to show message to user.
Now no problem for use the local data class, but when I use the RMI, the Frame window has a column at the bottom of the window, show 'Java applet window', all the JOptionPanes be shown by 'showConfirmDialog' are same, and all the JOptionPanes be shown by 'showMessageDialog' dispear.
The only different are four lines on the main method, to choose local or RMI, but why the windows be different.
The code are as follow (I delete the try-catch block):
public static void main( String[] args ) {
remote();
//local();
}
static void local() {
DataAccess data = new LocalData();
ClientGUI tm = new ClientGUI ( data );
tm.show();
}
static void remote() {
System.setSecurityManager( new RMISecurityManager() );
String url = "rmi://localhost:1099/";
ServerData c1 = (ServerData) Naming.lookup( url + "DataServer" );
DataAccess data = (DataAccess) c1;
ClientGUI tm = new ClientGUI ( data );
tm.show();
}
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe it has to do with RMISecurityManager and the policy file.
There are a few posts here that already address the solution to this problem. Try doing search on Applet. I just forgot the answer, otherwise I would type it here
Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic