Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validator does not work correctly when packaged as jar within other application #28

Closed
JannickWeisshaupt opened this issue Mar 27, 2019 · 6 comments
Assignees
Milestone

Comments

@JannickWeisshaupt
Copy link

Following situation:
I use the Kosit Validator as library within another application, which is packaged as jar. The scenario and xsl files are included in the jar as resource files. I specified the URI to the scenario correctly so that the scenario file within the jar is used. When the Validator is build it tries to load the xsl files, which are specified in the scenario file. The constructor fails because the URI cannot be resolved
The error is file not found because line 117 in ContentRepository is not correctly working
return new StreamSource(this.repository.resolve(source).toASCIIString());

@apenski
Copy link
Collaborator

apenski commented May 6, 2019

This is a known limitation and we plan to support loading scenario-content from a jar file.
However, since JAR-URIs fail to resolve relative paths correctly, it is not as easy as 'return a correct stream source in ContentRepository'. This would result in errors loading transitive resources like references schema files.

@apenski
Copy link
Collaborator

apenski commented May 8, 2019

I prepared a branch with this. This must be testet now. Beta testers welcome!

I should be sufficient to provide a valid JAR-URI to initialize ContentRepository and/or ScenarioRepository.

@AM-csx
Copy link

AM-csx commented Jun 19, 2019

Unfortunately, we have the same problem with all previous releases. It also doesn't work with your development branch.

First some details about our use case and the technical implementation:

  • We want to use the KoSIT validator as a library.
  • Our actual application is a Spring Boot application.
  • We get the "KoSIT validator"-library as dependency in Maven.
  • For each configuration version of the XRechnung (https://github.com/itplr-kosit/validator-configuration-xrechnung/releases) we have its own subfolder in our resource folder of our Spring Boot application.

Here is a snippet with the concrete example (It is relatively easy to reproduce.): https://gist.github.com/AM-csx/63f63c5166345cb398ddcb3a90287037

When we launch the application from our development environment, everything works fine because our application is still "exploded":
KositValidationDemoApplication_succesful_from_intellij

If we build our Spring Boot application now as executable JAR (mvn package) and start it, we get the following errors during the initialization:
KositValidationDemoApplication_failed_from_jar.log

@apenski
Copy link
Collaborator

apenski commented Jun 20, 2019

Thanks for beta testing the branch. Actual I missed the default deduction of the repository location when not configured explicitly. I created a fix in 3edb23b and was successfull loading the resources with your snippet.

Can you please test the branch again (moved to this repo)

@AM-csx
Copy link

AM-csx commented Jun 25, 2019

Thank you for the quick reaction :)

I can confirm that this issue has been resolved with this branch 👍

What are your release plans for a new Validator version? Can you give an approximate time frame?

@apenski
Copy link
Collaborator

apenski commented Jun 28, 2019

we plan to release within July. The branch is merged to the master now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants