From: Andrew K. <aku...@me...> - 2001-12-17 22:25:27
|
I'm trying to build an applet with Jython 2.0 (it worked fine with 1.0something), and am getting a mysterious error from the resulting JAR file. Java Traceback: at org.python.core.Py.JavaError(Py.java:238) at org.python.core.Py.findClassEx(Py.java:620) ... at java.lang.Thread.run(Thread.java:484) Traceback (innermost last): File "/home/akuchlin/src/mems/proto3/instrument/client/awt/MicroscopeApplet.py", line 0, in main File "/home/akuchlin/src/mems/proto3/instrument/client/awt/PyClient.py", line 0, in main File "/usr/local/jython-2.0/Lib/string.py", line 0, in main java.lang.ClassFormatError: strop (Bad magic number) (Full traceback below, in case that information is useful.) Inspecting the JAR file finds that strop.class isn't in it, but string.py should surely get an ImportError and continue running. The same error occurs with both the Sun and IBM JVMs. Has anyone seen this before? Anyone got a clue about its cause? --amk Java Traceback: at org.python.core.Py.JavaError(Py.java:238) at org.python.core.Py.findClassEx(Py.java:620) at org.python.core.SysPackageManager.findClass(SysPackageManager.java:91) at org.python.core.PackageManager.findClass(PackageManager.java:19) at org.python.core.SysPackageManager.findClass(SysPackageManager.java:83) at org.python.core.PyJavaPackage.__findattr__(PyJavaPackage.java:128) at org.python.core.PackageManager.lookupName(PackageManager.java:96) at org.python.core.imp.load(imp.java:361) at org.python.core.imp.load(imp.java:376) at org.python.core.imp.importName(imp.java:447) at org.python.core.imp.importName(imp.java:509) at org.python.core.ImportFunction.load(__builtin__.java:967) at org.python.core.ImportFunction.__call__(__builtin__.java:961) at org.python.core.PyObject.__call__(PyObject.java:250) at org.python.core.__builtin__.__import__(__builtin__.java:921) at org.python.core.imp.importFromAs(imp.java:566) at string$_PyInner.main$27(string.java:724) at string$_PyInner.call_function(string.java:228) at org.python.core.PyTableCode.call(PyTableCode.java:155) at org.python.core.imp.createFromCode(imp.java:157) at org.python.core.imp.createFromClass(imp.java:178) at org.python.core.imp.loadPrecompiled(imp.java:246) at org.python.core.imp.loadFromPath(imp.java:257) at org.python.core.imp.loadFromPath(imp.java:252) at org.python.core.imp.load(imp.java:357) at org.python.core.imp.load(imp.java:376) at org.python.core.imp.importName(imp.java:447) at org.python.core.imp.importName(imp.java:509) at org.python.core.ImportFunction.load(__builtin__.java:967) at org.python.core.ImportFunction.__call__(__builtin__.java:961) at org.python.core.PyObject.__call__(PyObject.java:250) at org.python.core.__builtin__.__import__(__builtin__.java:921) at org.python.core.imp.importOne(imp.java:518) at PyClient$_PyInner.main$20(PyClient.java:736) at PyClient$_PyInner.call_function(PyClient.java:246) at org.python.core.PyTableCode.call(PyTableCode.java:155) at org.python.core.imp.createFromCode(imp.java:157) at org.python.core.imp.createFromClass(imp.java:178) at org.python.core.imp.loadPrecompiled(imp.java:246) at org.python.core.imp.loadFromPath(imp.java:257) at org.python.core.imp.loadFromPath(imp.java:252) at org.python.core.imp.load(imp.java:357) at org.python.core.imp.load(imp.java:376) at org.python.core.imp.importName(imp.java:447) at org.python.core.imp.importName(imp.java:509) at org.python.core.ImportFunction.load(__builtin__.java:967) at org.python.core.ImportFunction.__call__(__builtin__.java:961) at org.python.core.PyObject.__call__(PyObject.java:250) at org.python.core.__builtin__.__import__(__builtin__.java:921) at org.python.core.imp.importOne(imp.java:518) at MicroscopeApplet$_PyInner.main$6(MicroscopeApplet.java:111) at MicroscopeApplet$_PyInner.call_function(MicroscopeApplet.java:62) at org.python.core.PyTableCode.call(PyTableCode.java:155) at org.python.core.imp.createFromCode(imp.java:157) at org.python.core.Py.initProxy(Py.java:731) at MicroscopeApplet.<init>(MicroscopeApplet.java:247) at java.lang.Class.newInstance0(Native Method) at java.lang.Class.newInstance(Class.java:237) at sun.applet.AppletPanel.createApplet(AppletPanel.java:579) at sun.plugin.AppletViewer.createApplet(AppletViewer.java:1178) at sun.applet.AppletPanel.runLoader(AppletPanel.java:515) at sun.applet.AppletPanel.run(AppletPanel.java:293) at sun.plugin.navig.motif.MotifAppletViewer.maf_run(MotifAppletViewer.java:127) at sun.plugin.navig.motif.MotifAppletViewer.run(MotifAppletViewer.java:123) at java.lang.Thread.run(Thread.java:484) Traceback (innermost last): File "/home/akuchlin/src/mems/proto3/instrument/client/awt/MicroscopeApplet.py", line 0, in main File "/home/akuchlin/src/mems/proto3/instrument/client/awt/PyClient.py", line 0, in main File "/usr/local/jython-2.0/Lib/string.py", line 0, in main java.lang.ClassFormatError: strop (Bad magic number) |
From: <bc...@wo...> - 2001-12-18 13:32:38
|
[Andrew Kuchling] >I'm trying to build an applet with Jython 2.0 (it worked fine with >1.0something), and am getting a mysterious error from the resulting >JAR file. > >Java Traceback: > at org.python.core.Py.JavaError(Py.java:238) > at org.python.core.Py.findClassEx(Py.java:620) > ... > at java.lang.Thread.run(Thread.java:484) >Traceback (innermost last): > File "/home/akuchlin/src/mems/proto3/instrument/client/awt/MicroscopeApplet.py", line 0, in main > File "/home/akuchlin/src/mems/proto3/instrument/client/awt/PyClient.py", line 0, in main > File "/usr/local/jython-2.0/Lib/string.py", line 0, in main >java.lang.ClassFormatError: strop (Bad magic number) > >(Full traceback below, in case that information is useful.) >Inspecting the JAR file finds that strop.class isn't in it, Are you completely sure. If I create a file called "strop.class" in my cwd, I get the very same error: [d:\]\jython\jython-2.0-jdk14\jython.bat -S Jython 2.0 on java1.4.0-beta3 (JIT: null) >>> import string >>> ^Z [d:\]\jython\jython-2.0-jdk14\jython.bat -S Jython 2.0 on java1.4.0-beta3 (JIT: null) >>> f = open("strop.class", "w") >>> f.write("foobar") >>> f.close() >>> import string Traceback (innermost last): File "<console>", line 1, in ? File "d:\jython\jython-2.0-jdk14\Lib\string.py", line 418, in ? java.lang.ClassFormatError: strop (Bad magic number) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:512) at java.lang.ClassLoader.defineClass(ClassLoader.java:441) >but string.py should surely get an ImportError and continue running. Well yeah, but we have had huge problems in previous situation when we did catch java exceptions during import and tried to turn it into a python exception. And this is after all a java error, and as Javasoft say: """An Error is a subclass of Throwable that indicates serious problems that a reasonable application should not try to catch. Most such errors are abnormal conditions.""" >The >same error occurs with both the Sun and IBM JVMs. Has anyone seen this >before? Anyone got a clue about its cause? Only that some old broken strop.class file is laying around somewhere on your CLASSPATH. Maybe it is in org/python/modules where the original strop.java was. regards, finn |
From: Andrew K. <aku...@me...> - 2001-12-18 15:40:25
|
On Tue, Dec 18, 2001 at 01:36:21PM +0000, Finn Bock wrote: >Are you completely sure. If I create a file called "strop.class" in my >cwd, I get the very same error: Pretty sure: ute awt>jar -t <microscope.jar |grep str string.class string$_PyInner.class org/python/core/PyReflectedConstructor.class ute awt> Hmm... the problem might be due to the bug described at http://developer.java.sun.com/developer/bugParade/bugs/4196224.html; the JDK doesn't find a .class file in the JAR, tries to download it using HTTP, doesn't find it, and reports the 'bad magic number' error. That explains why it only shows up when running as an applet. (However, it also shows up with IBM's 1.3 JDK; oh dear...) A workaround is to edit string.py to not try importing strop. Maybe string.py should only try to import strop in CPython. --amk |