Вход на сайт
Вопросик из области Web-Programmierung, Java
5645 просмотров
Перейти к просмотру всей ветки
в ответ MrSanders 04.09.15 22:43
Пардон, ни txt, ни Ворд-файлы тут почему-то не цепляются.
Как же его прицепить-то?
Ну, ладно, придется запостить так, не весь:
/**
* This classs initializes the RMI-Server.
*
* @author cirquent
* @version 1.86 31.07.2008
*/
public class StartServer
{
private static Properties c_argProperties = new Properties();
private final static String c_actualVersion = "9.5.0.1";
private static Main- - c_main- - = null;
// main routine for starting the rmi-server
public static void main(String[] args)
{
// LogConsole starts only if the parameter LogConsole is set to 1
// Set the LogConsoleX and LogConsoleY parameters for a specific position
// of the console on your screen
if ((System.getProperty("LogConsole")) != null && System.getProperty("LogConsole").equals("1"))
{
int iLogConsoleX=0;
int iLogConsoleY=0;
if (System.getProperty("LogConsoleX")!=null) iLogConsoleX=Integer.parseInt(System.getProperty("LogConsoleX"));
if (System.getProperty("LogConsoleY")!=null) iLogConsoleY=Integer.parseInt(System.getProperty("LogConsoleY"));
new LogConsole("Server",iLogConsoleX,iLogConsoleY);
}
String strHostName = "";
int iRMIPort = 1099; // default port of the rmiregistry
String strProduct = null;
String strInstanceNumber = null;
String temp;
// use DCC specific copy configuration
CopyConfiguration.loadConfiguration();
//In the Moment, we set no Security! It remains to check, if you can do it with policy-files
System.setSecurityManager(new RMISecurityManager());
// we have to set a virtual request name for the following requests
// (this is necessary for the current concept of reentrant database
// access)
Thread.currentThread().setName("StartServer");
// define that we are located on the server...
GeneralServerAdapter_RMI.setLocatedOnServer(true);
// show threadname in trace output on server side
Trace.setShowThreadName(true);
//parse the input parameters of the main-program
System.out.println ("Server " + c_actualVersion);
try
{
parseInputArgs (args);
}
catch (Exception e)
{
System.out.println ("Error in the input parameters");
System.out.println("Usage: java [vmargs] [package].StartServer -p <programname> -n <instancenr>");
System.out.println("The rmiserver-process was not started");
System.exit(-1);
}
//Show the System and Program Properties!
if (System.getProperty("properties.show") != null)
printProperties();
//parse the parameters of the vm
try
{
//product + instancenumber
strProduct = System.getProperty("product");
Assertion.verify(strProduct != null);
strInstanceNumber = System.getProperty("instance");
Assertion.verify(strInstanceNumber != null);
//set a prefix to the rmi-servername to distinguish different Servers
temp = strProduct + "_" + strInstanceNumber;
GeneralServer.setServerNamePrefix(temp + ".");
// we can set it globally because any instance of this adapter
// has to use this prefix...
GeneralServerAdapter.setGlobalServerNamePrefix(temp + ".");
Trace.setPrefix(temp);
// trace on/off?
if (System.getProperty("Trace") != null)
Trace.setTraceLevel(Integer.parseInt(System.getProperty("Trace")));
// 1. database parameters
// (the flag on calls to DBAccess-class decide for local (true) or
// central (false) database)
// a) local database
if (System.getProperty("db.server") != null)
DBAccess.setDBServer(System.getProperty("db.server"), true);
if (System.getProperty("db.database") != null)
{
temp = System.getProperty("db.database");
if (temp != null)
DBAccess.setDBName(temp, true);
}
if (System.getProperty("db.user") != null)
DBAccess.setDBUser(System.getProperty("db.user"), true);
if (System.getProperty("db.password") != null)
DBAccess.setDBPassword(System.getProperty("db.password"), true);
if (System.getProperty("db.url_param") != null) {
DBAccess.setDBAddParamAtUrl(System.getProperty("db.url_param"));
}
if (System.getProperty("db.jdbcurl") != null)
DBAccess.setDBURL(System.getProperty("db.jdbcurl"), true);
if (System.getProperty("db.host") != null)
DBAccess.setDBHost(System.getProperty("db.host"), true);
if (System.getProperty("db.port") != null)
DBAccess.setDBPort(System.getProperty("db.port"), true);
// b) central database
if (System.getProperty("dbc.server") != null)
DBAccess.setDBServer(System.getProperty("dbc.server"), false);
if (System.getProperty("dbc.database") != null)
{
temp = System.getProperty("dbc.database");
if (temp != null)
DBAccess.setDBName(temp, false);
}
if (System.getProperty("dbc.user") != null)
DBAccess.setDBUser(System.getProperty("dbc.user"), false);
if (System.getProperty("dbc.password") != null)
DBAccess.setDBPassword(System.getProperty("dbc.password"), false);
if (System.getProperty("dbc.jdbcurl") != null)
DBAccess.setDBURL(System.getProperty("dbc.jdbcurl"), false);
if (System.getProperty("dbc.host") != null)
DBAccess.setDBHost(System.getProperty("dbc.host"), false);
if (System.getProperty("dbc.port") != null)
DBAccess.setDBPort(System.getProperty("dbc.port"), false);
// 2. RMI-Server-Parameter
if (System.getProperty("rmi.host") != null)
{
temp = System.getProperty("rmi.host");
if (temp.indexOf(":") > 0)
{
//hostname contains rmi-port
strHostName = temp.substring(0, temp.indexOf(":"));
iRMIPort = Integer.parseInt(temp.substring(temp.indexOf(":")+1, temp.length()));
}
else
{
strHostName = temp;
iRMIPort = 1099; //default
}
//set the full hostname to the server and serverAdapter
GeneralServer.setHostName(strHostName);
GeneralServer.setRMIPort(iRMIPort);
GeneralServerAdapter.setHostName(strHostName);
GeneralServerAdapter.setRMIPort(iRMIPort);
}
//is a different path for NdCrypt set ? Position inc. filename
if (System.getProperty("CryptPath") !=null)
{
setCryptFilePath(System.getProperty("CryptPath"));
}
// activate security?
// this should be a unknown flag for the clients
if (System.getProperty("local.security") != null)
{
boolean fOn = (!System.getProperty("local.security").equals("0"));
Trace.traceInfo("Security enabled: " + fOn);
GeneralServer.setSecurityEnabled(fOn);
}
else
{
Trace.traceInfo("Security enabled: " + true);
GeneralServer.setSecurityEnabled(true);
}
if (GeneralServer.isSecurityEnabled())
{
// If security on, get Password from NdCrypt and inform DBAccess-class
// (password for local and central database)
DBAccess.setDBPassword(SecuritySupport.getPasswordProductDB(), true);
//DBAccess.setDBPassword("RevisionssicherheitICM6#", true);
// we only need the password for the central database in case it is
// different from the local database
if (!DBAccess.isLocalAndCentralDBIdentical())
DBAccess.setDBPassword(SecuritySupport.getPasswordCentralDB(), false);
}
// set a special time for automatic logoff ?
if (System.getProperty("logoffTime") != null)
{
AuthenticationServer.setAccessTimeExpiration(System.getProperty("logoffTime"));
}
String outFile = null;
if( (outFile = System.getProperty("sql.outfile")) != null)
{
try{
Trace.traceInfo("SQL commands are written to file: \'" + outFile + "\'");
if ( ! FileLogger.initLogFile( outFile, FileLogger.SQL_LOG ) )
{
throw new Exception ();
}
}
catch (Exception e)
{
System.out.println ("Error in opening sql outfile");
System.out.println("The rmiserver-process was not started");
System.exit(-1);
}
}
outFile = null;
if( (outFile = System.getProperty("sysmsg.outfile")) != null)
{
try{
Trace.traceInfo("System messages are written to file: \'" + outFile + "\'");
if ( ! FileLogger.initLogFile( outFile, FileLogger.SYSMSG_LOG ) )
{
throw new Exception ();
}
}
catch (Exception e)
{
System.out.println ("Error in opening system messages outfile");
System.out.println("The rmiserver-process was not started");
System.exit(-1);
}
}
// show automatic logoff time
AuthenticationServer.showAccessTimeExpiration();
// handle special parameters to modify server behaviour for performance
// (caching of result sets)
if (System.getProperty("perf.blocksize") != null)
DBAccess.setTransferBlockSize(Integer.parseInt(System.getProperty("perf.blocksize")));
if (System.getProperty("perf.expirationtime") != null)
DBAccess.setCacheEntryExpirationTime(Integer.parseInt(System.getProperty("perf.expirationtime")));
if (System.getProperty("perf.maxcachesize") != null)
DBAccess.setMaxCacheSize(Integer.parseInt(System.getProperty("perf.maxcachesize")));
if (System.getProperty("perf.maxresultsize") != null)
DBAccess.setMaxResultSetSize(Integer.parseInt(System.getProperty("perf.maxresultsize")));
DBAccess.showPerformanceParams();
// special parameter to set the maximum transfer blocksize for rmi-communication
if (System.getProperty("comm.transferblocksize") != null)
ndPersistenceServer.setMaxTransferBlockSize(Integer.parseInt(System.getProperty("comm.transferblocksize")));
if (System.getProperty("comm.transfercompression") != null)
ndPersistenceServer.setUseCompressionForTransfer(Integer.parseInt(System.getProperty("comm.transfercompression")) != 0);
if (System.getProperty("shell.timezone") != null)
CurrentDateSupport.setTimeSupport(System.getProperty("shell.timezone"));
Trace.traceInfo("set param -Dshell.timezone: " + CurrentDateSupport.getTimeSupport());
try
{
Registry reg = null;
// try to get a registry from given host
if (strHostName.length() > 0)
{
try
{
Trace.traceInfo("getRegistry: " + strHostName + " : " + iRMIPort);
reg = LocateRegistry.getRegistry(strHostName, iRMIPort);
// we have to contact the registry to check if it's really available
Assertion.verify(reg != null);
reg.list();
}
catch (Throwable e)
{
reg = null;
}
}
// try to get the registry on the current host
if (reg == null)
{
Trace.traceInfo("getRegistry : "+iRMIPort);
reg = LocateRegistry.getRegistry(iRMIPort);
// we have to contact the registry to check if it's really available
Assertion.verify(reg != null);
reg.list();
}
}
catch (Throwable e)
{
// if no registry was found - try to create one
Trace.traceInfo("createRegistry");
LocateRegistry.createRegistry(iRMIPort);
}
General- -.setServerForClass(ndDate.class, new ndDateServerAdapter_RMI());
General- -.setServerForClass(EventLog.class, new EventLogServerAdapter_RMI());
General- -.setServerForClass(dccEventLog.class, new dccEventLogServerAdapter_RMI());
General- -.setServerForClass(History.class, new HistoryServerAdapter_RMI());
General- -.setServerForClass(BackendAccess.class, new BackendAccessServerAdapter_RMI());
General- -.setServerForClass(Log.class, new LogServerAdapter_RMI());
General- -.setServerForClass(Currency.class, new CurrencyServerAdapter_RMI());
General- -.setServerForClass(DataManager.class, new DataManagerServerAdapter_RMI());
General- -.setServerForClass(Customer.class, new CustomerServerAdapter_RMI());
General- -.setServerForClass(DiAccount.class, new DiAccountServerAdapter_RMI());
General- -.setServerForClass(Settlement.class, new SettlementServerAdapter_RMI());
General- -.setServerForClass(DreCatiSettlement.class, new DreCatiSettlementServerAdapter_RMI());
General- -.setServerForClass(DreCatiCurrencyManager.class, new DreCatiCurrencyManagerServerAdapter_RMI());
General- -.setServerForClass(DreCatiAccount.class, new DreCatiAccountServerAdapter_RMI());
General- -.setServerForClass(DreCatiTrancheControl.class, new DreCatiTrancheControlServerAdapter_RMI());
General- -.setServerForClass(DccAccount.class, new DccAccountServerAdapter_RMI());
General- -.setServerForClass(User.class, new UserServerAdapter_RMI());
General- -.setServerForClass(LocalUser.class, new UserServerAdapter_RMI());
General- -.setServerForClass(Message.class, new MessageServerAdapter_RMI());
General- -.setServerForClass(ndMessage.class, new ndMessageServerAdapter_RMI());
General- -.setServerForClass(Authentication.class, new AuthenticationServerAdapter_RMI());
General- -.setServerForClass(MsgAccess.class, new MsgAccessServerAdapter_RMI());
General- -.setServerForClass(Program.class, new ProgramServerAdapter_RMI());
General- -.setServerForClass(ndProcess- -.class, new ndProcessServerAdapter_RMI());
General- -.setServerForClass(InRoutingConfig.class, new InRoutingConfigServerAdapter_RMI());
General- -.setServerForClass(Queue.class, new QueueServerAdapter_RMI());
General- -.setServerForClass(ndTargetApplication.class, new ndTargetApplicationServerAdapter_RMI());
General- -.setServerForClass(MessagePrefix.class, new MessagePrefixServerAdapter_RMI());
General- -.setServerForClass(Language.class, new LanguageServerAdapter_RMI());
General- -.setServerForClass(ndMandant.class, new MandantServerAdapter_RMI());
General- -.setServerForClass(Mandant.class, new MandantServerAdapter_RMI());
General- -.setServerForClass(UserGroup.class, new UserGroupServerAdapter_RMI());
General- -.setServerForClass(TextResourceBundle.class, new TextHandlerServerAdapter_RMI());
General- -.setServerForClass(Holiday.class, new HolidayServerAdapter_RMI());
General- -.setServerForClass(ndAcknowledgement.class, new AcknowledgementServerAdapter_RMI());
General- -.setServerForClass(InvalidPassword.class, new InvalidPasswordServerAdapter_RMI());
General- -.setServerForClass(SystemParameter.class, new SystemParameterServerAdapter_RMI());
General- -.setServerForClass(ApplParameter.class, new ApplParameterServerAdapter_RMI());
General- -.setServerForClass(ClientApplParameter.class, new ClientApplParameterServerAdapter_RMI());
General- -.setServerForClass(ClientBackendParameter.class, new ClientBackendParameterServerAdapter_RMI());
General- -.setServerForClass(Branch.class, new BranchServerAdapter_RMI());
General- -.setServerForClass(TextHandler.class, new TextHandlerServerAdapter_RMI());
General- -.setServerForClass(ConcHistory.class, new ConcHistoryServerAdapter_RMI());
General- -.setServerForClass(Country.class, new CountryServerAdapter_RMI());
General- -.setServerForClass(SysRouteDelete.class, new SysRouteDeleteServerAdapter_RMI());
General- -.setServerForClass(Statistics.class, new StatisticsServerAdapter_RMI());
General- -.setServerForClass(Department.class, new DepartmentServerAdapter_RMI());
General- -.setServerForClass(OutsourcingControl.class, new OutsourcingControlServerAdapter_RMI());
General- -.setServerForClass(Pricing.class, new PricingServerAdapter_RMI());
General- -.setServerForClass(AccountLength.class, new AccountLengthServerAdapter_RMI());
General- -.setServerForClass(ReorganisationDB.class, new ReorganisationDBServerAdapter_RMI());
General- -.setServerForClass(IntdualcAccount.class, new IntdualcAccountServerAdapter_RMI());
General- -.setServerForClass(IntdualcSettlement.class, new IntdualcSettlementServerAdapter_RMI());
General- -.setServerForClass(ndPricingRemittance.class, new ndPricingRemittanceServerAdapter_RMI());
General- -.setServerForClass(DiSettlement.class, new DiSettlementServerAdapter_RMI());
General- -.setServerForClass(OrgaDb.class, new OrgaDbServerAdapter_RMI());
// which servers are to start?
boolean fStartServerGrp1 = true;
boolean fStartServerGrp2 = true;
boolean fStartServerGrp3 = true;
boolean fStartServerGrp4 = true;
boolean fStartServerGrp5 = true;
// check whether args are set
if (args.length > 0)
{
String strArg = args[0];
if (strArg.equals("1"))
{
fStartServerGrp1 = true;
fStartServerGrp2 = false;
fStartServerGrp3 = false;
fStartServerGrp4 = false;
fStartServerGrp5 = false;
}
if (strArg.equals("2"))
{
fStartServerGrp1 = false;
fStartServerGrp2 = true;
fStartServerGrp3 = false;
fStartServerGrp4 = false;
fStartServerGrp5 = false;
}
if (strArg.equals("3"))
{
fStartServerGrp1 = false;
fStartServerGrp2 = false;
fStartServerGrp3 = true;
fStartServerGrp4 = false;
fStartServerGrp5 = false;
}
if (strArg.equals("4"))
{
fStartServerGrp1 = false;
fStartServerGrp2 = false;
fStartServerGrp3 = false;
fStartServerGrp4 = true;
fStartServerGrp5 = false;
}
if (strArg.equals("5"))
{
fStartServerGrp1 = false;
fStartServerGrp2 = false;
fStartServerGrp3 = false;
fStartServerGrp4 = false;
fStartServerGrp5 = true;
}
}
// Supply Server with client personality of data manager in case
// they have to use it
DataManager dm = new DataManager();
GeneralServer.setDataManager(dm);
GeneralData- -.setDataManager(dm);
// start the servers
//The AuthenticationSever has to be started first because of security (trust-id)
// This is the first server to bind to the registry. But unfortunately
// in some cases when this process created the registry the bind gets a timeout.
// So we try to do this first bind several times before we give up...
boolean fStarted = false;
int iCount = 0;
while (!fStarted)
{
try
{
iCount++;
new AuthenticationServer(true);
fStarted = true;
}
catch (Throwable e)
{
Trace.traceException(e);
// no try anymore
if (iCount >= 10)
throw e;
}
}
//first the DataManager to can check the programm version
new DataManagerServer();
//Cache the current productinstance in the datamanager!
ndProductInstanceData productInstance =
getProductInstance (dm, strProduct, Integer.parseInt(strInstanceNumber));
//check the current version
if (productInstance.getVersion() != null)
{
if (!productInstance.getVersion().equals(c_actualVersion))
{
Trace.traceError("Invalid version!");
Trace.traceError("Actual version: " + c_actualVersion);
Trace.traceError("Needed version: " + productInstance.getVersion());
Trace.traceError("The rmi-process was stopped");
System.exit(-1);
}
}
else
{
Trace.traceError("No version check (no version set in DB)");
}
// do it in groups because of problems with AIX
if (fStartServerGrp1)
{
new ndDateServer();
new MessageServer();
new ndMessageServer();
new LogServer(true);
new HistoryServer(true);
new EventLogServer(true);
new dccEventLogServer(true);
new UserServer(true);
new BackendAccessServer(true);
BackendAccessServer.setMessageClassName("de.entory.dcc.messagedomain.Message");
}
if (fStartServerGrp2)
{
new CustomerServer();
new DepartmentServer(true);
new DccAccountServer ();
new DiAccountServer();
new DiSettlementServer();
new SettlementServer();
new DreCatiSettlementServer();
new DreCatiCurrencyManagerServer();
new DreCatiAccountServer();
new IntdualcAccountServer();
new IntdualcSettlementServer();
new DreCatiTrancheControlServer();
new CurrencyServer ();
new TextHandlerServer();
new ReconciliationServer(true);
new MessageProcessingServer(true);
new MsgAccessServer(true);
new OrgaDbServer();
}
if (fStartServerGrp3)
{
new ProgramServer(true);
new ndProcessServer();
new InRoutingConfigServer(true);
new QueueServer(true);
new ndTargetApplicationServer(true);
new MessagePrefixServer(true);
new BranchServer();
new ReorganisationDBServer();
}
if (fStartServerGrp4)
{
new LanguageServer();
new MandantServer();
new UserGroupServer();
new HolidayServer();
new AcknowledgementServer();
new InvalidPasswordServer();
new SystemParameterServer(true);
new AccountLengthServer();
}
if (fStartServerGrp5)
{
new ApplParameterServer(true);
new ClientApplParameterServer(true);
new ClientBackendParameterServer(true);
new ConcHistoryServer ();
new CountryServer (true);
new SysRouteDeleteServer ();
new StatisticsServer ();
new OutsourcingControlServer ();
new ndPricingRemittanceServer();
new PricingServer();
}
// make the default mandant available to the DBAccess-class
ndMandantData data = dm.getDefaultMandant();
if (data != null)
DBAccess.setDefaultMandantId(data.getId());
else
DBAccess.setDefaultMandantId(null);
// now we have to inform the server that its now acting in a multi thread
// environment
ndPersistenceServer.setMultiThreadSupport(true);
//last, we must save our pid in the table process, to give the master
//the chance, to start us in case of confusion!
if ((c_argProperties.get("p") != null) && (c_argProperties.get("n") != null))
{
String strPnr = (String)c_argProperties.get("p");
String strInr = (String)c_argProperties.get("n");
writePidToProcess (strPnr, Integer.parseInt(strInr));
}
else
Trace.traceError("No actual pid was set (the rmi-server must be started with arguments!)");
// now prepare the meta data if requested
//Writing metadata should occur after writing the pid, because this
// action runs a couple of time, and the master want not wait so long!
if ((System.getProperty("db.md_cacheonstartup") == null) ||
!(System.getProperty("db.md_cacheonstartup").equals("0")))
prepareMetaData ();
}
catch (RemoteException e)
{
Throwable ex = e.detail;
ex.printStackTrace();
Trace.traceError("Fatal error: the rmi-serverprocess was stopped!");
System.exit(-1);
}
catch (Throwable e)
{
e.printStackTrace();
Trace.traceError("Fatal error: the rmi-serverprocess was stopped!");
System.exit(-1);
}
}
private static ndProductInstanceData getProductInstance (DataManager dm, String product, int instance) throws Exception
{
ndProductInstanceData searchData = new ndProductInstanceData();
searchData.setInstanceNumber(instance);
searchData.setProduct(product);
return (dm.getProductInstance (searchData));
}
private static void setCryptFilePath(String strPath)
{
SecuritySupport.setPathNdCrypt(strPath);
}
private static void writePidToProcess (String programName, int instNr)
{
int pid = getPid();
if (pid == -1)
{
Trace.traceError("Error reading PID from file " + getPidFileName());
Trace.traceError("The Table process was not updated!");
}
else
{
try
{
//Get the programNr for the programname from table program
ProgramSearchData prgramSearch = new ProgramSearchData ();
prgramSearch.setName(programName);
prgramSearch.setOnlyValidProgram(true);
Vector<?> v = Program.search(prgramSearch);
Assertion.verify(v.size() == 1);
int programNr = Integer.parseInt(((ProgramData)v.firstElement()).getId());
//Update process
ndProcessData data = new ndProcessData();
data.setActualPid(new Integer (pid));
data.setProgram(new Integer (programNr));
data.setInstanceNr(new Integer (instNr));
ndProcess- -.setActualPid(data);
Trace.traceInfo("The actual pid was set");
}
catch (GeneralException e)
{
Trace.traceError("The actual pid couldn't be updated!");
}
}
}
private static int getPid ()
{
int pid = -1;
Как же его прицепить-то?
Ну, ладно, придется запостить так, не весь:
/**
* This classs initializes the RMI-Server.
*
* @author cirquent
* @version 1.86 31.07.2008
*/
public class StartServer
{
private static Properties c_argProperties = new Properties();
private final static String c_actualVersion = "9.5.0.1";
private static Main- - c_main- - = null;
// main routine for starting the rmi-server
public static void main(String[] args)
{
// LogConsole starts only if the parameter LogConsole is set to 1
// Set the LogConsoleX and LogConsoleY parameters for a specific position
// of the console on your screen
if ((System.getProperty("LogConsole")) != null && System.getProperty("LogConsole").equals("1"))
{
int iLogConsoleX=0;
int iLogConsoleY=0;
if (System.getProperty("LogConsoleX")!=null) iLogConsoleX=Integer.parseInt(System.getProperty("LogConsoleX"));
if (System.getProperty("LogConsoleY")!=null) iLogConsoleY=Integer.parseInt(System.getProperty("LogConsoleY"));
new LogConsole("Server",iLogConsoleX,iLogConsoleY);
}
String strHostName = "";
int iRMIPort = 1099; // default port of the rmiregistry
String strProduct = null;
String strInstanceNumber = null;
String temp;
// use DCC specific copy configuration
CopyConfiguration.loadConfiguration();
//In the Moment, we set no Security! It remains to check, if you can do it with policy-files
System.setSecurityManager(new RMISecurityManager());
// we have to set a virtual request name for the following requests
// (this is necessary for the current concept of reentrant database
// access)
Thread.currentThread().setName("StartServer");
// define that we are located on the server...
GeneralServerAdapter_RMI.setLocatedOnServer(true);
// show threadname in trace output on server side
Trace.setShowThreadName(true);
//parse the input parameters of the main-program
System.out.println ("Server " + c_actualVersion);
try
{
parseInputArgs (args);
}
catch (Exception e)
{
System.out.println ("Error in the input parameters");
System.out.println("Usage: java [vmargs] [package].StartServer -p <programname> -n <instancenr>");
System.out.println("The rmiserver-process was not started");
System.exit(-1);
}
//Show the System and Program Properties!
if (System.getProperty("properties.show") != null)
printProperties();
//parse the parameters of the vm
try
{
//product + instancenumber
strProduct = System.getProperty("product");
Assertion.verify(strProduct != null);
strInstanceNumber = System.getProperty("instance");
Assertion.verify(strInstanceNumber != null);
//set a prefix to the rmi-servername to distinguish different Servers
temp = strProduct + "_" + strInstanceNumber;
GeneralServer.setServerNamePrefix(temp + ".");
// we can set it globally because any instance of this adapter
// has to use this prefix...
GeneralServerAdapter.setGlobalServerNamePrefix(temp + ".");
Trace.setPrefix(temp);
// trace on/off?
if (System.getProperty("Trace") != null)
Trace.setTraceLevel(Integer.parseInt(System.getProperty("Trace")));
// 1. database parameters
// (the flag on calls to DBAccess-class decide for local (true) or
// central (false) database)
// a) local database
if (System.getProperty("db.server") != null)
DBAccess.setDBServer(System.getProperty("db.server"), true);
if (System.getProperty("db.database") != null)
{
temp = System.getProperty("db.database");
if (temp != null)
DBAccess.setDBName(temp, true);
}
if (System.getProperty("db.user") != null)
DBAccess.setDBUser(System.getProperty("db.user"), true);
if (System.getProperty("db.password") != null)
DBAccess.setDBPassword(System.getProperty("db.password"), true);
if (System.getProperty("db.url_param") != null) {
DBAccess.setDBAddParamAtUrl(System.getProperty("db.url_param"));
}
if (System.getProperty("db.jdbcurl") != null)
DBAccess.setDBURL(System.getProperty("db.jdbcurl"), true);
if (System.getProperty("db.host") != null)
DBAccess.setDBHost(System.getProperty("db.host"), true);
if (System.getProperty("db.port") != null)
DBAccess.setDBPort(System.getProperty("db.port"), true);
// b) central database
if (System.getProperty("dbc.server") != null)
DBAccess.setDBServer(System.getProperty("dbc.server"), false);
if (System.getProperty("dbc.database") != null)
{
temp = System.getProperty("dbc.database");
if (temp != null)
DBAccess.setDBName(temp, false);
}
if (System.getProperty("dbc.user") != null)
DBAccess.setDBUser(System.getProperty("dbc.user"), false);
if (System.getProperty("dbc.password") != null)
DBAccess.setDBPassword(System.getProperty("dbc.password"), false);
if (System.getProperty("dbc.jdbcurl") != null)
DBAccess.setDBURL(System.getProperty("dbc.jdbcurl"), false);
if (System.getProperty("dbc.host") != null)
DBAccess.setDBHost(System.getProperty("dbc.host"), false);
if (System.getProperty("dbc.port") != null)
DBAccess.setDBPort(System.getProperty("dbc.port"), false);
// 2. RMI-Server-Parameter
if (System.getProperty("rmi.host") != null)
{
temp = System.getProperty("rmi.host");
if (temp.indexOf(":") > 0)
{
//hostname contains rmi-port
strHostName = temp.substring(0, temp.indexOf(":"));
iRMIPort = Integer.parseInt(temp.substring(temp.indexOf(":")+1, temp.length()));
}
else
{
strHostName = temp;
iRMIPort = 1099; //default
}
//set the full hostname to the server and serverAdapter
GeneralServer.setHostName(strHostName);
GeneralServer.setRMIPort(iRMIPort);
GeneralServerAdapter.setHostName(strHostName);
GeneralServerAdapter.setRMIPort(iRMIPort);
}
//is a different path for NdCrypt set ? Position inc. filename
if (System.getProperty("CryptPath") !=null)
{
setCryptFilePath(System.getProperty("CryptPath"));
}
// activate security?
// this should be a unknown flag for the clients
if (System.getProperty("local.security") != null)
{
boolean fOn = (!System.getProperty("local.security").equals("0"));
Trace.traceInfo("Security enabled: " + fOn);
GeneralServer.setSecurityEnabled(fOn);
}
else
{
Trace.traceInfo("Security enabled: " + true);
GeneralServer.setSecurityEnabled(true);
}
if (GeneralServer.isSecurityEnabled())
{
// If security on, get Password from NdCrypt and inform DBAccess-class
// (password for local and central database)
DBAccess.setDBPassword(SecuritySupport.getPasswordProductDB(), true);
//DBAccess.setDBPassword("RevisionssicherheitICM6#", true);
// we only need the password for the central database in case it is
// different from the local database
if (!DBAccess.isLocalAndCentralDBIdentical())
DBAccess.setDBPassword(SecuritySupport.getPasswordCentralDB(), false);
}
// set a special time for automatic logoff ?
if (System.getProperty("logoffTime") != null)
{
AuthenticationServer.setAccessTimeExpiration(System.getProperty("logoffTime"));
}
String outFile = null;
if( (outFile = System.getProperty("sql.outfile")) != null)
{
try{
Trace.traceInfo("SQL commands are written to file: \'" + outFile + "\'");
if ( ! FileLogger.initLogFile( outFile, FileLogger.SQL_LOG ) )
{
throw new Exception ();
}
}
catch (Exception e)
{
System.out.println ("Error in opening sql outfile");
System.out.println("The rmiserver-process was not started");
System.exit(-1);
}
}
outFile = null;
if( (outFile = System.getProperty("sysmsg.outfile")) != null)
{
try{
Trace.traceInfo("System messages are written to file: \'" + outFile + "\'");
if ( ! FileLogger.initLogFile( outFile, FileLogger.SYSMSG_LOG ) )
{
throw new Exception ();
}
}
catch (Exception e)
{
System.out.println ("Error in opening system messages outfile");
System.out.println("The rmiserver-process was not started");
System.exit(-1);
}
}
// show automatic logoff time
AuthenticationServer.showAccessTimeExpiration();
// handle special parameters to modify server behaviour for performance
// (caching of result sets)
if (System.getProperty("perf.blocksize") != null)
DBAccess.setTransferBlockSize(Integer.parseInt(System.getProperty("perf.blocksize")));
if (System.getProperty("perf.expirationtime") != null)
DBAccess.setCacheEntryExpirationTime(Integer.parseInt(System.getProperty("perf.expirationtime")));
if (System.getProperty("perf.maxcachesize") != null)
DBAccess.setMaxCacheSize(Integer.parseInt(System.getProperty("perf.maxcachesize")));
if (System.getProperty("perf.maxresultsize") != null)
DBAccess.setMaxResultSetSize(Integer.parseInt(System.getProperty("perf.maxresultsize")));
DBAccess.showPerformanceParams();
// special parameter to set the maximum transfer blocksize for rmi-communication
if (System.getProperty("comm.transferblocksize") != null)
ndPersistenceServer.setMaxTransferBlockSize(Integer.parseInt(System.getProperty("comm.transferblocksize")));
if (System.getProperty("comm.transfercompression") != null)
ndPersistenceServer.setUseCompressionForTransfer(Integer.parseInt(System.getProperty("comm.transfercompression")) != 0);
if (System.getProperty("shell.timezone") != null)
CurrentDateSupport.setTimeSupport(System.getProperty("shell.timezone"));
Trace.traceInfo("set param -Dshell.timezone: " + CurrentDateSupport.getTimeSupport());
try
{
Registry reg = null;
// try to get a registry from given host
if (strHostName.length() > 0)
{
try
{
Trace.traceInfo("getRegistry: " + strHostName + " : " + iRMIPort);
reg = LocateRegistry.getRegistry(strHostName, iRMIPort);
// we have to contact the registry to check if it's really available
Assertion.verify(reg != null);
reg.list();
}
catch (Throwable e)
{
reg = null;
}
}
// try to get the registry on the current host
if (reg == null)
{
Trace.traceInfo("getRegistry : "+iRMIPort);
reg = LocateRegistry.getRegistry(iRMIPort);
// we have to contact the registry to check if it's really available
Assertion.verify(reg != null);
reg.list();
}
}
catch (Throwable e)
{
// if no registry was found - try to create one
Trace.traceInfo("createRegistry");
LocateRegistry.createRegistry(iRMIPort);
}
General- -.setServerForClass(ndDate.class, new ndDateServerAdapter_RMI());
General- -.setServerForClass(EventLog.class, new EventLogServerAdapter_RMI());
General- -.setServerForClass(dccEventLog.class, new dccEventLogServerAdapter_RMI());
General- -.setServerForClass(History.class, new HistoryServerAdapter_RMI());
General- -.setServerForClass(BackendAccess.class, new BackendAccessServerAdapter_RMI());
General- -.setServerForClass(Log.class, new LogServerAdapter_RMI());
General- -.setServerForClass(Currency.class, new CurrencyServerAdapter_RMI());
General- -.setServerForClass(DataManager.class, new DataManagerServerAdapter_RMI());
General- -.setServerForClass(Customer.class, new CustomerServerAdapter_RMI());
General- -.setServerForClass(DiAccount.class, new DiAccountServerAdapter_RMI());
General- -.setServerForClass(Settlement.class, new SettlementServerAdapter_RMI());
General- -.setServerForClass(DreCatiSettlement.class, new DreCatiSettlementServerAdapter_RMI());
General- -.setServerForClass(DreCatiCurrencyManager.class, new DreCatiCurrencyManagerServerAdapter_RMI());
General- -.setServerForClass(DreCatiAccount.class, new DreCatiAccountServerAdapter_RMI());
General- -.setServerForClass(DreCatiTrancheControl.class, new DreCatiTrancheControlServerAdapter_RMI());
General- -.setServerForClass(DccAccount.class, new DccAccountServerAdapter_RMI());
General- -.setServerForClass(User.class, new UserServerAdapter_RMI());
General- -.setServerForClass(LocalUser.class, new UserServerAdapter_RMI());
General- -.setServerForClass(Message.class, new MessageServerAdapter_RMI());
General- -.setServerForClass(ndMessage.class, new ndMessageServerAdapter_RMI());
General- -.setServerForClass(Authentication.class, new AuthenticationServerAdapter_RMI());
General- -.setServerForClass(MsgAccess.class, new MsgAccessServerAdapter_RMI());
General- -.setServerForClass(Program.class, new ProgramServerAdapter_RMI());
General- -.setServerForClass(ndProcess- -.class, new ndProcessServerAdapter_RMI());
General- -.setServerForClass(InRoutingConfig.class, new InRoutingConfigServerAdapter_RMI());
General- -.setServerForClass(Queue.class, new QueueServerAdapter_RMI());
General- -.setServerForClass(ndTargetApplication.class, new ndTargetApplicationServerAdapter_RMI());
General- -.setServerForClass(MessagePrefix.class, new MessagePrefixServerAdapter_RMI());
General- -.setServerForClass(Language.class, new LanguageServerAdapter_RMI());
General- -.setServerForClass(ndMandant.class, new MandantServerAdapter_RMI());
General- -.setServerForClass(Mandant.class, new MandantServerAdapter_RMI());
General- -.setServerForClass(UserGroup.class, new UserGroupServerAdapter_RMI());
General- -.setServerForClass(TextResourceBundle.class, new TextHandlerServerAdapter_RMI());
General- -.setServerForClass(Holiday.class, new HolidayServerAdapter_RMI());
General- -.setServerForClass(ndAcknowledgement.class, new AcknowledgementServerAdapter_RMI());
General- -.setServerForClass(InvalidPassword.class, new InvalidPasswordServerAdapter_RMI());
General- -.setServerForClass(SystemParameter.class, new SystemParameterServerAdapter_RMI());
General- -.setServerForClass(ApplParameter.class, new ApplParameterServerAdapter_RMI());
General- -.setServerForClass(ClientApplParameter.class, new ClientApplParameterServerAdapter_RMI());
General- -.setServerForClass(ClientBackendParameter.class, new ClientBackendParameterServerAdapter_RMI());
General- -.setServerForClass(Branch.class, new BranchServerAdapter_RMI());
General- -.setServerForClass(TextHandler.class, new TextHandlerServerAdapter_RMI());
General- -.setServerForClass(ConcHistory.class, new ConcHistoryServerAdapter_RMI());
General- -.setServerForClass(Country.class, new CountryServerAdapter_RMI());
General- -.setServerForClass(SysRouteDelete.class, new SysRouteDeleteServerAdapter_RMI());
General- -.setServerForClass(Statistics.class, new StatisticsServerAdapter_RMI());
General- -.setServerForClass(Department.class, new DepartmentServerAdapter_RMI());
General- -.setServerForClass(OutsourcingControl.class, new OutsourcingControlServerAdapter_RMI());
General- -.setServerForClass(Pricing.class, new PricingServerAdapter_RMI());
General- -.setServerForClass(AccountLength.class, new AccountLengthServerAdapter_RMI());
General- -.setServerForClass(ReorganisationDB.class, new ReorganisationDBServerAdapter_RMI());
General- -.setServerForClass(IntdualcAccount.class, new IntdualcAccountServerAdapter_RMI());
General- -.setServerForClass(IntdualcSettlement.class, new IntdualcSettlementServerAdapter_RMI());
General- -.setServerForClass(ndPricingRemittance.class, new ndPricingRemittanceServerAdapter_RMI());
General- -.setServerForClass(DiSettlement.class, new DiSettlementServerAdapter_RMI());
General- -.setServerForClass(OrgaDb.class, new OrgaDbServerAdapter_RMI());
// which servers are to start?
boolean fStartServerGrp1 = true;
boolean fStartServerGrp2 = true;
boolean fStartServerGrp3 = true;
boolean fStartServerGrp4 = true;
boolean fStartServerGrp5 = true;
// check whether args are set
if (args.length > 0)
{
String strArg = args[0];
if (strArg.equals("1"))
{
fStartServerGrp1 = true;
fStartServerGrp2 = false;
fStartServerGrp3 = false;
fStartServerGrp4 = false;
fStartServerGrp5 = false;
}
if (strArg.equals("2"))
{
fStartServerGrp1 = false;
fStartServerGrp2 = true;
fStartServerGrp3 = false;
fStartServerGrp4 = false;
fStartServerGrp5 = false;
}
if (strArg.equals("3"))
{
fStartServerGrp1 = false;
fStartServerGrp2 = false;
fStartServerGrp3 = true;
fStartServerGrp4 = false;
fStartServerGrp5 = false;
}
if (strArg.equals("4"))
{
fStartServerGrp1 = false;
fStartServerGrp2 = false;
fStartServerGrp3 = false;
fStartServerGrp4 = true;
fStartServerGrp5 = false;
}
if (strArg.equals("5"))
{
fStartServerGrp1 = false;
fStartServerGrp2 = false;
fStartServerGrp3 = false;
fStartServerGrp4 = false;
fStartServerGrp5 = true;
}
}
// Supply Server with client personality of data manager in case
// they have to use it
DataManager dm = new DataManager();
GeneralServer.setDataManager(dm);
GeneralData- -.setDataManager(dm);
// start the servers
//The AuthenticationSever has to be started first because of security (trust-id)
// This is the first server to bind to the registry. But unfortunately
// in some cases when this process created the registry the bind gets a timeout.
// So we try to do this first bind several times before we give up...
boolean fStarted = false;
int iCount = 0;
while (!fStarted)
{
try
{
iCount++;
new AuthenticationServer(true);
fStarted = true;
}
catch (Throwable e)
{
Trace.traceException(e);
// no try anymore
if (iCount >= 10)
throw e;
}
}
//first the DataManager to can check the programm version
new DataManagerServer();
//Cache the current productinstance in the datamanager!
ndProductInstanceData productInstance =
getProductInstance (dm, strProduct, Integer.parseInt(strInstanceNumber));
//check the current version
if (productInstance.getVersion() != null)
{
if (!productInstance.getVersion().equals(c_actualVersion))
{
Trace.traceError("Invalid version!");
Trace.traceError("Actual version: " + c_actualVersion);
Trace.traceError("Needed version: " + productInstance.getVersion());
Trace.traceError("The rmi-process was stopped");
System.exit(-1);
}
}
else
{
Trace.traceError("No version check (no version set in DB)");
}
// do it in groups because of problems with AIX
if (fStartServerGrp1)
{
new ndDateServer();
new MessageServer();
new ndMessageServer();
new LogServer(true);
new HistoryServer(true);
new EventLogServer(true);
new dccEventLogServer(true);
new UserServer(true);
new BackendAccessServer(true);
BackendAccessServer.setMessageClassName("de.entory.dcc.messagedomain.Message");
}
if (fStartServerGrp2)
{
new CustomerServer();
new DepartmentServer(true);
new DccAccountServer ();
new DiAccountServer();
new DiSettlementServer();
new SettlementServer();
new DreCatiSettlementServer();
new DreCatiCurrencyManagerServer();
new DreCatiAccountServer();
new IntdualcAccountServer();
new IntdualcSettlementServer();
new DreCatiTrancheControlServer();
new CurrencyServer ();
new TextHandlerServer();
new ReconciliationServer(true);
new MessageProcessingServer(true);
new MsgAccessServer(true);
new OrgaDbServer();
}
if (fStartServerGrp3)
{
new ProgramServer(true);
new ndProcessServer();
new InRoutingConfigServer(true);
new QueueServer(true);
new ndTargetApplicationServer(true);
new MessagePrefixServer(true);
new BranchServer();
new ReorganisationDBServer();
}
if (fStartServerGrp4)
{
new LanguageServer();
new MandantServer();
new UserGroupServer();
new HolidayServer();
new AcknowledgementServer();
new InvalidPasswordServer();
new SystemParameterServer(true);
new AccountLengthServer();
}
if (fStartServerGrp5)
{
new ApplParameterServer(true);
new ClientApplParameterServer(true);
new ClientBackendParameterServer(true);
new ConcHistoryServer ();
new CountryServer (true);
new SysRouteDeleteServer ();
new StatisticsServer ();
new OutsourcingControlServer ();
new ndPricingRemittanceServer();
new PricingServer();
}
// make the default mandant available to the DBAccess-class
ndMandantData data = dm.getDefaultMandant();
if (data != null)
DBAccess.setDefaultMandantId(data.getId());
else
DBAccess.setDefaultMandantId(null);
// now we have to inform the server that its now acting in a multi thread
// environment
ndPersistenceServer.setMultiThreadSupport(true);
//last, we must save our pid in the table process, to give the master
//the chance, to start us in case of confusion!
if ((c_argProperties.get("p") != null) && (c_argProperties.get("n") != null))
{
String strPnr = (String)c_argProperties.get("p");
String strInr = (String)c_argProperties.get("n");
writePidToProcess (strPnr, Integer.parseInt(strInr));
}
else
Trace.traceError("No actual pid was set (the rmi-server must be started with arguments!)");
// now prepare the meta data if requested
//Writing metadata should occur after writing the pid, because this
// action runs a couple of time, and the master want not wait so long!
if ((System.getProperty("db.md_cacheonstartup") == null) ||
!(System.getProperty("db.md_cacheonstartup").equals("0")))
prepareMetaData ();
}
catch (RemoteException e)
{
Throwable ex = e.detail;
ex.printStackTrace();
Trace.traceError("Fatal error: the rmi-serverprocess was stopped!");
System.exit(-1);
}
catch (Throwable e)
{
e.printStackTrace();
Trace.traceError("Fatal error: the rmi-serverprocess was stopped!");
System.exit(-1);
}
}
private static ndProductInstanceData getProductInstance (DataManager dm, String product, int instance) throws Exception
{
ndProductInstanceData searchData = new ndProductInstanceData();
searchData.setInstanceNumber(instance);
searchData.setProduct(product);
return (dm.getProductInstance (searchData));
}
private static void setCryptFilePath(String strPath)
{
SecuritySupport.setPathNdCrypt(strPath);
}
private static void writePidToProcess (String programName, int instNr)
{
int pid = getPid();
if (pid == -1)
{
Trace.traceError("Error reading PID from file " + getPidFileName());
Trace.traceError("The Table process was not updated!");
}
else
{
try
{
//Get the programNr for the programname from table program
ProgramSearchData prgramSearch = new ProgramSearchData ();
prgramSearch.setName(programName);
prgramSearch.setOnlyValidProgram(true);
Vector<?> v = Program.search(prgramSearch);
Assertion.verify(v.size() == 1);
int programNr = Integer.parseInt(((ProgramData)v.firstElement()).getId());
//Update process
ndProcessData data = new ndProcessData();
data.setActualPid(new Integer (pid));
data.setProgram(new Integer (programNr));
data.setInstanceNr(new Integer (instNr));
ndProcess- -.setActualPid(data);
Trace.traceInfo("The actual pid was set");
}
catch (GeneralException e)
{
Trace.traceError("The actual pid couldn't be updated!");
}
}
}
private static int getPid ()
{
int pid = -1;
Эй, фуфло, готовься к шмону, ты на стрём поставлен у ворот...
Присоединяйтесь: https://t.me/kudy_vadis