我们将开始在Autosys J2EE实现上进行开发,但是当我们尝试创建一个简单的ping api程序作为CA提供的示例时,程序sysout在运行后会显示以下内容;
UnSatisfiedLinkErrorapijni (Not found in java.library.path)
Exception in thread "main" java.lang.UnsatisfiedLinkError: apijni (Not found in java.library.path)
at java.lang.ClassLoader.loadLibraryWithPath(ClassLoader.java:1426)
at java.lang.ClassLoader.loadLibraryWithClassLoader(ClassLoader.java:1396)
at java.lang.System.loadLibrary(System.java:567)
at com.ca.autosys.services.JRequest.<clinit>(JRequest.java:24)
at com.ca.autosys.services.request.cat1.PingApiReq.<init>(PingApiReq.java:58)
at com.ibm.csc.autosys.PingApiClient.processRequest(PingApiClient.java:14)
at com.ibm.csc.autosys.PingApiClient.<init>(PingApiClient.java:9)
at com.ibm.csc.autosys.PingApi.main(PingApi.java:17)
Autosys版本13已安装在Linux上,并且我正在WIN10上运行示例程序,如果有人要求,我的java.library.path如下:
C:\Program Files\IBM\SDP\jdk\jre\bin\compressedrefs;C:\Program Files\IBM\SDP\jdk\jre\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Git\cmd;C:\Program Files\PuTTY\;C:\WINDOWS\System32\OpenSSH\;C:\Users\EDUARDODIOGOGARCIA\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Java\jdk1.8.0_171\bin;;.
我真的很困惑,为什么找不到关于“ apijni”的说法。
非常感谢其他人可以帮助我确定此错误的原因。
我还提供了2个样本类,与CA Video相同:
package com.ibm.csc.autosys;
import com.ca.autosys.services.AsApi;
import com.ca.autosys.services.AsConstants;
import org.apache.log4j.PropertyConfigurator;
public class PingApi {
public static void main(String[] args) {
String hostname = "myserver.domain.com";
Integer port = 5200;
System.out.println(System.getProperty("java.library.path"));
AsApi api = new AsApi(hostname, port, AsConstants.ENCRYPTION_TYPE_DEFAULT, "");
PingApiClient pac = new PingApiClient(api);
}
}
package com.ibm.csc.autosys;
import com.ca.autosys.services.AsApi;
import com.ca.autosys.services.request.cat1.PingApiReq;
import com.ca.autosys.services.response.PingApiRsp;
public class PingApiClient {
public PingApiClient(AsApi api) {
processRequest(api);
}
private void processRequest(AsApi api) {
// TODO Auto-generated method stub
PingApiReq request = new PingApiReq();
try {
PingApiRsp response = (PingApiRsp) request.execute(api);
System.out.println("Server version is: " + response.getServerVersion());
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
}