cancel
Showing results for 
Search instead for 
Did you mean: 

How to enable JCo logging

Former Member
0 Kudos

I know I've seen this somewhere, but now that I need it, I can't find it. I've spent two hours searching all the forums. Can someone tell me how I enable JCo logging? I have a JCO/Java program that works fine from the command line, but doesn't work when I try to use it in a Tomcat servlet. None of the log files that I can find have any errors in them, but it appears that the call to JCO.createClient fails in the servlet. I've read all of the posts about putting the JCo jar file in the servlet's lib directory and copying sapjcorfc.dll to Tomcat's bin directory, but no luck. I'm hoping that there is some way that I can get JCo to give me a log that will indicate what is going wrong. Thank you for your help.

Accepted Solutions (1)

Accepted Solutions (1)

SidBhattacharya
Product and Topic Expert
Product and Topic Expert
0 Kudos

You can enable trace by this

JCO.setTraceLevel()

To enable SAP debugging you can use this

setAbapDebug(true)

Hth

Sid

Answers (1)

Answers (1)

ilja_farber
Employee
Employee
0 Kudos

<b>SAP Note 723562</b>

2. Runtime loading mechanism

When an application references a JCo class for the first time it will be loaded by the associated class loader. During this process JCo's static initializer will be executed. This routine will search and load the JCo JNI library by using the following algorithm:

1. Try to load the sapjcorfc library from the same directory where the sapjco.jar file or the JCo class files are located.

2. Search the sapjcorfc library along the directory path defined in the java.library.path system property from left to right and if found load it from there.

Note: If this property is not set manually, the JVM will usually set the OS specific library path environment variable as the default java.library.path system property at startup.

1. Let the JVM handle the loading of the sapjcorfc library by delegating this task to its System.loadLibrary(String) method.

JCo's JNI library is linked with the native RFC library. So when it is loaded the operating system will try to resolve its dependencies by loading the native RFC library, too. Usually, this will be done by searching for the first occurrence of the rfccm | librfc32 library along the directory path defined by the OS specific library path environment variable from left to right and load it.

If the sapjcorfc library and/or the rfccm | librfc32 library cannot be loaded, you will get an ExceptionInInitializerError from the JCO. <clinit> method saying that it could not load the middleware layer com.sap.mw.jco.rfc.MiddlewareRFC. This error message may be caused for one of the following reasons:

The sapjcorfc library cannot be found by using the above described algorithm, because you unintentionally installed it to the wrong directory or forgot to specify its directory in the OS specific library path environment variable or alternatively in the java.library.path system property.

The rfccm | librfc32 library cannot be found because you unintentionally installed it to the wrong directory or forgot to specify its directory in the OS specific library path environment variable.

The version of the sapjcorfc library found via the sapjco.jar directory or the java.library.path system property is not the required version (the version numbers and dates of the JCo middleware and the JCo library must be equal).

The version of the rfccm | librfc32 library found via the OS specific library path environment variable is too old (for example you forgot to copy the librfc32.dll to the <WinDir>\system32 directory and an older version is loaded from there).

The sapjcorfc library, the rfccm | librfc32 library or both lack the execute permission flag.

The sapjcorfc library, the rfccm | librfc32 library or both do not have the same bit width as the JVM.

The sapjcorfc library, the rfccm | librfc32 library or both were from a different JCo distribution and are not for use with your operating system and/or your hardware processor.

The sapjcorfc library, the rfccm | librfc32 library or both require a higher operating system version.