首页 / 浏览问题 / 组件GIS / 问题详情
iobjectspy docker内安装
4EXP 2023年09月14日
我尝试在docker容器中安装iobjectspy,但是不太清楚它依赖的python版本,另外iobjectjava导入有问题,以及许可的设置要怎样设置,能解答一下吗?

1个回答

您好,iObjects Python 组件包解压后可从 iobjectspy 目录下看到目前支持的 python 版本,如下图所示:

关于 iObjects Java 组件的导入问题,请详细描述具体遇到了什么问题,以便我们根据具体的问题情况和异常信息分析问题原因;

关于 iObjects 组件的许可配置说明,建议参考 iObjects 组件 help 目录下的帮助文档,里面有详细说明,如下图所示:

希望可以帮到您。

2,168EXP 2023年09月14日

好的,我这里iobjectspy安装是正常的,但是设置iobjectspy.set_iobjects_java_path之后,会出现报错,执行iobjectspy.Workspace()后,报错为

Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/threading.py", line 926, in _bootstrap_inner
    self.run()
  File "D:\BuildAgent\work\test_master/iobjectspy/_jsuperpy\_gateway.py", line 115, in run
  File "/usr/local/lib/python3.7/subprocess.py", line 800, in __init__
    restore_signals, start_new_session)
  File "/usr/local/lib/python3.7/subprocess.py", line 1567, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'java': 'java'

咱们的iobjectspy是基于py4j中间件实现,所以依赖与iobjects java组件环境,同时也需要jdk。

报错提示是指启动py4j中间件服务时未找到java命令,需要确认以下环境,按走配置:

1、docker容器里配置jdk环境,jdk配置到系统环境变量path中;

2、docker容器配置iobjects java组件,将其bin目录路径配置到系统环境变量path中 ;当然也可以将iobjects java组件解压放入容器固定目录中 /opt/SuperMap/iobjects/1110/Bin;路径的数字1110是版本号,依据实际版本号改下。

3、根据docker容器id申请试用许可,放入容器的固定目录/opt/SuperMap/License目录下。

注:固定目录是我们jar包写死的路径,默认会从固定目录找环境依赖包,其次通过系统环境变量path找依赖包。

如果依赖的环境都配置到宿主机的话,那么可以将宿主机的环境目录映射到容器里。

配置好JDK环境后还是会报错,信息为:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/py4j/java_gateway.py", line 985, in send_command
    response = connection.send_command(command)
  File "/usr/local/lib/python3.7/site-packages/py4j/java_gateway.py", line 1164, in send_command
    "Error while receiving", e, proto.ERROR_ON_RECEIVE)
py4j.protocol.Py4JNetworkError: Error while receiving
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "D:\BuildAgent\work\test_master/iobjectspy/_jsuperpy\data\ws.py", line 382, in __new__
  File "D:\BuildAgent\work\test_master/iobjectspy/_jsuperpy\data\_jvm.py", line 6, in __init__
  File "D:\BuildAgent\work\test_master/iobjectspy/_jsuperpy\_gateway.py", line 280, in get_jvm
  File "D:\BuildAgent\work\test_master/iobjectspy/_jsuperpy\_gateway.py", line 227, in gateway
  File "D:\BuildAgent\work\test_master/iobjectspy/_jsuperpy\env.py", line 235, in _set_all_to_java
  File "/usr/local/lib/python3.7/site-packages/py4j/java_gateway.py", line 1598, in __getattr__
    raise Py4JError("{0} does not exist in the JVM".format(new_fqn))
py4j.protocol.Py4JError: com.supermap.data.Environment does not exist in the JVM

从报错提示py4j.protocol.Py4JError: com.supermap.data.Environment does not exist in the JVM分析:

iobjects java组件的bin目录环境变量没找到,导致对应的依赖未找到。
哦哦,是配置到系统环境变量PATH里面就行吗?我这里PATH是:/javaHome/Bin:/usr/lib/jvm/jdk1.8.0_381/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
...