Jython 2.7.2中提示URI is not hierarchical怎么办
发表于:2026-11-02 作者:千家信息网编辑
千家信息网最后更新 2026年11月02日,这篇文章主要为大家展示了"Jython 2.7.2中提示URI is not hierarchical怎么办",内容简而易懂,条理清晰,希望能够帮助大家解决疑惑,下面让小编带领大家一起研究并学习一下"
千家信息网最后更新 2026年11月02日Jython 2.7.2中提示URI is not hierarchical怎么办
这篇文章主要为大家展示了"Jython 2.7.2中提示URI is not hierarchical怎么办",内容简而易懂,条理清晰,希望能够帮助大家解决疑惑,下面让小编带领大家一起研究并学习一下"Jython 2.7.2中提示URI is not hierarchical怎么办"这篇文章吧。
1 .背景
由于需要使用Jython。但是发现一个诡异的现象IDE使用没有问题,但是打包jar报错。
Properties props = new Properties(); props.put("python.home","D:\\jython2.7.2"); props.put("python.path","D:\\jython2.7.2\\Lib\\site-packages"); props.put("python.console.encoding", "UTF-8"); // Used to prevent: console: Failed to install '': java.nio.charset.UnsupportedCharsetException: cp0. props.put("python.security.respectJavaAccessibility", "false"); //don't respect java accessibility, so that we can access protected members on subclasses props.put("python.import.site","false"); //props.put("python.cachedir.skip","true"); props.put("org.python.netty.noUnsafe","true"); Properties preprops = System.getProperties(); PythonInterpreter.initialize(preprops, props, new String[0]);// 此处报异常 PythonInterpreter pyInterp = new PythonInterpreter();java.lang.IllegalArgumentException: URI is not hierarchical at java.io.File.(File.java:418) at org.python.core.PrePy.getJarFileNameFromURL(PrePy.java:427) at org.python.core.PrePy._getJarFileName(PrePy.java:362) at org.python.core.PrePy.getJarFileName(PrePy.java:345) at org.python.core.PySystemState.doInitialize(PySystemState.java:1195) at org.python.core.PySystemState.initialize(PySystemState.java:1130) at org.python.core.PySystemState.initialize(PySystemState.java:1085) at org.python.core.PySystemState.initialize(PySystemState.java:1080) at org.python.util.PythonInterpreter.initialize(PythonInterpreter.java:63) at com.langtutu.ncs.api.robot.core.Test. (Test.java:34) at com.langtutu.ncs.api.service.impl.HomestaySchedulingServiceImpl.DownOrderTest(HomestaySchedulingServiceImpl.java:90) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:84) at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:93) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
2. 问题查找
使用IDE和远程调用分别调试跟踪了一下jython,定位到代码报错行:
IDE调试 发现url是如下的:
jar:file:/D:/maven/apache-maven-3.3.9/repository/org/python/jython/2.7.2/jython-2.7.2.jar!/org/python/core/PrePy.class远程调试

嵌套不能用。
3. 解决方案:
maven打包时候将jython剔除;运行时候加载外部jar包即可。
剔除:
org.springframework.boot spring-boot-maven-plugin 2.2.10.RELEASE ZIP org.python
运行:
java -Dloader.path="lib/" -jar .\ncsapi-0.0.1-SNAPSHOT.jar
lib里面就是jar包。此时运行完全正常
以上是"Jython 2.7.2中提示URI is not hierarchical怎么办"这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注行业资讯频道!
怎么办
提示
内容
篇文章
运行
时候
问题
学习
帮助
诡异
代码
就是
方案
易懂
更多
条理
现象
知识
编带
背景
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
小米移动互联网科技园
互联网科技巨头监管
科技企业和互联网企业
金融科技创新监管互联网金融
极限挑战互联网科技
互联网科技小额贷款
科技互联网创业计划书
互联网金融和金融科技
互联网巨头投资的硬核科技
恒生科技互联网指数分析
广州慧亚互联网科技怎么样
佳云科技和互联网广告
洛阳昕诺飞互联网科技有限公司
畅思互联网科技
佛山市翊博互联网络科技有限公司
济南有互联网科技公司吗
上海创道互联网络科技有限公司
郑州欣桑互联网科技有限公司
互联网科技接地气
上海万顺科技互联网有限公司招聘
中智农互联网科技
互联网和科技技术
上海致骋互联网科技
猫创互联网科技
左右互联网络科技
银川新华互联网科技职业技术培训学校图片
畅思互联网科技
乌鲁木齐新华智原互联网科技学校
郑州欣桑互联网科技有限公司
神州科技互联网有限公司