tryingHard
tryingHard

Reputation: 2084

Camel validate against file from classpath

I want to validate xml against schema - using SpringBoot 2 and camel 3.

On localhost this works:

.to("validator:file:src/main/resources/D.xsd")

But when uploaded to server on tomcat machine with context for example D - i get an error:

Caused by: java.io.FileNotFoundException: src/main/resources/D.xsd (No such file or directory)

I think that i need to change the path to use classpath - but i am not sure how to make it work ?

What i tried:

.to("validator:file:classpath:/src/main/resources/D.xsd")
.to("validator:file:resource:classpath:src/main/resources/D.xsd")
.to("validator:file:resource:classpath:/src/main/resources/D.xsd")

But it does not work.

Upvotes: 0

Views: 970

Answers (2)

tryingHard
tryingHard

Reputation: 2084

I've managed to fix it with:

.to("validator:D.xsd")

Upvotes: 0

burki
burki

Reputation: 7005

In one of my applications (but with SpringBoot 1.5 and Camel 2.x) this works fine

.to("validator:classpath:folder/filename.xsd")

to validate against filename.xsd that is located in src/main/resources/folder

Upvotes: 1

Related Questions