Online Tutorials & Training Materials | STechies.com
Register Login

Java.lang.NoClassDefFoundError: Could not initialize class com.sap.mw.jco.JCO

|| || 0

Java.lang.NoClassDefFoundError: Could not initialize class com.sap.mw.jco.JCO
Stechies

SAP Java JCO could not initialize class com.sap.mw.jco.JCO

CO initialization exception - 'java.lang.NoClassDefFoundError: Could not initialize class com.sap.mw.jco.JCO'

This error occurs when the Java Connector is not properly set up.

Therefore in order to resolve this error please properly set up the Java Connector by downloading appropriate version from SAP Service Marketplace and place it in a local directory outside hybris which will later become your {sapjco-install-path}.

  • Please extract the downloaded .zip file.
  • Follow the installation instructions for your operating system that you can find in {sapjco-install-path}/docs/jco/installation.html .
  • You can find the installation steps/instructions for your operating system in {sapjco-install-path}/docs/jco/installation.html.
  • The user can avoid setting the class path variable for their system and copy the extracted sapjco.jar to{HYBRIS_BIN_DIR}/ext-integration/sap/productconfig/sapproductconfighmc/lib

Note: When creating and setting environment variables in Linux please run the command: export <ENV_VARIABLE_NAME>= <VARIABLE_VALUE> please also ensure that you add these commands to your /root/etc/.profile file so that changes become permanent.

Please run following command goven below in order to check the status of your JCO installation by:

java -classpath {sapjco-install-path}/sapjco.jar com.sap.mw.jco.About

This will create a console output with certain diagnostic information (if the jco is not correctly setup).

Scenario 1) While running diagnostics for JCO results in following error occurs:

JCO.nativeInit( ): Could not initialize dynamic link library sapjcorfc [sapjcorfc (libstdc++.so.5: cannot open shared object file: No such file or directory)]

Solution:

This error occurs if either libstdc++ is not installed on user's system or the version installed is inappropriate.

  • Please run following command in order to check the libstdc++ version installed:
  • yum install libstdc++ Note: libstdc++-4.4.1-2.fc11.x86_64 installs libstdc++.so.6.
  • User need the compat-libstdc++-33-3.2.3-66.x86_64 package to get libstdc++.so.5.
  • Please run following command in order to install libstdc++.so.5:
  • yum install compat-libstdc++-33

Scenario 2) Following error while running JCO diagnostics:

java.lang.ExceptionInInitializerError: JCO.classInitialize(): Could not load middleware layer 'com.sap.mw.jco.rfc.MiddlewareRFC' JCO.nativeInit(): Could not initialize dynamic link library sapjcorfc [no sapjcorfc in java.library.path]. java.library.path

java.lang.ExceptionInInitializerError: JCO.classInitialize(): Could not load middleware layer 'com.sap.mw.jco.rfc.MiddlewareRFC' JCO.nativeInit( ): Could not initialize dynamic link library sapjcorfc [../libsapjcorfc.so: librfccm.so: cannot open shared object file: No such file or directory]. java.library.path

Solution:

The Jco2 zip file of Linux version contain two .so files (librfcm.so and libsapjcorfc.so). These two files must be located in the folder mentioned in the LD_LIBRARY_PATH environment variable.User can add this option to the startup of hybris by adding tomcat.javaoption=-DLD_LIBRARY_PATH=<PATH_TO_THE_SO_FILES> to the local.properties file in the hybris configuration folder.

If still the error didn't get resolved then please copy the .so files (librfccm.so and libsapjcorfc.so) to tomcat lib directory at {HYBRIS_BIN_DIR}platformtomcatlib.


Related Articles

0.0157 seconds.