嵌入式Jython中的标准库

时间:2015-11-30 11:50:36

标签: java python jython

我有嵌入式Jython的Java服务器应用程序。旧的Jython 2.3一切正常,但最近发布了一个2.7版本,所以现在我试图升级。首先,我将旧的jython 2.3 jar与新的jar交换,而不是将lib脚本更改为Jython 2.7安装包中的脚本。使用这样的启动设置,我的应用程序写入日志错误,模块_jythonlib和_bytecodetools无法在jythonlib.py中找到。我能够纠正这两个方面的变化:

from _jythonlib import *
import _bytecodetools as bytecodetools

这些行:

from org.python.modules._jythonlib._jythonlib import *
import org.python.modules._bytecodetools as bytecodetools

不幸的是,日志中出现了另一个错误:

  File ".\storage\scripting\lib\random.py", line 43, in <module>
    from warnings import warn as _warn
  File ".\storage\scripting\lib\warnings.py", line 6, in <module>
    import linecache
  File ".\storage\scripting\lib\linecache.py", line 11, in <module>
    import os
  File ".\storage\scripting\lib\os.py", line 432, in <module>
    import UserDict
  File ".\storage\scripting\lib\UserDict.py", line 83, in <module>
    import _abcoll
  File ".\storage\scripting\lib\_abcoll.py", line 33, in <module>
    class Hashable:
  File ".\storage\scripting\lib\abc.py", line 99, in __new__
    cls._abc_registry = WeakSet()
  File ".\storage\scripting\lib\_weakrefset.py", line 21, in __new__
    return set_builder(_build, cls)(data)
java.lang.NoSuchMethodError: org.python.core.PySetDerived.<init>(Lorg/python/core/PyType;Ljava/util/Set;Lorg/python/core/PyObject;)V

你知道如何解决这个问题吗?

0 个答案:

没有答案