Issue1374

classification
Title: "java.lang.NoClassDefFoundError" vs. "TypeError: Error when calling the metaclass bases cannot create 'NoneType' instances"
Type: behaviour Severity: normal
Components: Core Versions:
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: alv131, fwierzbicki, leosoto, zyasoft
Priority: Keywords:

Created on 2009-06-12.10:29:35 by alv131, last changed 2014-05-10.06:00:38 by zyasoft.

Files
File name Uploaded Description Edit Remove
test.jy alv131, 2009-08-31.06:49:15
Messages
msg4810 (view) Author: (alv131) Date: 2009-06-12.10:29:34
Trying to run a simple example of jython working with SWT/JFace and
adding the required .jar files one by one...

"Jython 2.2.1" gives me a friendly error message, while "Jython 2.5rc4"
doesn't help me too much!

Jython 2.5rc4:
==============

D:\wrk\_test2\jython>swt2.bat

D:\wrk\_test2\jython>set
CLASSPATH=d:\progs\eclipse-3.4.2\plugins\org.eclipse.sw
t.win32.win32.x86_3.4.1.v3452b.jar;d:\progs\eclipse-3.4.2\plugins\org.eclipse.jf
ace_3.4.2.M20090107-0800.jar

D:\wrk\_test2\jython>jython swt2.jy
Traceback (most recent call last):
  File "swt2.jy", line 6, in <module>
    class Hello (ApplicationWindow):
TypeError: Error when calling the metaclass bases
    cannot create 'NoneType' instances


Jython 2.2.1:
=============

D:\wrk\_test2\jython>d:\progs\jython-2.2.1\jython swt2.jy
*sys-package-mgr*: processing new jar,
'D:\progs\eclipse-3.4.2\plugins\org.eclip
se.swt.win32.win32.x86_3.4.1.v3452b.jar'
*sys-package-mgr*: processing new jar,
'D:\progs\eclipse-3.4.2\plugins\org.eclip
se.jface_3.4.2.M20090107-0800.jar'
Traceback (innermost last):
  File "swt2.jy", line 6, in ?
java.lang.NoClassDefFoundError: org/eclipse/core/runtime/IProgressMonitor
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:169)
        at org.python.core.SyspathJavaLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
        at org.python.core.Py.findClassEx(Unknown Source)
        at org.python.core.SysPackageManager.findClass(Unknown Source)
        at org.python.core.PyJavaClass.initLazy(Unknown Source)
        at org.python.core.PyJavaClass.initialize(Unknown Source)
        at org.python.core.PyJavaClass.lookupGivingClass(Unknown Source)
        at org.python.core.PyClass.lookup(Unknown Source)
        at org.python.core.PyJavaClass.__findattr__(Unknown Source)
        at org.python.core.Py.makeClass(Unknown Source)
        at org.python.core.Py.makeClass(Unknown Source)
        at org.python.pycode._pyx0.f$0(swt2.jy:6)
        at org.python.pycode._pyx0.call_function(swt2.jy)
        at org.python.core.PyTableCode.call(Unknown Source)
        at org.python.core.PyCode.call(Unknown Source)
        at org.python.core.Py.runCode(Unknown Source)
        at org.python.core.__builtin__.execfile_flags(Unknown Source)
        at org.python.util.PythonInterpreter.execfile(Unknown Source)
        at org.python.util.jython.main(Unknown Source)
Caused by: java.lang.ClassNotFoundException:
org.eclipse.core.runtime.IProgressM
onitor
        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
        ... 21 more

java.lang.NoClassDefFoundError: java.lang.NoClassDefFoundError:
org/eclipse/core
/runtime/IProgressMonitor

D:\wrk\_test2\jython>
msg5049 (view) Author: Leonardo Soto (leosoto) Date: 2009-08-17.14:46:09
Can you attach your scripts please, to help us reproduce the problem?
msg5078 (view) Author: (alv131) Date: 2009-08-31.06:49:15
Tested with the .jar files of eclipse-3.5.0 (win32).
The classpath doesn't contain ALL the required .jar files!

D:\tmp\2>echo %CLASSPATH%
.;org.eclipse.jface_3.5.0.I20090525-2000.jar;org.eclipse.swt.win32.win32.x86_3.5
.0.v3550b.jar

