Closed vlio20 closed 5 years ago
did you set static files location as per http://sparkjava.com/documentation#static-files
Sure, it works as expected when running via intellij
I cannot help with maven, but I have no problems creating fatjars using gradle shadow plugin. And then using files from the resource folder.
There are number of reported bugs with sparkjava, where multiple jetty servers cannot be spawned with their own static folders (due to spark using global/static variables for directory config, and then not isolating them per thread). However I doubt that you are running into that issue yet.
@vlio20 The problem doesn't seem to be due to multiple jetty servers sharing the same static folder (which has been fixed and will be available in next release).
It's hard to say anything without getting more information on the code configuring the static files location and the structure of that folder etc.
@vlio20
I use Jolira one jar for that. Works like a charm for me.
<build>
<plugins>
<plugin>
<groupId>com.jolira</groupId>
<artifactId>onejar-maven-plugin</artifactId>
<version>1.4.4</version>
<executions>
<execution>
<configuration>
<mainClass>hu.orfeous.demo.Application</mainClass>
</configuration>
<goals>
<goal>one-jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
Hi, I am trying to create a runnable jar for the application, here is how I set my maven file (only relevant part):
I am building with
mvn package
and then I am runningjava -jar target/org.oogaday.api-1.0-SNAPSHOT-jar-with-dependencies.jar
in order to run the app.All endpoints are served as expected, the only problem is with the static files: when trying to access the static files the following stack trace is thrown:
Any idea why this can happen? (I have unzipped the jar and I see the static files in the resources folder as expected)