Message11887

Author EhWhoAmI
Recipients EhWhoAmI
Date 2018-04-10.22:21:53
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1523398915.42.0.682650639539.issue2666@psf.upfronthosting.co.za>
In-reply-to
Content
If I import a java class into jython, then import a class within a package that is the same name of the class, it comes up with a java.lang.NoClassDefFoundError. Only happens in a situation like that. If I don't import that, it does not fail.

Here's an example
Output:

jythonbug.test.testing()
Exception in thread "main" Traceback (most recent call last):
  File "<string>", line 1, in <module>
java.lang.NoClassDefFoundError: jythonbug/test (wrong name: jythonbug/Test)
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
	at java.net.URLClassLoader.defineClass(URLClassLoader.java:455)
	at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:367)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:411)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:340)
	at org.python.core.Py.loadAndInitClass(Py.java:991)
	at org.python.core.Py.findClassInternal(Py.java:926)
	at org.python.core.Py.findClassEx(Py.java:977)
	at org.python.core.packagecache.SysPackageManager.findClass(SysPackageManager.java:133)
	at org.python.core.packagecache.PackageManager.findClass(PackageManager.java:33)
	at org.python.core.packagecache.SysPackageManager.findClass(SysPackageManager.java:122)
	at org.python.core.PyJavaPackage.__findattr_ex__(PyJavaPackage.java:134)
	at org.python.core.PyObject.__findattr__(PyObject.java:946)
	at org.python.core.PyObject.impAttr(PyObject.java:1084)
	at org.python.core.imp.import_next(imp.java:842)
	at org.python.core.imp.import_logic(imp.java:904)
	at org.python.core.imp.import_module_level(imp.java:978)
	at org.python.core.imp.importName(imp.java:1062)
	at org.python.core.ImportFunction.__call__(__builtin__.java:1280)
	at org.python.core.PyObject.__call__(PyObject.java:431)
	at org.python.core.__builtin__.__import__(__builtin__.java:1232)
	at org.python.core.imp.importOne(imp.java:1081)
	at org.python.pycode._pyx2.f$0(<string>:1)
	at org.python.pycode._pyx2.call_function(<string>)
	at org.python.core.PyTableCode.call(PyTableCode.java:167)
	at org.python.core.PyCode.call(PyCode.java:18)
	at org.python.core.Py.runCode(Py.java:1386)
	at org.python.core.Py.exec(Py.java:1430)
	at org.python.util.PythonInterpreter.exec(PythonInterpreter.java:267)
	at jythonbug.Jythonbug.main(Jythonbug.java:17)

java.lang.NoClassDefFoundError: java.lang.NoClassDefFoundError: jythonbug/test (wrong name: jythonbug/Test)

However, when you comment lines 13 and 14 in JythonBug.java, the import passes.
History
Date User Action Args
2018-04-10 22:21:55EhWhoAmIsetrecipients: + EhWhoAmI
2018-04-10 22:21:55EhWhoAmIsetmessageid: <1523398915.42.0.682650639539.issue2666@psf.upfronthosting.co.za>
2018-04-10 22:21:55EhWhoAmIlinkissue2666 messages
2018-04-10 22:21:53EhWhoAmIcreate