title: HDIV + Spring MVC - getting always Unauthorized Access error HDIV_PARAMETER_DOES_NOT_EXIST
body: <p>I am using HDIV with Spring MVC based on Spring Java Configuration which I derived from their showcase implementation. The configuration get loaded but when I try to access protected URLs i.e. "/messages/message" I get always Unauthorized Access error HDIV_PARAMETER_DOES_NOT_EXIST. It works when I change the config to exclude the URL from HDIV processing but this of course is not an option</p>
  
  <p>Anybody an idea what I missed?</p>
  
  <ul>
  <li><a href="https://hdivsecurity.com/technical-documentation/doc.html#examples-springmvc" rel="nofollow noreferrer">hdiv reference documentation</a> </li>
  <li><a href="https://github.com/hdiv/hdiv-spring-mvc-showcase-jc/blob/master/src/main/java/org/hdiv/samples/mvc/config/" rel="nofollow noreferrer">hdiv example showcase configuration code</a></li>
  </ul>
  
  <p><strong>Logfile error statement</strong></p>
  
  <pre><code>10:04:17.304 [http-nio-8080-exec-22] INFO  org.hdiv.logs.Logger - HDIV_PARAMETER_DOES_NOT_EXIST;/spring-security-example/messages/message;_HDIV_STATE_;;;127.0.0.1;127.0.0.1;megloff;
  </code></pre>
  
  <p><strong>Java Configuration</strong></p>
  
  <pre><code>@Configuration
  @EnableHdivWebSecurity
  public class HdivSecurityConfig extends HdivWebSecurityConfigurerAdapter {
  
    @Override
    public void configure(SecurityConfigBuilder builder) {
    }
  
    @Override
    public void addExclusions(ExclusionRegistry registry) {
      registry.addUrlExclusions("/").method("GET");
      registry.addUrlExclusions("/login");
      registry.addUrlExclusions("/logout");
      registry.addUrlExclusions("/static/.*");
      registry.addParamExclusions("_csrf");  
  
  
      //  registry.addUrlExclusions("/messages/.*"); &lt;-- would allow access, but not an option      
    }
  
    @Override
    public void configureEditableValidation(ValidationConfigurer validationConfigurer) {
  
      validationConfigurer.addValidation("/messages/.*");
      validationConfigurer.addValidation("/addUser");
    }
  }
  
  @Configuration
  @EnableWebMvc
  @ComponentScan(basePackages = {
      "ch.megloff.spring.security.example.mvc.controller",
      "ch.megloff.spring.security.example.mvc.action",
      "ch.megloff.spring.security.example.repository",
      "ch.megloff.spring.security.example.listener", 
      "ch.megloff.spring.security.example.service"})
  public class SpringMVCConfiguration extends WebMvcConfigurerAdapter {
  
    @Autowired
    @Qualifier("hdivEditableValidator")
    private Validator hdivEditableValidator;
  
    @Override
    public Validator getValidator() {
      return hdivEditableValidator;
   }
  
   ...
  }
  
  
  public class SpringWebInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {
  
     @Override
     protected Class&lt;?&gt;[] getRootConfigClasses() {
      return new Class[] { SpringMVCConfiguration.class, SpringHibernateConfig.class, SpringSecurityConfiguration.class, SpringSecurityJDBCConfiguration.class, SpringWebFlowConfig.class, HdivSecurityConfig.class };
  }
  
     @Override
     protected Class&lt;?&gt;[] getServletConfigClasses() {
      return new Class[] { SpringMVCConfiguration.class };
     }
  
     @Override
     protected String[] getServletMappings() {
      return new String[] { "/" };
     }
  
     public void onStartup(ServletContext container) throws ServletException {
      super.onStartup(container);
  
      container.addFilter("ValidatorFilter", ValidatorFilter.class).addMappingForUrlPatterns(
              EnumSet.of(DispatcherType.REQUEST), false, "/*");
  
      container.addListener(new InitListener());
    }
  }
  </code></pre>