[Java] java.lang.NoClassDefFoundError: Addressing the problem of falling in org / jsoup / safety / Whitelist

problem

When I tried to test if the annotation was responding with the following code, it failed with java.lang.NoClassDefFoundError: org / jsoup / safety / Whitelist when calling the validate method.

Set<ConstraintViolation<Tested class>> set =
                    Validation.buildDefaultValidatorFactory().getValidator().validate(Instance to be tested);

Cause

The class under test was using the annotations defined in ʻorg.hibernate.validator.constraintsand the internaljsoup` was not properly placed.

Countermeasures

I added the following to Maven and it works fine.

pom.xml


<dependency>
    <groupId>org.jsoup</groupId>
    <artifactId>jsoup</artifactId>
    <version>1.11.3</version>
</dependency>

Articles that I used as a reference

bean validation - Hibernate Validator @SafeHtml: org.jsoup.safety.Whitelist not found - Stack Overflow

Recommended Posts

[Java] java.lang.NoClassDefFoundError: Addressing the problem of falling in org / jsoup / safety / Whitelist
Get the result of POST in Java
The story of writing Java in Emacs
The story of low-level string comparison in Java
[Java] Handling of JavaBeans in the method chain
The story of making ordinary Othello in Java
About the idea of anonymous classes in Java
The story of learning Java in the first programming
Measure the size of a folder in Java
Feel the passage of time even in Java
Import files of the same hierarchy in Java
Get the URL of the HTTP redirect destination in Java
About the problem of deadlock in parallel processing in gem'sprockets' 4.0
[Java] Get the file in the jar regardless of the environment
Change the storage quality of JPEG images in Java
Think about the JAVA = JAVAscript problem (needed in the future)
Summarize the additional elements of the Optional class in Java 9
A quick explanation of the five types of static in Java
Count the number of digits after the decimal point in Java
Java: The problem of which is faster, stream or loop
How to derive the last day of the month in Java
Explanation of the FizzBuzz problem
Implementation of gzip in java
Implementation of tri-tree in Java
Examine the system information of AWS Lambda operating environment in Java
Output the difference between each field of two objects in Java
Find out the list of fonts available in AWS Lambda + Java
Examine the list of timezone IDs available in the Java ZoneId class
Get the public URL of a private Flickr file in Java
Problem that the attribute of User model becomes nil in ActionMailer
Let's create a TODO application in Java 5 Switch the display of TODO
How to get the length of an audio file in java
How to increment the value of Map in one line in Java