D:\tmp\2>\progs\jython-2.2.1\jython.bat test.jy
Traceback (innermost last):
  File "test.jy", line 6, in ?
java.lang.NoClassDefFoundError: org/eclipse/core/runtime/IProgressMonitor
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:169)
        at org.python.core.SyspathJavaLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
        at org.python.core.Py.findClassEx(Unknown Source)
        at org.python.core.SysPackageManager.findClass(Unknown Source)
        at org.python.core.PyJavaClass.initLazy(Unknown Source)
        at org.python.core.PyJavaClass.initialize(Unknown Source)
        at org.python.core.PyJavaClass.lookupGivingClass(Unknown Source)
        at org.python.core.PyClass.lookup(Unknown Source)
        at org.python.core.PyJavaClass.__findattr__(Unknown Source)
        at org.python.core.Py.makeClass(Unknown Source)
        at org.python.core.Py.makeClass(Unknown Source)
        at org.python.pycode._pyx0.f$0(test.jy:6)
        at org.python.pycode._pyx0.call_function(test.jy)
        at org.python.core.PyTableCode.call(Unknown Source)
        at org.python.core.PyCode.call(Unknown Source)
        at org.python.core.Py.runCode(Unknown Source)
        at org.python.core.__builtin__.execfile_flags(Unknown Source)
        at org.python.util.PythonInterpreter.execfile(Unknown Source)
        at org.python.util.jython.main(Unknown Source)
Caused by: java.lang.ClassNotFoundException:
org.eclipse.core.runtime.IProgressM
onitor
        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
        ... 21 more

java.lang.NoClassDefFoundError: java.lang.NoClassDefFoundError:
org/eclipse/core
/runtime/IProgressMonitor

D:\tmp\2>\progs\jython-2.5.0\jython.bat test.jy
Traceback (most recent call last):
  File "test.jy", line 6, in <module>
    class Hello(ApplicationWindow):
TypeError: Error when calling the metaclass bases
    cannot create 'NoneType' instances

D:\tmp\2>dir /b
org.eclipse.jface_3.5.0.I20090525-2000.jar
org.eclipse.swt.win32.win32.x86_3.5.0.v3550b.jar
test.jy

D:\tmp\2>type test.jy
from org.eclipse.jface.window import *
from org.eclipse.swt import *
from org.eclipse.swt.widgets import *
import sys

class Hello(ApplicationWindow):
  def createContents(self, parent):
    b = Button(parent, SWT.PUSH, widgetSelected=self.helloWorld)
    b.text = "Hello World"
    return b

  def helloWorld(self, evt):
     print "Hello There ..."
     sys.exit(0)

w = Hello(None)
w.blockOnOpen = 1
w.open()
Display.getCurrent().dispose()



Now if we change the classpath to contain all the required .jar files:
D:\tmp\2>set
CLASSPATH=.;org.eclipse.jface_3.5.0.I20090525-2000.jar;org.eclipse.
swt.win32.win32.x86_3.5.0.v3550b.jar;org.eclipse.equinox.common_3.5.0.v20090520-
1800.jar;org.eclipse.core.commands_3.5.0.I20090525-2000.jar

D:\tmp\2>\progs\jython-2.2.1\jython.bat test.jy
*sys-package-mgr*: processing new jar,
'D:\tmp\2\org.eclipse.core.commands_3.5.0
.I20090525-2000.jar'
Hello There ...

D:\tmp\2>\progs\jython-2.5.0\jython.bat test.jy
*sys-package-mgr*: processing new jar,
'D:\tmp\2\org.eclipse.core.commands_3.5.0
.I20090525-2000.jar'
Hello There ...

D:\tmp\2>
msg8367 (view) Author: Jim Baker (zyasoft) Date: 2014-05-10.06:00:38
My reading of this example is that ApplicationWindow is imported as None, which gives the correct Python error.

If that's not the case, please re-open, although we are only looking at 2.7 at this time.
History
Date User Action Args
2014-05-10 06:00:38zyasoftsetstatus: open -> closed
resolution: wont fix
messages: + msg8367
nosy: + zyasoft
2013-02-26 17:26:07fwierzbickisetnosy: + fwierzbicki
2009-08-31 06:49:16alv131setfiles: + test.jy
messages: + msg5078
2009-08-17 14:46:10leosotosetnosy: + leosoto
messages: + msg5049
2009-06-12 10:29:36alv131create