Здравствуйте, коллеги! Есть шлюз со скриптом:
Код:
import bitel.billing.server.contract.bean.*;
import bitel.billing.server.ipn.bean.AddressRange;
import bitel.billing.server.ipn.UserStatus;
import bitel.billing.server.ipn.bean.AddressRangeManager;
import bitel.billing.server.ipn.bean.VlanManager;
import bitel.billing.server.util.DefaultServerSetup;
import bitel.billing.server.util.Utils;
import bitel.billing.common.IPUtils;
protected void doSync()
{
date = new GregorianCalendar();
gateSetup = new DefaultServerSetup( gate.getConfig(), "\r\n" );
script = gateSetup.getStringValue( "script" );
String host = gate.getHost();
String [] arguments = { script, host };
log.info("Execute: " + script + " " + host);
Process process = Runtime.getRuntime().exec( arguments );
log.info(script + " " + host + ", exitCode=" + process.exitValue() );
}
В конфигурации:
Код:
user_rule.editor.class=bitel.billing.module.services.ipn.editor.ManadContractRuleEditor
gate_manager.class=bitel.billing.server.ipn.ManadGateWorker
use.script=1
При запуске почему-то возвращается ошибка, что процесс не завершился!
В логах:
Код:
06-24/11:26:57 INFO [Thread-110] ManadGateWorker - Running script
06-24/11:26:57 INFO [Thread-110] ManadGateWorker - Execute: /usr/local/BGBillingServer/1telecom/sync.sh 192.168.122.65
06-24/11:26:57 ERROR [Thread-110] ManadGateWorker - Eval error2: Method Invocation process.exitValue
Method Invocation process.exitValue : at Line: 19 : in file: inline evaluation of: ``import bitel.billing.server.contract.bean.*; import bitel.billing.server.ipn.be . . . '' : process .exitValue ( )
Called from method: doSync
Target exception: java.lang.IllegalThreadStateException: process hasn't exited
at bsh.BSHMethodInvocation.eval(Unknown Source)
at bsh.BSHPrimaryExpression.eval(Unknown Source)
at bsh.BSHPrimaryExpression.eval(Unknown Source)
at bsh.BSHBinaryExpression.eval(Unknown Source)
at bsh.BSHArguments.getArguments(Unknown Source)
at bsh.BSHMethodInvocation.eval(Unknown Source)
at bsh.BSHPrimaryExpression.eval(Unknown Source)
at bsh.BSHPrimaryExpression.eval(Unknown Source)
at bsh.BSHBlock.evalBlock(Unknown Source)
at bsh.BSHBlock.eval(Unknown Source)
at bsh.BshMethod.invokeImpl(Unknown Source)
at bsh.BshMethod.invoke(Unknown Source)
at bsh.BshMethod.invoke(Unknown Source)
at bitel.billing.server.ipn.GateWorker$Scripter.invokeMethod(GateWorker.java:269)
at bitel.billing.server.ipn.GateWorker$Scripter.runScriptSync(GateWorker.java:230)
at bitel.billing.server.ipn.GateWorker.runSync(GateWorker.java:107)
at bitel.billing.server.ipn.GateWorker.run(GateWorker.java:85)
06-24/11:26:57 ERROR [Thread-110] LoggingPrintStream - java.lang.RuntimeException: Method Invocation process.exitValue : at Line: 19 : in file: inline evaluation of: ``import bitel.billing.server.contract.bean.*; import bitel.billing.server.ipn.be . . . '' : process .exitValue ( )
Called from method: doSync
Target exception: java.lang.IllegalThreadStateException: process hasn't exited
06-24/11:26:57 ERROR [Thread-110] LoggingPrintStream - at bitel.billing.server.ipn.GateWorker$Scripter.runScriptSync(GateWorker.java:243)
06-24/11:26:57 ERROR [Thread-110] LoggingPrintStream - at bitel.billing.server.ipn.GateWorker.runSync(GateWorker.java:107)
06-24/11:26:57 ERROR [Thread-110] LoggingPrintStream - at bitel.billing.server.ipn.GateWorker.run(GateWorker.java:85)
06-24/11:26:57 ERROR [Thread-110] LoggingPrintStream - Caused by: Method Invocation process.exitValue : at Line: 19 : in file: inline evaluation of: ``import bitel.billing.server.contract.bean.*; import bitel.billing.server.ipn.be . . . '' : process .exitValue ( )
Called from method: doSync
Target exception: java.lang.IllegalThreadStateException: process hasn't exited
06-24/11:26:57 ERROR [Thread-110] LoggingPrintStream - at bsh.BSHMethodInvocation.eval(Unknown Source)
06-24/11:26:57 ERROR [Thread-110] LoggingPrintStream - at bsh.BSHPrimaryExpression.eval(Unknown Source)
06-24/11:26:57 ERROR [Thread-110] LoggingPrintStream - at bsh.BSHPrimaryExpression.eval(Unknown Source)
06-24/11:26:57 ERROR [Thread-110] LoggingPrintStream - at bsh.BSHBinaryExpression.eval(Unknown Source)
06-24/11:26:57 ERROR [Thread-110] LoggingPrintStream - at bsh.BSHArguments.getArguments(Unknown Source)
06-24/11:26:57 ERROR [Thread-110] LoggingPrintStream - at bsh.BSHMethodInvocation.eval(Unknown Source)
06-24/11:26:57 ERROR [Thread-110] LoggingPrintStream - at bsh.BSHPrimaryExpression.eval(Unknown Source)
06-24/11:26:57 ERROR [Thread-110] LoggingPrintStream - at bsh.BSHPrimaryExpression.eval(Unknown Source)
06-24/11:26:57 ERROR [Thread-110] LoggingPrintStream - at bsh.BSHBlock.evalBlock(Unknown Source)
06-24/11:26:57 ERROR [Thread-110] LoggingPrintStream - at bsh.BSHBlock.eval(Unknown Source)
06-24/11:26:57 ERROR [Thread-110] LoggingPrintStream - at bsh.BshMethod.invokeImpl(Unknown Source)
06-24/11:26:57 ERROR [Thread-110] LoggingPrintStream - at bsh.BshMethod.invoke(Unknown Source)
06-24/11:26:57 ERROR [Thread-110] LoggingPrintStream - at bsh.BshMethod.invoke(Unknown Source)
06-24/11:26:57 ERROR [Thread-110] LoggingPrintStream - at bitel.billing.server.ipn.GateWorker$Scripter.invokeMethod(GateWorker.java:269)
06-24/11:26:57 ERROR [Thread-110] LoggingPrintStream - at bitel.billing.server.ipn.GateWorker$Scripter.runScriptSync(GateWorker.java:230)
06-24/11:26:57 ERROR [Thread-110] LoggingPrintStream - ... 2 more
06-24/11:26:57 ERROR [Thread-110] ManadGateWorker - Gate unaccesible - 192.168.122.65
06-24/11:26:57 ERROR [Thread-110] ManadGateWorker - -------------------------
06-24/11:26:57 ERROR [Thread-110] ManadGateWorker - error: Method Invocation process.exitValue : at Line: 19 : in file: inline evaluation of: ``import bitel.billing.server.contract.bean.*; import bitel.billing.server.ipn.be . . . '' : process .exitValue ( )
Called from method: doSync
Target exception: java.lang.IllegalThreadStateException: process hasn't exited
java.lang.RuntimeException: Method Invocation process.exitValue : at Line: 19 : in file: inline evaluation of: ``import bitel.billing.server.contract.bean.*; import bitel.billing.server.ipn.be . . . '' : process .exitValue ( )
Called from method: doSync
Target exception: java.lang.IllegalThreadStateException: process hasn't exited
at bitel.billing.server.ipn.GateWorker$Scripter.runScriptSync(GateWorker.java:243)
at bitel.billing.server.ipn.GateWorker.runSync(GateWorker.java:107)
at bitel.billing.server.ipn.GateWorker.run(GateWorker.java:85)
Caused by: Method Invocation process.exitValue : at Line: 19 : in file: inline evaluation of: ``import bitel.billing.server.contract.bean.*; import bitel.billing.server.ipn.be . . . '' : process .exitValue ( )
Called from method: doSync
Target exception: java.lang.IllegalThreadStateException: process hasn't exited
at bsh.BSHMethodInvocation.eval(Unknown Source)
at bsh.BSHPrimaryExpression.eval(Unknown Source)
at bsh.BSHPrimaryExpression.eval(Unknown Source)
at bsh.BSHBinaryExpression.eval(Unknown Source)
at bsh.BSHArguments.getArguments(Unknown Source)
at bsh.BSHMethodInvocation.eval(Unknown Source)
at bsh.BSHPrimaryExpression.eval(Unknown Source)
at bsh.BSHPrimaryExpression.eval(Unknown Source)
at bsh.BSHBlock.evalBlock(Unknown Source)
at bsh.BSHBlock.eval(Unknown Source)
at bsh.BshMethod.invokeImpl(Unknown Source)
at bsh.BshMethod.invoke(Unknown Source)
at bsh.BshMethod.invoke(Unknown Source)
at bitel.billing.server.ipn.GateWorker$Scripter.invokeMethod(GateWorker.java:269)
at bitel.billing.server.ipn.GateWorker$Scripter.runScriptSync(GateWorker.java:230)
... 2 more
Убираю ``+ process.exitValue()' и все работает
К слову, про код возврата:
Код:
[root@bg 1telecom]# /usr/local/BGBillingServer/1telecom/sync.sh 192.168.122.65
192.168.122.65:7022 done
[root@bg 1telecom]# echo $?
0
[root@bg 1telecom]#
Все вроде бы нормально. В чем может быть дело?