Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Validator with validation.xml not working in Spring MVC
PostPosted: Sun Jan 03, 2016 9:32 am 
Newbie

Joined: Sat Jan 02, 2016 3:19 pm
Posts: 2
Hi all,

I was trying to integrate Hibernate validation on a Maven Spring MVC project, with annotation system it works flawlessly but if I try to put rules on a separate xml using validation.xml on classpath project it stops to work.

The only feedback it gives to me in logs is:
Code:
org.hibernate.validator.internal.xml.ValidationXmlParser.unmarshal HV000007: META-INF/validation.xml found. Parsing XML based configuration.


The project specs are:

Netbeans 8.1
JDK 1.8.0_65
SpringMVC 4.2.4
Tomcat 8.0.27.0
Hibernate Validator 5.2.2.Final

Image


here my validation.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<validation-config
    xmlns="http://jboss.org/xml/ns/javax/validation/configuration"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://jboss.org/xml/ns/javax/validation/configuration">

    <constraint-mapping>META-INF/vincoliModel.xml</constraint-mapping>

    <property name="hibernate.validator.fail_fast">false</property>

</validation-config>


vincoliModel.xml
Code:
<constraint-mappings
                    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                    xsi:schemaLocation="http://jboss.org/xml/ns/javax/validation/mapping validation-mapping-1.1.xsd"
                    xmlns="http://jboss.org/xml/ns/javax/validation/mapping" version="1.1">
       <default-package>com.studiosviluppo.springmvc</default-package>
       <bean class="model.User" ignore-annotations="true">
                <field name="name">
               <constraint annotation="javax.validation.constraints.Size">
                    <element name="min">1</element>
                         <element name="max">4000</element>
               </constraint>
                </field>
           <field name="surname">
               <constraint annotation="javax.validation.constraints.Size">
                    <element name="min">1</element>
                         <element name="max">4000</element>
                         <message>La lunghezza deve essere compresa fra 1 e 4000 caratteri</message>
               </constraint>
           </field>
                <field name="birthDate">
               <constraint annotation="org.springframework.format.annotation.DateTimeFormat">
                    <element name="pattern">dd/MM/yyyy</element>
                    </constraint>
           </field>
       </bean>
</constraint-mappings>


User.java (the model to validate)
Code:
package com.studiosviluppo.springmvc.model;

import java.util.Date;
import javax.validation.constraints.Size;


public class User {
   
    private Long id;
   
    private String name;
   
    private String surname;
   
    private Date birthDate;
   
    private Long id_job;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSurname() {
        return surname;
    }

    public void setSurname(String surname) {
        this.surname = surname;
    }

    public Date getBirthDate() {
        return birthDate;
    }

    public void setBirthDate(Date birthDate) {
        this.birthDate = birthDate;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getId_job() {
        return id_job;
    }

    public void setId_job(Long id_job) {
        this.id_job = id_job;
    }
   
}



MVC Controller
Code:
package com.studiosviluppo.springmvc.controller;

import com.studiosviluppo.springmvc.model.User;
import java.util.Map;
import javax.validation.Valid;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;


@Controller
@RequestMapping(value = "/utenteCon")
public class userControlloer {

    @RequestMapping(method = RequestMethod.GET)
    public String vediFormRegtistrazione(Map<String, Object> model) {
        User utente = new User();   
        model.put("utente", utente);
         
        return "registraUtente";
    }
     
    @RequestMapping(method = RequestMethod.POST)
    public String actionFormRegistrazione(@ModelAttribute("utente") @Valid User utente, BindingResult resultUtente,
            Map<String, Object> model
    ) {
         
         
        // for testing purpose:
        System.out.println("name: " + utente.getName());
        System.out.println("surname: " + utente.getSurname());
        System.out.println("birth date: " + utente.getBirthDate());
        if (resultUtente.hasErrors()) {
            return "registraUtente";
        } else {
            return "registrazioneUtenteOk";
        }
    }
}



Trying to solve it I noticed that

with validation.xml, annotations such as
Code:
    @Size(min = 2, max = 4000)
    private String name;

not work even if I set ignore-annotations="false"
and putting an inexistent file on
Code:
<constraint-mapping>META-INF/vincoliModelsadasdasd.xml</constraint-mapping>

not gives to me any file not found error or something else on logs.

Thanks


Top
 Profile  
 
