{"record":{"id":"e0e34fd1a1b0633a","repo":"hibernate/hibernate-orm","slug":"error-activating-bean-validation-integration","errorCode":null,"errorMessage":"Error activating Bean Validation integration","messagePattern":"Error activating Bean Validation integration","errorType":"exception","errorClass":"IntegrationException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/boot/beanvalidation/BeanValidationIntegrator.java","lineNumber":144,"sourceCode":"\t}\n\n\tprivate void callActivateMethod(ClassLoaderService classLoaderService, ActivationContext activationContext)\n\t\t\tthrows NoSuchMethodException {\n\t\tfinal var activateMethod =\n\t\t\t\tloadTypeSafeActivatorClass( classLoaderService )\n\t\t\t\t\t\t.getMethod( ACTIVATE_METHOD_NAME, ActivationContext.class );\n\t\ttry {\n\t\t\tactivateMethod.invoke( null, activationContext );\n\t\t}\n\t\tcatch (InvocationTargetException e) {\n\t\t\tfinal var targetException = e.getTargetException();\n\t\t\tthrow targetException instanceof HibernateException exception\n\t\t\t\t\t? exception\n\t\t\t\t\t: new IntegrationException( \"Error activating Bean Validation integration\",\n\t\t\t\t\t\t\ttargetException );\n\t\t}\n\t\tcatch (Exception e) {\n\t\t\tthrow new IntegrationException( \"Error activating Bean Validation integration\", e );\n\t\t}\n\t}\n\n\tprivate static Set<ValidationMode> getValidationModes(ServiceRegistry serviceRegistry) {\n\t\tfinal var settings =\n\t\t\t\tserviceRegistry.requireService( ConfigurationService.class )\n\t\t\t\t\t\t.getSettings();\n\t\tObject modeSetting = settings.get( JAKARTA_MODE_PROPERTY );\n\t\tif ( modeSetting == null ) {\n\t\t\tmodeSetting = settings.get( MODE_PROPERTY );\n\t\t}\n\t\treturn ValidationMode.parseValidationModes( modeSetting );\n\t}\n\n\tprivate boolean isBeanValidationApiAvailable(ClassLoaderService classLoaderService) {\n\t\ttry {\n\t\t\tclassLoaderService.classForName( JAKARTA_BV_CHECK_CLASS );\n\t\t\treturn true;","sourceCodeStart":126,"sourceCodeEnd":162,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/boot/beanvalidation/BeanValidationIntegrator.java#L126-L162","documentation":"The reflective call into TypeSafeActivator.activate(ActivationContext) threw: if the target exception is not already a HibernateException it is wrapped in this IntegrationException. The real reason lives in the cause chain — most commonly the default ValidatorFactory could not be bootstrapped (missing provider, broken validation.xml, or incompatible javax/jakarta validation versions).","triggerScenarios":"SessionFactory startup with validation mode CALLBACK or AUTO while the underlying ValidatorFactory cannot be created: no Bean Validation provider on the classpath, a failing META-INF/validation.xml, or an API/provider version mismatch touched during activate().","commonSituations":"Adding hibernate-core without hibernate-validator; Jakarta migrations where a javax-based Spring LocalValidatorFactoryBean or legacy provider is still present; malformed validation.xml copied between projects.","solutions":["Unwrap the IntegrationException and read the root cause — it names the actual bootstrap failure","Add a matching provider: org.hibernate.validator:hibernate-validator plus jakarta.validation-api of the generation your Hibernate expects","If entity validation is not wanted, set validation mode NONE explicitly instead of leaving AUTO/CALLBACK","Alternatively pass a known-good factory via jakarta.persistence.validation.factory"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// probe the Bean Validation stack independently before Hibernate integrates it\ntry (var probe = jakarta.validation.Validation.buildDefaultValidatorFactory()) {\n    probe.getValidator().validate(new Object()); // forces provider bootstrap\n} catch (Throwable t) {\n    throw new IllegalStateException(\n        \"Bean Validation cannot bootstrap on its own; fix this before starting Hibernate\", t);\n}","typeGuard":null,"tryCatchPattern":"try {\n    sessionFactory = new Configuration().buildSessionFactory();\n} catch (IntegrationException e) {\n    Throwable root = e;\n    while (root.getCause() != null) root = root.getCause();\n    throw new IllegalStateException(\"Bean Validation activation failed, root cause: \" + root, e);\n}","preventionTips":["Always pair hibernate-core with a matching hibernate-validator generation","Set validation-mode NONE explicitly in stacks that intentionally skip validation"],"tags":["hibernate","bean-validation","bootstrap","validatorfactory","integration"],"backgroundTag":"bean-validation-bootstrap-failure","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}