Win7环境下STAF安装STAX遇到的问题及解决方法

来源:互联网 发布:java post 编辑:程序博客网 时间:2024/05/22 00:27

错误分析

1、第一次调用失败是设置路径不对,我在本地创建的文件夹为service(路径D:\Tcl\lib\service\stax),staxgs上介绍的安装文件夹是services,就差1个s导致找不到,低级失误!后续一定要仔细核对。

Microsoft Windows [版本 6.1.7601]

版权所有 (c) 2009 Microsoft Corporation。保留所有权利。


C:\Users\Administrator.ZHANGHAO-PC>STAFProc


Error on Service definition line:


SERVICE STAX LIBRARY JSTAF EXECUTE {STAF/Config/STAFRoot}/services/stax/STAX.jar
 OPTION J2=-Xmx384m


Error code: 38
Reason    : Error constructing service, JSTAF, Result: Unable to open jar file:
D:\Tcl\lib/services/stax/STAX.jar


Error in configuration file: D:\Tcl\lib\bin\STAF.cfg

调用过程

startSTAFProc.bat执行时,先调用STAFEnv.bat(给PATH、CLASSPATH赋值)

C:\Users\Administrator.ZHANGHAO-PC>D:


D:\>cd Tcl\lib


D:\Tcl\lib>STAFEnv.bat

执行STAFEnv.bat后查看CLASSPATH、PATH的值
D:\Tcl\lib>set CLASSPATH
CLASSPATH=D:\Tcl\lib\bin\JSTAF.jar;D:\Tcl\lib\samples\demo\STAFDemo.jar;D:\Tcl\l
ib\samples\demo\STAFDemo.jar;D:\Tcl\lib\bin\JSTAF.jar


D:\Tcl\lib>set PATH
Path=D:\Tcl\lib\bin;D:\Tcl\lib\bin;D:\Tcl\bin;C:\ProgramData\Oracle\Java\javapat
h;C:\Program Files (x86)\PC Connectivity Solution\;C:\Windows\system32;C:\Window
s;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Progra
m Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\Micros
oft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\B
inn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.tcl

执行STAFEvent.jar

把路径设置正确后,执行STAFProc成功。
D:\Tcl\lib>STAFProc


Machine          : ZHANGHAO-PC
Machine nickname : ZHANGHAO-PC
Startup time     : 20160405-20:03:25


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


执行STAFEvent.jar和STAX.jar

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. ”


1 0
原创粉丝点击