Reputation: 35
I am trying to check the validate json schema using karate and I am facing this:
java.lang.RuntimeException: javascript evaluation failed: Java.type('com.intuit.karate.demo.util.SchemaUtils'), java.lang.ClassNotFoundException: com.intuit.karate.demo.util.SchemaUtils
My pom dependencies are :
<dependency>
<groupId>com.intuit.karate</groupId>
<artifactId>karate-apache</artifactId>
<version>${karate.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.intuit.karate</groupId>
<artifactId>karate-junit4</artifactId>
<version>${karate.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.masterthought</groupId>
<artifactId>cucumber-reporting</artifactId>
<version>3.8.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.java-json-tools</groupId>
<artifactId>json-schema-validator</artifactId>
<version>2.2.8</version>
</dependency>
</dependencies>
Feature file syntax and json files locations
Can any one please suggest how to fix this ?
Upvotes: 1
Views: 2174
Reputation: 11
I removed this dependency, and all was working fine.
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.16.22</version>
</dependency>
Upvotes: 1
Reputation: 4239
SchemaUtils is a class available in karate-demo which is not packed with karate-core,
so if you want to use the SchemaUtils copy that class and keep it inside you project and provide the correct package path for java interop
eg,
Java.type('<your new package>.SchemaUtils')
Upvotes: 2
Reputation: 111
please provide full stack trace information, as well as sourcecode. Does you project even have this package "com.intuit.karate.demo.util.SchemaUtils" (don't know if it is included by default in the library)
Edit:
Bad coding habits aside: you can go script kiddy mode, grab the com.intuit.karate.demo.util.SchemaUtils -package from the demo real, and then you probably won't get your error anymore. As pointed out, you probably misunderstod how to use the library. You are probably calling functions from the tutorial / demo, which of course don't exist in your project.
Upvotes: 1