עבור לתוכן
View in the app

A better way to browse. Learn more.

HWzone

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Java| בעיית גישה לשרת בשיטת RMI

Featured Replies

פורסם

שלום לכולם,

אני כותב ב-JAVA אפליקצייה פשוטה שמשתמשת ב-RMI להעברת מידע מהשרת לקליינט,

לצורך העניין השתמשתי בדוגמא קיימת שהעתקתי מהאינטרנט רק כדי לראות איך זה עובד וקבלתי את השגיאה :

access denied (java.net.SocketPermission 127.0.0.1:1099 connect,resolve)

הנה הקוד שרת שלי :


import java.rmi.Naming;
import java.rmi.RemoteException;
import java.rmi.RMISecurityManager;
import java.rmi.server.UnicastRemoteObject;
import java.rmi.registry.*;
import java.security.Permission;
import java.security.Security;

public class RmiServer extends UnicastRemoteObject
implements RmiServerIntf
{
public static final String MESSAGE = "Hello world";

public RmiServer() throws RemoteException {
}

public String getMessage() {
return MESSAGE;
}


public static void main(String args[])
{
System.out.println("RMI server started");

// Create and install a security manager
if (System.getSecurityManager() == null)
{
System.setSecurityManager(new RMISecurityManager());
System.out.println("Security manager installed.");
}
else
{
System.out.println("Security manager already exists.");
}

try
{ //special exception handler for registry creation
LocateRegistry.createRegistry(1099);
System.out.println("java RMI registry created.");
}
catch (RemoteException e)
{
//do nothing, error means registry already exists
System.out.println("java RMI registry already exists.");
}

try
{
//Instantiate RmiServer
RmiServer obj = new RmiServer();


// Bind this object instance to the name "RmiServer"
Naming.rebind("//localhost/RmiServer", obj);

System.out.println("PeerServer bound in registry");
}
catch (Exception e)
{
System.err.println("RMI server exception:" + e);
e.printStackTrace();
}
}

}

אשמח אם מישו בבקשה יעזור לי כי אני לא יודע מה לא נכון או מה אפשר לעשות כדי לתקן זאת,תודה רבה

פורסם

איך הרצת אותו? האם קישרת אותו לקובץ הפוליסה?

ארכיון

דיון זה הועבר לארכיון ולא ניתן להוסיף בו תגובות חדשות.

דיונים חדשים

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.