Java.security.accesscontrolexception: access dend ("java.net.socketpermission" "Localhost: 1099" "Слушай, разрешение")JAVA

Программисты JAVA общаются здесь
Anonymous
Java.security.accesscontrolexception: access dend ("java.net.socketpermission" "Localhost: 1099" "Слушай, разрешение")

Сообщение Anonymous »

Компания с реестрами RMI. разрешение на порт в файле java.policy.
порт используется 1099, какой порт реестра RMI по умолчанию. < /p>
Найдите ниже код < /p>
package com.aurionpro.reuters;

import com.aurionpro.reuters.service.UpdateCurrencyRates;
import java.io.IOException;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.util.Properties;

public final class RMIServiceClient {
private final String hostname;
private final int port;
private final String serviceName;
private UpdateCurrencyRates currencyRates;
private Registry registry = null;

public RMIServiceClient(String appPropFileName, String productName) {
Properties properties = new Properties();
ClassLoader loader = Thread.currentThread().getContextClassLoader();

try {
properties.load(loader.getResourceAsStream(appPropFileName));
} catch (IOException var6) {
var6.printStackTrace();
}

this.hostname = properties.getProperty("rmiclient." + productName + ".registry.host");
this.port = Integer.parseInt(properties.getProperty("rmiclient." + productName + ".registry.port"));
this.serviceName = properties.getProperty("rmiclient." + productName + ".registry.serviceName");
}

public UpdateCurrencyRates getCurrencyRatesService() throws RemoteException, NotBoundException {
SecurityManager securityManager = new SecurityManager();
System.setSecurityManager(securityManager);
this.registry = LocateRegistry.getRegistry(this.hostname, this.port);
this.currencyRates = (UpdateCurrencyRates)this.registry.lookup(this.serviceName);
return this.currencyRates;
}
}


Подробнее здесь: https://stackoverflow.com/questions/796 ... permission

Вернуться в «JAVA»