Closed epubreader closed 1 year ago
Seems to be related to #755.
Can you post your classpath please? Did you include ALL of the EpubCheck dependencies inyour project?
I am using spring boot, run the program in the jar file, java -jar app.jar
jar:file:/app.jar!/BOOT-INF/lib/epubcheck-4.0.2.jar!/com/adobe/epubcheck/schema/30/./multiple-renditions/container.rnc
ResourceUtil
public static String getResourcePath(String localName) {
String classPath = ResourceUtil.class.getName().replace('.', '/');
String classPackage = classPath.substring(0, classPath.lastIndexOf("/"));
String projectPackage = classPackage.substring(0, classPackage.lastIndexOf("/"));
return projectPackage + "/" + localName;
}
You did not include the EpubCheck dependencies in your classpath.
If you download EpubCheck ZIP from the releases page https://github.com/IDPF/epubcheck/releases/tag/v4.0.2 you will find a lib/
folder with 13 jar libraries packed along with epubcheck.jar
. All those libs need to be placed in your classpath.
Closing this as invalid because it's a configuration error.
I am using maven, it is fine run in intellij,
<dependency>
<groupId>org.idpf</groupId>
<artifactId>epubcheck</artifactId>
<version>4.0.2</version>
</dependency>
but after spring boot generate the fat jar app.jar with all the dependencies, it has this problem, I think it is not the classpath problem.
I'm not familiar with Spring, but it seems as if the FatJar does not contain all the epubcheck resources.
Can you check that the fatjar contains the schemas app.jar -> com/adobe/epubcheck/schema/30/
?
If not, the problem is your fatjar processing.
I ran into the exact same issue and haven't found a solution yet.
I checked for the schemas and they are indeed included in the application jar but apparently spring boot is unable to find them.
Okay, I reopened the issue and someone has to review it and reproduce and debug it. Unfortunately it cannot be me, sorry.
@ctriebstein could you please post your classpath and make sure that all the EpubCheck dependencies are loaded? Probably make sure that the dependencies load before EpubCheck classes?
I added the classpath to the attached file. Dependencies are loaded properly.
For some more information: I'm using a custom implementation of the Report class which I just updated from the 3.0.1 version to 4.0.2. The error occurs when calling the epubCheck.validate() method with the custom report.
If you need any code snippets, let me know.
Additional Info: One of my recent changes was the update from spring boot 14.1-RELEASE to 1.5.1-RELEASE. I just tried a little something and reverted the version to 1.4.1-RELEASE and now it works as intended. Might be a spring boot issue with 1.5.1-RELEASE.
it is because it is a nested jar, the below code will throw fileNotFoundException
@Test
public void submittingForm() throws Exception {
URL url = new URL("jar:file:/D:/eclipse/web/target/web-0.0.1-SNAPSHOT.jar!/BOOT-INF/lib/epubcheck-4.0.2.jar!/com/adobe/epubcheck/schema/20/rng/container.rng");
url.openStream();
}
and please check the code XMLValidator
Is this still an issue? To be honest I'm not sure I fully understand the problem here. If this is still causing trouble, could anyone rephrase the issue or provide a clear way to reproduce? Thanks!
Reproduced with spring boot 1.4.4.RELEASE and 1.4.7.RELEASE. Works well with 1.5.19.RELEASE.
Closing (inactive).
the same jar run on windows is fine, but has problem on linux server.