布署web工程到sap netweaver application server java
异常:1
JCO.classInitialize(): Could not load middleware layer 'com.sap.mw.jco.rfc.MiddlewareRFC' JCO.nativeInit(): Could not initialize dynamic link library sapjcorfc [sapjcorfc (Not found in java.library.path)]. java.library.path [/usr/java14_64/jre/bin:/usr/java14_64/jre/bin:/usr/java14_64/jre/bin/classic:/usr/sap/PD1/JC20/exe:/usr/sap/PD1/JC20/exe:/usr/sap/PD1/SYS/exe/run:/usr/java14_64/jre/bin/j9vm:/usr/sap/PD1/JC20/exe::/usr/lib:/usr/sap/PD1/JC20/j2ee/os_libs:/usr/sap/PD1/JC20/exe:/usr/sap/PD1/JC20/exe:/usr/lib:/lib:/usr/sap/PD1/SYS/exe/run]
com.sap.mw.jco.JCO (initialization failure)
注意【sapjcorfc (Not found in java.library.path】,说明在服务器端没有相关的库文件,jco针对不同操作系统有不同的库文件,可以在下载的api文件中找到.安装细节看docs/ installation.html。我的服务器用的是ibm aix
Then add {sapjco-install-path}
to the LIBPATH
environment variable.
Finally, add {sapjco-install-path}/sapjco.jar
to your CLASSPATH
environment variable.
异常:2
java.lang.ExceptionInInitializerError: JCO.classInitialize(): Could not load middleware layer 'com.sap.mw.jco.rfc.MiddlewareRFC'
Native Library C:/WINDOWS/system32/ sapjcorfc.dll already loaded in another classloader
解决方案:
remove all sapjco.jar(s) from all applications and do the following:
1. Add the library reference to the J2EE module project(s) of the apps by right-click onto the project node->Add/Remove Additional Libraries...->com.sap.mw.jco
2. Open the EAR(s) containing the module(s) and open application-j2ee-engine.xml by doubleclick. Click on "References", choose Add, "Select library/interface/service" and choose the JCO lib here also.
3. Rebuild the module(s) EJB archives and the EAR(s) and redeploy the EARS.