1、第一次调用失败是设置路径不对,我在本地创建的文件夹为service(路径D:\Tcl\lib\service\stax),staxgs上介绍的安装文件夹是services,就差1个s导致找不到,低级失误!后续一定要仔细核对。
Microsoft Windows [版本 6.1.7601]
版权所有 (c) 2009 Microsoft Corporation。保留所有权利。STAFProc version 3.4.24.1 initialized
查看service,STAFEvent启动成功
C:\Users\Administrator.ZHANGHAO-PC>staf local service list
Response
--------
Name Library Executable
--------- ---------- -------------------------------------
CONFIG <Internal> <None>
DELAY <Internal> <None>
DIAG <Internal> <None>
ECHO <Internal> <None>
EVENT JSTAF D:/Tcl/lib/service/stax/STAFEvent.jar
FS <Internal> <None>
HANDLE <Internal> <None>
HELP <Internal> <None>
LIFECYCLE <Internal> <None>
MISC <Internal> <None>
PING <Internal> <None>
PROCESS <Internal> <None>
QUEUE <Internal> <None>
SEM <Internal> <None>
SERVICE <Internal> <None>
SHUTDOWN <Internal> <None>
TRACE <Internal> <None>
TRUST <Internal> <None>
VAR <Internal> <None>
STAF.cfg文件内容如下
# Turn on tracing of internal errors and deprecated options
trace enable tracepoints "error deprecated"
# Enable TCP/IP connections
interface ssl library STAFTCP option Secure=Yes option Port=6550
interface tcp library STAFTCP option Secure=No option Port=6500
# Set default local trust
trust machine local://local level 5
# Add default service loader
serviceloader library STAFDSLS
service Event library JSTAF execute D:/Tcl/lib/service/stax/STAFEvent.jar
SET MAXQUEUESIZE 10000
如果把service Event library JSTAF execute D:/Tcl/lib/service/stax/STAFEvent.jar 替换成staxgs上介绍的
SERVICE EVENT LIBRARY JSTAF EXECUTE \
{STAF/Config/STAFRoot}/services/stax/STAFEvent.jar
则报错如下(报错原因不明):
D:\Tcl\lib>STAFProc
Error on Service definition line:
SERVICE EVENT LIBRARY JSTAF EXECUTE {STAF/Config/STAFRoot}/services/stax/STAFEve
nt.jar
Error code: 38
Reason : Error constructing service, JSTAF, Result: Unable to open jar file:
D:\Tcl\lib/services/stax/STAFEvent.jar
Error in configuration file: D:\Tcl\lib\bin\STAF.cfg
C:\Users\Administrator.ZHANGHAO-PC>staf local service list
Response
--------
Name Library Executable
--------- ---------- -------------------------------------
CONFIG <Internal> <None>
DELAY <Internal> <None>
DIAG <Internal> <None>
ECHO <Internal> <None>
EVENT JSTAF D:/Tcl/lib/service/stax/STAFEvent.jar
FS <Internal> <None>
HANDLE <Internal> <None>
HELP <Internal> <None>
LIFECYCLE <Internal> <None>
MISC <Internal> <None>
PING <Internal> <None>
PROCESS <Internal> <None>
QUEUE <Internal> <None>
SEM <Internal> <None>
SERVICE <Internal> <None>
SHUTDOWN <Internal> <None>
STAX JSTAF D:/Tcl/lib/service/stax/STAX.jar
TRACE <Internal> <None>
TRUST <Internal> <None>
VAR <Internal> <None>
注意:SERVICE STAX LIBRARY JSTAF EXECUTE D:/Tcl/lib/service/stax/STAX.jar OPTION J2=-Xmx384m在前,service Event library JSTAF execute在后。 D:/Tcl/lib/service/stax/STAFEvent.jar
# Turn on tracing of internal errors and deprecated options
trace enable tracepoints "error deprecated"
# Enable TCP/IP connections
interface ssl library STAFTCP option Secure=Yes option Port=6550
interface tcp library STAFTCP option Secure=No option Port=6500
# Set default local trust
trust machine local://local level 5
# Add default service loader
serviceloader library STAFDSLS
SERVICE STAX LIBRARY JSTAF EXECUTE D:/Tcl/lib/service/stax/STAX.jar OPTION J2=-Xmx384m
service Event library JSTAF execute D:/Tcl/lib/service/stax/STAFEvent.jar
SET MAXQUEUESIZE 10000
若顺序反了,则会报错如下:
D:\Tcl\lib>STAFProc
Error on Service definition line:
SERVICE STAX LIBRARY JSTAF EXECUTE D:/Tcl/lib/service/stax/STAX.jar OPTION J2=-
Xmx384m
Error code: 27
Reason : Error constructing service, JSTAF, Result: You may not specify the J
VM or J2 options without specifying a new JVMNAME
Error in configuration file: D:\Tcl\lib\bin\STAF.cfg
staxgs中解释如下:
“In this example we are assuming that the STAX service is the first service in your STAF.cfg file. If it was not, since you are changing the JVM
options, you would also need to include the JVMName option, to specify a unique name for the STAX service's JVM. ”