Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo


#68 Classpath errors swallowed

Version 0.5
Steve Menard
Pascal Chambon


I've had much trouble with jpype lately, on freebsd (yep, it compiles wit ha modified setup.py I'll post too) :
I tried to import a class "com.AEM", which in turn used a class "ldap.Ldapconnection" which was not in the classpath.

Instead of raising errors, jpype considered com.AEM as a package, finally raising "package com.AEM is not Callable".

I've tinkered with _jpype.findClass() to see the problem. It was weird : the first time, findClass() returned None, and on second attempt it returned a broken class : calling getClassMethods() on it returned an empty tuple (whereas there were dozens of class methods in it normally), and getMethods DID raise an import exception concerning ldap.Ldapconnection.

It seems class importation errors get partly swallowed somewhere in the process...
But well it'd be pretty cool if missing package / missing class exceptions were raised much earlier, as classpath problems can really be hell else.


  • Steve Menard
    Steve Menard

    I think you nailed a nasty bug that I had totally never though about.

    The "XXX is not callable" is an old one. IN java packages are not "real", and so when something is not found, there is no way to be sure if a class or a package was to be imported.

    For the other one ... what happens is that a class loading fails transitively. And yes, this leaves a half-initialized in the store.

    This is a nasty one .. I will have to think about how to solve it.