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:
- To silence this warning, use `float` by itself. Doing this will not modify any behavior and is safe.
- [PHP] Solve PHP Fatal error: Call to undefined function mcrypt_get_iv_size()
- Python Selenium: element is not attached to the page document error
- [Solved] Pytorch Tensor to numpy error: RuntimeError: Can‘t call numpy() on Tensor that requires grad.报错
- [Solved] python-sutime Error: the JSON object must be str, bytes or bytearray, not ‘java.lang.String‘
- NameError: name ‘xrange‘ is not defined [How to Solve]
- [Solved] Error starting proxy server: oserror (10013), “an attempt was made to access the socket in a way that the access permission is not allowed.”, None, 10013, None)
- Python error: ‘int’ object is not callable
- [Solved] Cv2.imshow Error: window.cpp:1274: error: (-2:Unspecified error) The function is not implemented.
- [Solved] Sklearn Call Error: DLL load failed while importing _arpack
- Python error collection: NameError: name ‘numpy’ is not defined
- [How to Fix]RuntimeError: Python is not installed as a framework, If you are using (Ana)Conda
- NameError: name “defaultParams“ is not defined [How to Solve]
- [Solved] Tensorflow Error: NameError: name ‘layers‘ is not defined
- Pychar: How to Fix using SQLite to report an error: java.lang.ClassNotFoundException
- “EncoderDecoder: ‘mit_b1 is not in the backbone registry‘“ [How to Solve]
- [Solved] bert_as_service startup error: Tensorflow 2.1.0 is not tested!
- [Solved] Pytorch call tensorboard error: AttributeError: module ‘tensorflow’ has no attribute ‘gfile’
- [Solved] TypeError: Object of type ‘bytes’ is not JSON serializable
- [Solved] RuntimeError (note: full exception trace is shown but execution is paused at: <module>)