Due to the need to use Jython. However, a strange phenomenon is found. There is no problem with the use of IDE, but the error is reported when packaging the jar.
java.lang.IllegalArgumentException: URI is not hierarchical
at java.io.File.<init>(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.<init>(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. Problem finding
Debug and trace Jython using IDE and remote call respectively, and locate the error line of the code:
IDE debugging found that the URL is as follows: 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
Remote debugging
Nesting cannot be used.
3. Solution:
Jython will be Deleted when Maven is packaged; Just load the external jar package at runtime.
eliminate:
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.2.10.RELEASE</version>
<configuration>
<layout>ZIP</layout>
<!--Removing dependencies that do not change in the production environment are separated by commas,-->
<excludeGroupIds>
org.python
</excludeGroupIds>
</configuration>
</plugin>
</plugins>
</build>
function:
java -Dloader.path="lib/" -jar .\ncsapi-0.0.1-SNAPSHOT.jar
Inside lib is the jar package. At this time, the operation is completely normal
Read More:
- Mybatis Plus update time error: Could not set property ‘updateTime’
- [Solved] ERROR PythonRunner: Python worker exited unexpectedly (crashed)
- AttributeError: module ‘time‘ has no attribute ‘clock‘ [How to Solve]
- [Solved] mmdet install error: ERROR: Could not build wheels for pycocotools
- [Solved] Ubuntu18.04 Install pyqt5 error: Command “python setup.py egg_info“ failed with error code 1 in /tmp/pip-build-92
- [Solved] Pytorch c++ Error: Error checking compiler version for cl: [WinError 2] System cannot find the specified file.
- [Solved] error: OpenCV(4.5.2) :-1: error: (-5:Bad argument) in function ‘copyMakeBorder‘
- [Solved] TVM operate error: TVMError: AssertionError
- Python Fatal error: Py_Initialize: unable to load the file system codec
- Command “/usr/bin/python -u -c “import setuptools, tokenize;__file__=‘/tmp/pip-cus9V0-build/setup.py
- BlazingSQL Error: AttributeError: module ‘cio‘ has no attribute ‘RunQueryError‘
- How to Solve Python ImportError: cannot import name UnrewindableBodyError
- [Solved] ModuleNotFoundError: No module named ‘_polyiou‘
- [Solved] flash initializate database error: Keyerror: ‘migrate’
- Python Error: OSError: cannot open resource [How to Solve]
- [Solved] Pygame.error: mixer not initialized & pygame.error: WASAPI can‘t find requested audio endpoint: Could not Find the Element.
- [Solved] AttributeError: ‘Manager‘ object has no attribute ‘get_by_natural_key‘
- [Solved] Pdfplumber Read PDF Sheet Error: AttributeError: function/symbol ‘ARC4_stream_init‘ not found in library
- Djangorestframework-simplejwt: ‘str‘ object has no attribute ‘decode‘ [Solved]
- Gunicorn Flask Error: [ERROR] Socket error processing request