 Post subject: Re: Validator with validation.xml not working in Spring MVC
PostPosted: Mon Jan 04, 2016 9:03 am 
Hibernate Team
Hibernate Team

Joined: Sat Jan 24, 2009 12:46 pm
Posts: 386
Quote:
and putting an inexistent file on Code [...] not gives to me any file not found error or something else on logs.


This one makes me curious, you should definitely see a meaningful exception in case your validation.xml references to a non-existing constraint mapping file. Are there multiple validation.xml files in your project by any chance and you are editing the wrong one? Could you double check you are editing the file which ends up as WEB-INF/classes/META-INF/validation.xml in your WAR?

--Gunnar

_________________
Visit my blog at http://musingsofaprogrammingaddict.blogspot.com/


Top
 Profile  
 
 Post subject: Re: Validator with validation.xml not working in Spring MVC
PostPosted: Mon Jan 04, 2016 5:52 pm 
Newbie

Joined: Sat Jan 02, 2016 3:19 pm
Posts: 2
Hi Gunnar,

thanks for your reply, I'm pretty sure of modifying the right file,

I would be very grateful to you if you could take a look to the project
http://www.fileconvoy.com/dfl.php?id=g5ca915604aed63ab9997683961e0bd6b88ff1bb18

or to the logs with validation.xml referencing a non-existing constraint mapping file
Code:
Using CATALINA_BASE:   "C:\Users\StudioSviluppo\AppData\Roaming\NetBeans\8.1\apache-tomcat-8.0.27.0_base"
Using CATALINA_HOME:   "C:\Program Files (x86)\Apache Software Foundation\Apache Tomcat 8.0.27"
Using CATALINA_TMPDIR: "C:\Users\StudioSviluppo\AppData\Roaming\NetBeans\8.1\apache-tomcat-8.0.27.0_base\temp"
Using JRE_HOME:        "C:\Program Files\Java\jdk1.8.0_65"
Using CLASSPATH:       "C:\Program Files (x86)\Apache Software Foundation\Apache Tomcat 8.0.27\bin\bootstrap.jar;C:\Program Files (x86)\Apache Software Foundation\Apache Tomcat 8.0.27\bin\tomcat-juli.jar"
04-Jan-2016 21:56:56.416 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version:        Apache Tomcat/8.0.27
04-Jan-2016 21:56:56.432 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built:          Sep 28 2015 08:17:25 UTC
04-Jan-2016 21:56:56.432 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number:         8.0.27.0
04-Jan-2016 21:56:56.432 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name:               Windows 7
04-Jan-2016 21:56:56.432 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version:            6.1
04-Jan-2016 21:56:56.432 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture:          amd64
04-Jan-2016 21:56:56.432 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home:             C:\Program Files\Java\jdk1.8.0_65\jre
04-Jan-2016 21:56:56.432 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version:           1.8.0_65-b17
04-Jan-2016 21:56:56.432 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor:            Oracle Corporation
04-Jan-2016 21:56:56.432 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE:         C:\Users\StudioSviluppo\AppData\Roaming\NetBeans\8.1\apache-tomcat-8.0.27.0_base
04-Jan-2016 21:56:56.432 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME:         C:\Program Files (x86)\Apache Software Foundation\Apache Tomcat 8.0.27
04-Jan-2016 21:56:56.432 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dhttp.nonProxyHosts=localhost|127.0.0.1|StudioSviluppoP
04-Jan-2016 21:56:56.432 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=C:\Users\StudioSviluppo\AppData\Roaming\NetBeans\8.1\apache-tomcat-8.0.27.0_base\conf\logging.properties
04-Jan-2016 21:56:56.432 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
04-Jan-2016 21:56:56.432 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.endorsed.dirs=C:\Program Files (x86)\Apache Software Foundation\Apache Tomcat 8.0.27\endorsed
04-Jan-2016 21:56:56.432 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=C:\Users\StudioSviluppo\AppData\Roaming\NetBeans\8.1\apache-tomcat-8.0.27.0_base
04-Jan-2016 21:56:56.432 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=C:\Program Files (x86)\Apache Software Foundation\Apache Tomcat 8.0.27
04-Jan-2016 21:56:56.432 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=C:\Users\StudioSviluppo\AppData\Roaming\NetBeans\8.1\apache-tomcat-8.0.27.0_base\temp
04-Jan-2016 21:56:56.432 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jdk1.8.0_65\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\oraclexe\app\oracle\product\11.2.0\server\bin;;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;.
04-Jan-2016 21:56:56.932 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8084"]
04-Jan-2016 21:56:57.151 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
04-Jan-2016 21:56:57.151 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
04-Jan-2016 21:56:57.151 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
04-Jan-2016 21:56:57.151 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 1411 ms
04-Jan-2016 21:56:57.276 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service Catalina
04-Jan-2016 21:56:57.276 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.0.27
04-Jan-2016 21:56:57.307 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDescriptor Deploying configuration descriptor C:\Users\StudioSviluppo\AppData\Roaming\NetBeans\8.1\apache-tomcat-8.0.27.0_base\conf\Catalina\localhost\manager.xml
04-Jan-2016 21:56:58.151 INFO [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
04-Jan-2016 21:56:58.338 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDescriptor Deployment of configuration descriptor C:\Users\StudioSviluppo\AppData\Roaming\NetBeans\8.1\apache-tomcat-8.0.27.0_base\conf\Catalina\localhost\manager.xml has finished in 1,016 ms
04-Jan-2016 21:56:58.338 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDescriptor Deploying configuration descriptor C:\Users\StudioSviluppo\AppData\Roaming\NetBeans\8.1\apache-tomcat-8.0.27.0_base\conf\Catalina\localhost\mavenMVCMyBatis.xml
04-Jan-2016 21:57:00.260 INFO [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
04-Jan-2016 21:57:00.354 INFO [localhost-startStop-1] org.springframework.web.context.ContextLoader.initWebApplicationContext Root WebApplicationContext: initialization started
04-Jan-2016 21:57:00.791 INFO [localhost-startStop-1] org.springframework.web.context.support.XmlWebApplicationContext.prepareRefresh Refreshing Root WebApplicationContext: startup date [Mon Jan 04 21:57:00 CET 2016]; root of context hierarchy
04-Jan-2016 21:57:00.885 INFO [localhost-startStop-1] org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext.xml]
04-Jan-2016 21:57:01.245 INFO [localhost-startStop-1] org.springframework.web.context.ContextLoader.initWebApplicationContext Root WebApplicationContext: initialization completed in 891 ms
04-Jan-2016 21:57:01.276 INFO [localhost-startStop-1] org.springframework.web.servlet.DispatcherServlet.initServletBean FrameworkServlet 'dispatcher': initialization started
04-Jan-2016 21:57:01.291 INFO [localhost-startStop-1] org.springframework.web.context.support.XmlWebApplicationContext.prepareRefresh Refreshing WebApplicationContext for namespace 'dispatcher-servlet': startup date [Mon Jan 04 21:57:01 CET 2016]; parent: Root WebApplicationContext
04-Jan-2016 21:57:01.291 INFO [localhost-startStop-1] org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions Loading XML bean definitions from ServletContext resource [/WEB-INF/dispatcher-servlet.xml]
04-Jan-2016 21:57:02.838 INFO [localhost-startStop-1] org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.register Mapped "{[/ciao/ciriciao],methods=[GET]}" onto public java.lang.String com.studiosviluppo.springmvc.controller.CiaoMondo.sayHelloAgain(org.springframework.ui.ModelMap)
04-Jan-2016 21:57:02.838 INFO [localhost-startStop-1] org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.register Mapped "{[/ciao],methods=[GET]}" onto public java.lang.String com.studiosviluppo.springmvc.controller.CiaoMondo.sayHello(org.springframework.ui.ModelMap)
04-Jan-2016 21:57:02.854 INFO [localhost-startStop-1] org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.register Mapped "{[/utenteCon],methods=[GET]}" onto public java.lang.String com.studiosviluppo.springmvc.controller.userControlloer.vediFormRegtistrazione(java.util.Map<java.lang.String, java.lang.Object>)
04-Jan-2016 21:57:02.854 INFO [localhost-startStop-1] org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.register Mapped "{[/utenteCon],methods=[POST]}" onto public java.lang.String com.studiosviluppo.springmvc.controller.userControlloer.actionFormRegistrazione(com.studiosviluppo.springmvc.model.User,org.springframework.validation.BindingResult,java.util.Map<java.lang.String, java.lang.Object>)
04-Jan-2016 21:57:02.995 INFO [localhost-startStop-1] org.hibernate.validator.internal.util.Version.<clinit> HV000001: Hibernate Validator 5.2.2.Final
04-Jan-2016 21:57:03.260 INFO [localhost-startStop-1] org.hibernate.validator.internal.xml.ValidationXmlParser.unmarshal HV000007: META-INF/validation.xml found. Parsing XML based configuration.
04-Jan-2016 21:57:04.448 INFO [localhost-startStop-1] org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.initControllerAdviceCache Looking for @ControllerAdvice: WebApplicationContext for namespace 'dispatcher-servlet': startup date [Mon Jan 04 21:57:01 CET 2016]; parent: Root WebApplicationContext
04-Jan-2016 21:57:04.541 INFO [localhost-startStop-1] org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.initControllerAdviceCache Looking for @ControllerAdvice: WebApplicationContext for namespace 'dispatcher-servlet': startup date [Mon Jan 04 21:57:01 CET 2016]; parent: Root WebApplicationContext
04-Jan-2016 21:57:04.651 INFO [localhost-startStop-1] org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping.registerHandler Mapped URL path [/ciaomondo] onto handler 'ciaoMondo'
04-Jan-2016 21:57:04.651 INFO [localhost-startStop-1] org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping.registerHandler Mapped URL path [/ciaomondo/*] onto handler 'ciaoMondo'
04-Jan-2016 21:57:04.651 INFO [localhost-startStop-1] org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping.registerHandler Mapped URL path [/usercontrolloer] onto handler 'userControlloer'
04-Jan-2016 21:57:04.651 INFO [localhost-startStop-1] org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping.registerHandler Mapped URL path [/usercontrolloer/*] onto handler 'userControlloer'
04-Jan-2016 21:57:04.713 INFO [localhost-startStop-1] org.springframework.web.servlet.handler.SimpleUrlHandlerMapping.registerHandler Mapped URL path [/index.htm] onto handler 'indexController'
04-Jan-2016 21:57:04.948 INFO [localhost-startStop-1] org.springframework.web.servlet.DispatcherServlet.initServletBean FrameworkServlet 'dispatcher': initialization completed in 3672 ms
04-Jan-2016 21:57:04.963 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDescriptor Deployment of configuration descriptor C:\Users\StudioSviluppo\AppData\Roaming\NetBeans\8.1\apache-tomcat-8.0.27.0_base\conf\Catalina\localhost\mavenMVCMyBatis.xml has finished in 6,625 ms
04-Jan-2016 21:57:04.963 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDescriptor Deploying configuration descriptor C:\Users\StudioSviluppo\AppData\Roaming\NetBeans\8.1\apache-tomcat-8.0.27.0_base\conf\Catalina\localhost\ROOT.xml
04-Jan-2016 21:57:05.073 INFO [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
04-Jan-2016 21:57:05.088 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDescriptor Deployment of configuration descriptor C:\Users\StudioSviluppo\AppData\Roaming\NetBeans\8.1\apache-tomcat-8.0.27.0_base\conf\Catalina\localhost\ROOT.xml has finished in 110 ms
04-Jan-2016 21:57:05.088 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8084"]
04-Jan-2016 21:57:05.104 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"]
04-Jan-2016 21:57:05.104 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 7951 ms
04-Jan-2016 21:57:06.041 INFO [http-nio-8084-exec-7] org.springframework.web.context.support.XmlWebApplicationContext.doClose Closing WebApplicationContext for namespace 'dispatcher-servlet': startup date [Mon Jan 04 21:57:01 CET 2016]; parent: Root WebApplicationContext
04-Jan-2016 21:57:06.041 INFO [http-nio-8084-exec-7] org.springframework.web.context.support.XmlWebApplicationContext.doClose Closing Root WebApplicationContext: startup date [Mon Jan 04 21:57:00 CET 2016]; root of context hierarchy
04-Jan-2016 21:57:06.604 INFO [http-nio-8084-exec-7] org.apache.catalina.startup.HostConfig.undeploy Undeploying context [/mavenMVCMyBatis]
04-Jan-2016 21:57:06.745 INFO [http-nio-8084-exec-3] org.apache.catalina.startup.HostConfig.deployDescriptor Deploying configuration descriptor C:\Users\StudioSviluppo\AppData\Roaming\NetBeans\8.1\apache-tomcat-8.0.27.0_base\conf\Catalina\localhost\mavenMVCMyBatis.xml
04-Jan-2016 21:57:08.791 INFO [http-nio-8084-exec-3] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
04-Jan-2016 21:57:08.823 INFO [http-nio-8084-exec-3] org.springframework.web.context.ContextLoader.initWebApplicationContext Root WebApplicationContext: initialization started
04-Jan-2016 21:57:09.120 INFO [http-nio-8084-exec-3] org.springframework.web.context.support.XmlWebApplicationContext.prepareRefresh Refreshing Root WebApplicationContext: startup date [Mon Jan 04 21:57:09 CET 2016]; root of context hierarchy
04-Jan-2016 21:57:09.354 INFO [http-nio-8084-exec-3] org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext.xml]
04-Jan-2016 21:57:09.635 INFO [http-nio-8084-exec-3] org.springframework.web.context.ContextLoader.initWebApplicationContext Root WebApplicationContext: initialization completed in 812 ms
04-Jan-2016 21:57:09.666 INFO [http-nio-8084-exec-3] org.springframework.web.servlet.DispatcherServlet.initServletBean FrameworkServlet 'dispatcher': initialization started
04-Jan-2016 21:57:09.682 INFO [http-nio-8084-exec-3] org.springframework.web.context.support.XmlWebApplicationContext.prepareRefresh Refreshing WebApplicationContext for namespace 'dispatcher-servlet': startup date [Mon Jan 04 21:57:09 CET 2016]; parent: Root WebApplicationContext
04-Jan-2016 21:57:09.682 INFO [http-nio-8084-exec-3] org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions Loading XML bean definitions from ServletContext resource [/WEB-INF/dispatcher-servlet.xml]
04-Jan-2016 21:57:10.776 INFO [http-nio-8084-exec-3] org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.register Mapped "{[/ciao/ciriciao],methods=[GET]}" onto public java.lang.String com.studiosviluppo.springmvc.controller.CiaoMondo.sayHelloAgain(org.springframework.ui.ModelMap)
04-Jan-2016 21:57:10.776 INFO [http-nio-8084-exec-3] org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.register Mapped "{[/ciao],methods=[GET]}" onto public java.lang.String com.studiosviluppo.springmvc.controller.CiaoMondo.sayHello(org.springframework.ui.ModelMap)
04-Jan-2016 21:57:10.776 INFO [http-nio-8084-exec-3] org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.register Mapped "{[/utenteCon],methods=[GET]}" onto public java.lang.String com.studiosviluppo.springmvc.controller.userControlloer.vediFormRegtistrazione(java.util.Map<java.lang.String, java.lang.Object>)
04-Jan-2016 21:57:10.776 INFO [http-nio-8084-exec-3] org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.register Mapped "{[/utenteCon],methods=[POST]}" onto public java.lang.String com.studiosviluppo.springmvc.controller.userControlloer.actionFormRegistrazione(com.studiosviluppo.springmvc.model.User,org.springframework.validation.BindingResult,java.util.Map<java.lang.String, java.lang.Object>)
04-Jan-2016 21:57:10.870 INFO [http-nio-8084-exec-3] org.hibernate.validator.internal.util.Version.<clinit> HV000001: Hibernate Validator 5.2.2.Final
04-Jan-2016 21:57:11.041 INFO [http-nio-8084-exec-3] org.hibernate.validator.internal.xml.ValidationXmlParser.unmarshal HV000007: META-INF/validation.xml found. Parsing XML based configuration.
04-Jan-2016 21:57:11.370 INFO [http-nio-8084-exec-3] org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.initControllerAdviceCache Looking for @ControllerAdvice: WebApplicationContext for namespace 'dispatcher-servlet': startup date [Mon Jan 04 21:57:09 CET 2016]; parent: Root WebApplicationContext
04-Jan-2016 21:57:11.463 INFO [http-nio-8084-exec-3] org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.initControllerAdviceCache Looking for @ControllerAdvice: WebApplicationContext for namespace 'dispatcher-servlet': startup date [Mon Jan 04 21:57:09 CET 2016]; parent: Root WebApplicationContext
04-Jan-2016 21:57:11.620 INFO [http-nio-8084-exec-3] org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping.registerHandler Mapped URL path [/ciaomondo] onto handler 'ciaoMondo'
04-Jan-2016 21:57:11.620 INFO [http-nio-8084-exec-3] org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping.registerHandler Mapped URL path [/ciaomondo/*] onto handler 'ciaoMondo'
04-Jan-2016 21:57:11.620 INFO [http-nio-8084-exec-3] org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping.registerHandler Mapped URL path [/usercontrolloer] onto handler 'userControlloer'
04-Jan-2016 21:57:11.620 INFO [http-nio-8084-exec-3] org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping.registerHandler Mapped URL path [/usercontrolloer/*] onto handler 'userControlloer'
04-Jan-2016 21:57:11.651 INFO [http-nio-8084-exec-3] org.springframework.web.servlet.handler.SimpleUrlHandlerMapping.registerHandler Mapped URL path [/index.htm] onto handler 'indexController'
04-Jan-2016 21:57:11.901 INFO [http-nio-8084-exec-3] org.springframework.web.servlet.DispatcherServlet.initServletBean FrameworkServlet 'dispatcher': initialization completed in 2235 ms
04-Jan-2016 21:57:11.948 INFO [http-nio-8084-exec-3] org.apache.catalina.startup.HostConfig.deployDescriptor Deployment of configuration descriptor C:\Users\StudioSviluppo\AppData\Roaming\NetBeans\8.1\apache-tomcat-8.0.27.0_base\conf\Catalina\localhost\mavenMVCMyBatis.xml has finished in 5,203 ms
04-Jan-2016 21:57:12.182 INFO [http-nio-8084-exec-4] org.apache.catalina.util.LifecycleBase.start The start() method was called on component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/mavenMVCMyBatis]] after start() had already been called. The second call will be ignored.

Thanks in advance


Top
 Profile  
 
 Post subject: Re: Validator with validation.xml not working in Spring MVC
PostPosted: Thu Jan 07, 2016 5:33 am 
Hibernate Team
Hibernate Team

Joined: Sat Jan 24, 2009 12:46 pm
Posts: 386
Hum, weird, as said, HV will raise an exception if any of the mappings given in META-INF/validation.xml cannot be found.

To further narrow it down, you could try it with a plain (JUnit) test, run from within your IDE, leaving deployments and Tomcat out of the picture.

If you like, open an issue in the HV tracker and attach a *minimal* test project demonstrating the issue using Maven/Gradle/Ivy (so no ZIP containing binaries, please), and I'll try and take a look.

--Gunnar

_________________
Visit my blog at http://musingsofaprogrammingaddict.blogspot.com/


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.