title: Unwrap HibernateConstraintValidatorContext not working
body: <p>I use</p>
  
  <ul>
  <li>Hibernate validator 5.1.1.Final</li>
  <li><p>Validation api 1.1.0.Final</p>
  
  <pre><code>public boolean isValid(Object value, ConstraintValidatorContext context) {
  
  
  if(value.toString().isEmpty()){
      HibernateConstraintValidatorContext hibernateContext =
              context.unwrap(HibernateConstraintValidatorContext.class );
  
      ...........
                  ...........
  }
  
     return true;
  }
  </code></pre></li>
  </ul>
  
  <p>Above code throw ValidationException, apidoc say "If the Bean Validation provider implementation does not support the specified class, ValidationException is thrown."</p>
  
  <p><strong>Exception</strong></p>
  
  <pre><code>     [2014-06-12T11:44:05.295+0200] [glassfish 4.0] [INFO] []                                    [javax.enterprise.resource.webcontainer.jsf.context] [tid: _ThreadID=22 _ThreadName=http-listener-1(5)] [timeMillis: 1402566245295] [levelValue: 800] [[
         javax.validation.ValidationException: HV000028: Unexpected exception during isValid call.
           javax.validation.ValidationException: HV000028: Unexpected exception during isValid call.
  at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.validateSingleConstraint(ConstraintTree.java:284)
  at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.validateConstraints(ConstraintTree.java:133)
  at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.validateConstraints(ConstraintTree.java:91)
  at org.hibernate.validator.internal.metadata.core.MetaConstraint.validateConstraint(MetaConstraint.java:85)
  at org.hibernate.validator.internal.engine.ValidatorImpl.validatePropertyForDefaultGroup(ValidatorImpl.java:855)
  at org.hibernate.validator.internal.engine.ValidatorImpl.validatePropertyForCurrentGroup(ValidatorImpl.java:768)
  at org.hibernate.validator.internal.engine.ValidatorImpl.validateValueInContext(ValidatorImpl.java:725)
  at org.hibernate.validator.internal.engine.ValidatorImpl.validateValue(ValidatorImpl.java:184)
  at javax.faces.validator.BeanValidator.validate(BeanValidator.java:306)
  at javax.faces.component.UIInput.validateValue(UIInput.java:1165)
  at javax.faces.component.UIInput.validate(UIInput.java:983)
  at javax.faces.component.UIInput.executeValidate(UIInput.java:1249)
  at javax.faces.component.UIInput.processValidators(UIInput.java:712)
  at com.sun.faces.context.PartialViewContextImpl$PhaseAwareVisitCallback.visit(PartialViewContextImpl.java:552)
  at com.sun.faces.component.visit.PartialVisitContext.invokeVisitCallback(PartialVisitContext.java:183)
  at javax.faces.component.UIComponent.visitTree(UIComponent.java:1689)
  at javax.faces.component.UIComponent.visitTree(UIComponent.java:1700)
  at javax.faces.component.UIComponent.visitTree(UIComponent.java:1700)
  at javax.faces.component.UIComponent.visitTree(UIComponent.java:1700)
  at javax.faces.component.UIForm.visitTree(UIForm.java:371)
  at javax.faces.component.UIComponent.visitTree(UIComponent.java:1700)
  at javax.faces.component.UIComponent.visitTree(UIComponent.java:1700)
  at javax.faces.component.UIComponent.visitTree(UIComponent.java:1700)
  at javax.faces.component.UIComponent.visitTree(UIComponent.java:1700)
  at javax.faces.component.UIComponent.visitTree(UIComponent.java:1700)
  at javax.faces.component.UIComponent.visitTree(UIComponent.java:1700)
  at com.sun.faces.context.PartialViewContextImpl.processComponents(PartialViewContextImpl.java:399)
  at com.sun.faces.context.PartialViewContextImpl.processPartial(PartialViewContextImpl.java:263)
  at org.primefaces.context.PrimePartialViewContext.processPartial(PrimePartialViewContext.java:60)
  at javax.faces.context.PartialViewContextWrapper.processPartial(PartialViewContextWrapper.java:219)
  at javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:1193)
  at org.springframework.faces.webflow.FlowLifecycle.invokePhase(FlowLifecycle.java:91)
  at org.springframework.faces.webflow.FlowLifecycle.execute(FlowLifecycle.java:69)
  at org.springframework.faces.webflow.JsfView.processUserEvent(JsfView.java:115)
  at org.springframework.webflow.engine.ViewState.handleEvent(ViewState.java:225)
  at org.springframework.webflow.engine.ViewState.resume(ViewState.java:195)
  at org.springframework.webflow.engine.Flow.resume(Flow.java:537)
  at org.springframework.webflow.engine.impl.FlowExecutionImpl.resume(FlowExecutionImpl.java:259)
  at org.springframework.webflow.executor.FlowExecutorImpl.resumeExecution(FlowExecutorImpl.java:169)
  at org.springframework.webflow.mvc.servlet.FlowHandlerAdapter.handle(FlowHandlerAdapter.java:228)
  at org.springframework.faces.webflow.JsfFlowHandlerAdapter.handle(JsfFlowHandlerAdapter.java:57)
  at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:938)
  at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:870)
  at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)
  at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:863)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
  at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
  at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:344)
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
  at org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:70)
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
  at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
  at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:108)
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
  at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77)
  at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:108)
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
  at org.springframework.web.filter.ShallowEtagHeaderFilter.doFilterInternal(ShallowEtagHeaderFilter.java:79)
  at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:108)
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
  at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:186)
  at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
  at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)
  at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
  at org.apache.logging.log4j.core.web.Log4jServletFilter.doFilter(Log4jServletFilter.java:66)
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
  at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:316)
  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
  at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
  at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
  at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
  at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:357)
  at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:260)
  at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:188)
  at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
  at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
  at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
  at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
  at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
  at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
  at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
  at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
  at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
  at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
  at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
  at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
  at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
  at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
  at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
  at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
  at java.lang.Thread.run(Thread.java:744)
          Caused by: javax.validation.ValidationException: HV000036: Type interface org.hibernate.validator.constraintvalidation.HibernateConstraintValidatorContext not supported for unwrapping.
  at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintValidatorContextImpl.unwrap(ConstraintValidatorContextImpl.java:83)
  at es.project.validator.jsr.NotEmptyValidator.isValid(NotEmptyValidator.java:20)
  at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.validateSingleConstraint(ConstraintTree.java:281)
  ... 100 more
  </code></pre>
  
  <p>So I need change/add any jar?</p>