[JAVA] Error in implementation when implementing Spring validation

Validation implementation error in spring

environment

pom.xml


<properties>
	<!-- Generic properties -->
	<java.version>1.7</java.version>
	<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
	<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

	<!-- Web -->
	<jsp.version>2.2</jsp.version>
	<jstl.version>1.2</jstl.version>
	<servlet.version>3.1.0</servlet.version>


	<!-- Spring -->
	<spring-framework.version>3.2.3.RELEASE</spring-framework.version>

	<!-- Hibernate / JPA -->
	<hibernate.version>4.2.1.Final</hibernate.version>

	<!-- Logging -->
	<logback.version>1.0.13</logback.version>
	<slf4j.version>1.7.5</slf4j.version>

	<!-- Test -->
	<junit.version>4.11</junit.version>
</properties>

Procedure until an error occurs at the time of implementation

Added two jar files to pom.xml

pom.xml


<!-- validation-api(Used for input value verification) -->
<dependency>
    <groupId>javax.validation</groupId>
    <artifactId>validation-api</artifactId>
    <version>1.1.0.Final</version>
</dependency>
<!-- Hibernate(Used for input value verification) -->
<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-validator</artifactId>
    <version>5.0.1.Final</version>
</dependency>

Two errors appear

1, Servlet init () error

HTTP status 500-Servlet dispatcher Servlet Servlet.init()Threw an exception
type exception report
------------------------------------------------------------------------------------------

Message Servlet dispatcherServlet Servlet.init()Threw an exception

Description The server encountered an internal error that prevented it from fulfilling this request.

exception-------------------------------------------------------------------------------------------

javax.servlet.ServletException:Servlet dispatcher Servlet Servlet.init()Threw an exception
	org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
	org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)
	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:436)
	org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1078)
	org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)
	org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
	java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	java.lang.Thread.run(Thread.java:745)

<!--Omitted below-->

2, @NotEmpty cannot be used

Error resolution

The cause is related to the version of the added jar file If you change pom.xml and update the project again, both will be resolved

pom.xml


<!-- validation-api(Used for input value verification) -->
<dependency>
    <groupId>javax.validation</groupId>
    <artifactId>validation-api</artifactId>
    <version>2.0.1.Final</version>
</dependency>
<!-- Hibernate(Used for input value verification) -->
<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-validator</artifactId>
    <version>5.3.4.Final</version>
</dependency>

!!! The error disappeared, but I can't use it !!!

This time I understood that it was related to the version, but I did not reach a fundamental solution, so I will reconsider it at another time

Recommended Posts

Error in implementation when implementing Spring validation
About error when implementing spring validation
Spring validation and error code
Error in Spring database connection
[Rails] Unexpected validation error in devise
Error encountered in tagging function implementation
Unknown error in line 1 of pom.xml when using Spring Boot in Eclipse
Javaw.exe error when starting Spring Boot (STS)
Error in bundle install when running rails new
[Rails] Solution when migration error occurs in acts-as-taggable-on
Implementation sample when Form authentication and Request-Header authentication are used together in Spring Security
When you want to notify an error somewhere when using graphql-spring-boot in Spring Boot
Spring --Error / Error avoidance when creating API for POST
Difficulties when implementing Alarm Manager in Android Studio
MySQL error in Spring Unknown column'Value 1'in'field list'
Customize the display when an error such as 404 Not Found occurs in Spring Boot
When Spring Batch is executed continuously in Oracle, ORA-08177
Syntax error when including HTML tags in Draper + create.js.erb
Inject Logger in Spring
Interpreter implementation in Java
Error when using SnapKit
Boyer-Moore implementation in Java
Use Interceptor in Spring
Error when bundle install
Heapsort implementation (in java)
Microservices in Spring Cloud
Self-made Validation with Spring
Error handling in Graphql-ruby
Error when deploying EC2
Get cookies in Spring
Resolve CreateProcess error = 206 when running Java in a Windows environment
When an error occurs even though validation is not set
Minimal customization of Spring Boot error page (implementation of ErrorController interface)
How to resolve Missing Template error when implementing comment function
Get error information using DefaultErrorAttributes and ErrorAttributeOptions in Spring Boot 2.3
A validation error occurred when saving to the intermediate table.
An error occurs when codedeploy-agent is installed in Ubuntu Server 20.04
Show detailed error in Logger when running Java on server