cancel
Showing results for 
Search instead for 
Did you mean: 

NoClassDefFoundError when trying to use JCO class

Former Member
0 Kudos

Hi,

I am getting a NoClassDefFoundError when trying to use JCO class in my code. I added the sapjco.jar in libraries and references. I have also checked for the sapjcorfc.dll and lib32rfc.dll in Windows/System32 directory. The dll's are exisiting in the folder.

What else could be the reason for NoClassDefFoundError?

Code snippet below (it fails when calling JCO.getClientPoolManager)

try

{

logMan.logMessage("INFO", "In SAPPoolManager.getClientObject call");

JCO.Pool pool = JCO.getClientPoolManager().getPool(poolName);

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

If you look in the Sun API documentation for class [NoClassDefFoundError|http://java.sun.com/javase/6/docs/api/java/lang/NoClassDefFoundError.html] (package <i>java.lang.LinkageError</i>) you'll see that there's exactly one reason why this Error is thrown: The class could not be found. Or more eloquently as the documentation says:

Thrown if the Java Virtual Machine or a ClassLoader instance tries to load in the definition of a class (as part of a normal method call or as part of creating a new instance using the new expression) and no definition of the class could be found.

The searched-for class definition existed when the currently executing class was compiled, but the definition can no longer be found.

So basically you have to check your VM arguments when executing your code. Your classpath cannot contain the reference to the sapjco.jar, otherwise you wouldn't see this error.

Cheers, harald