PlanX-Universe / sh

The SH Planning System designed to tackle complex planning problems utilizing the principles of HTN planning.
MIT License
1 stars 1 forks source link

FileNotFoundException when trying to run the example shown in the README #1

Open gianzav opened 3 weeks ago

gianzav commented 3 weeks ago

I'm trying to run the example that is provided in the README, but I'm having some trouble. Inside a Docker container built with the image sbtscala/scala-sbt:eclipse-temurin-17.0.4_1.7.1_3.2.0 I did the following:

The exception I got is

java.io.FileNotFoundException: file:/root/sh/target/bg-jobs/sbt_b21abe05/job-1/target/b09fff27/a2f9aa44/sh-planning-system_2.11-2.0.0.jar!/repository/deployment/deployment.hpdl (No such file or directory)

which is weird since the file exists in repository.

Could this problem be related to the JDK/Scala/Sbt version I'm using or am I doing something wrong during the process?

ilche commented 2 weeks ago

Thanks for reporting this issue!

It looks like the problem is due to how the code is accessing the file. Currently, it’s trying to load it as a regular file, which won’t work when the resource is inside a JAR. Instead, we should load resources from the classpath so that they can be used within a JAR.

As a temporary solution, you could try placing the .hpdl files on the filesystem at a known path and modify the code to point directly to it for now. This should allow the example to run in your Docker setup.

To properly fix this, we need to replace FIle operations with getResourceAsStream() to access resources within a JAR. I’ll look into adding this fix in a future update, but hopefully, the workaround above helps you get up and running dockerized SH for now.