Skip to Content

SAP Java connector JCo NoClassDefFoundError

Nov 10, 2016 at 10:11 AM


avatar image

Hello gurus,

I have a problem with SAP and JCo 3.
My task is to create a simple JCo application which is going to be called from SAP.
I'm using the approach with creation of SM59 connection to access JCo.
I'm using JCo 3.0.14

I'm not a java developer and I do not have experience with setting class paths and so on. I have read forums in order to produce this application.

As a first step I have created very simple java application for test (its source is at the bottom). It uses one of the JCo classes. This app. throws an error when it is executed on the SAP server but it is executed fine on my windows PC.
The error is :
(the full error description is at the bottom)
So I would like first to resolve this issue with this test appl. before starting to work on the real application.

A few info about my workspace and the SAP server where JCo is started.

I am developing my application on a windows PC with Windows 10.
I am using:
Eclipse Java EE IDE for Web Developers.
Version: Mars.1 Release (4.5.1)
Build id: 20150924-1200

SAP server is linux machine.
Java version is:
java -version
openjdk version "1.8.0_65"
OpenJDK Runtime Environment (build 1.8.0_65-b17)
OpenJDK 64-Bit Server VM (build 25.65-b01, mixed mode)

I have set up the two environment variables:


On my PC:

I'm starting eclipse via bat file with the following command:

C:\NWCEIDE04P_2-80000648\eclipse\eclipse.exe -vm "C:\Program Files\Java\jdk1.8.0_101\bin\javaw.exe"

i produce a .class file. I have tried with manifests also but again errors occur.occur.

When I run the application on my PC it is running fine. No errors occur.
I'm running a .class file.
In order to run it on my Windows PC I'm using the following commands:

set path="C:\Program Files\Java\jdk1.8.0_101\bin\ C:\workspace\D2\bin>java -cp . daimler.Server02

I suppose that the 1st line -> set path must be somehow performed on the server also, but I do not know how.

On the SAP server.
I am copying my bin directory from my PC on the SAP server and i use the following command to start the app:

java -cp . daimler.Server02

Now the following error occurs:

Exception in thread "main" java.lang.NoClassDefFoundError: com/sap/conn/jco/JCo
        at daimler.Server02.step4StaticRepository(
        at daimler.Server02.main(
Caused by: java.lang.ClassNotFoundException:
        at java.lang.ClassLoader.loadClass(
        at sun.misc.Launcher$AppClassLoader.loadClass(
        at java.lang.ClassLoader.loadClass(
        ... 2 more

I suppose that I have to point somehow the path to java jdk as I do it on my PC.

This is the source code of my JCo application:

package daimler;
public class Server02 {
 static String SERVER_NAME1 = "SERVER";
  static void step4StaticRepository()
        JCoCustomRepository cR = JCo.createCustomRepository("MyCustomRepository");
  public static void main(String[] a)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

0 Answers