{"record":{"id":"7dbcae59f78d6d94","repo":"hibernate/hibernate-orm","slug":"could-not-locate-typesafeactivator-class","errorCode":null,"errorMessage":"Could not locate TypeSafeActivator class","messagePattern":"Could not locate TypeSafeActivator class","errorType":"exception","errorClass":"HibernateException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/boot/beanvalidation/BeanValidationIntegrator.java","lineNumber":84,"sourceCode":"\t\t\t\t\t}\n\t\t\t\t\tthrow new HibernateException( \"Unable to check validity of passed ValidatorFactory\", e );\n\t\t\t\t}\n\t\t\t\tcatch (IllegalAccessException e) {\n\t\t\t\t\tthrow new HibernateException( \"Unable to check validity of passed ValidatorFactory\", e );\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch (HibernateException e) {\n\t\t\t\tthrow e;\n\t\t\t}\n\t\t\tcatch (Exception e) {\n\t\t\t\tthrow new HibernateException( \"Could not locate method needed for ValidatorFactory validation\", e );\n\t\t\t}\n\t\t}\n\t\tcatch (HibernateException e) {\n\t\t\tthrow e;\n\t\t}\n\t\tcatch (Exception e) {\n\t\t\tthrow new HibernateException( \"Could not locate TypeSafeActivator class\", e );\n\t\t}\n\t}\n\n\t@Override\n\tpublic void integrate(\n\t\t\tMetadata metadata,\n\t\t\tIntegrator.Context context,\n\t\t\tSessionFactoryImplementor sessionFactory) {\n\t\tfinal var serviceRegistry = sessionFactory.getServiceRegistry();\n\t\t// IMPL NOTE: see the comments on ActivationContext.getValidationModes() as to why this is multi-valued...\n\t\tfinal var modes = getValidationModes( serviceRegistry );\n\t\tValidationConstraintDdlInfluence constraintInfluence = ValidationConstraintDdlInfluence.resolve( serviceRegistry, modes );\n\t\tif ( constraintInfluence == ValidationConstraintDdlInfluence.DISABLED && modes.contains( ValidationMode.NONE ) ) {\n\t\t\treturn;\n\t\t}\n\t\tif ( modes.size() > 1 ) {\n\t\t\tBEAN_VALIDATION_LOGGER.multipleValidationModes( ValidationMode.loggable( modes ) );\n\t\t}","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/boot/beanvalidation/BeanValidationIntegrator.java#L66-L102","documentation":"The outer reflective block failed before any method lookup: BeanValidationIntegrator's own classloader could not load org.hibernate.boot.beanvalidation.TypeSafeActivator at all. That points at broken or mutually invisible Hibernate classes — a packaging/classloader problem rather than a configuration mistake.","triggerScenarios":"Loading the Bean Validation integrator while hibernate-core classes live in an isolated classloader domain that cannot resolve the internal activator class, or the hibernate-core jar is corrupted/truncated.","commonSituations":"App-server deployments mixing server-provided and bundled Hibernate; classloader leaks after repeated hot redeploys; jars truncated by a failed download or over-aggressive artifact caching.","solutions":["Verify exactly one intact hibernate-core jar is on the classpath (checksum/re-download if corruption is suspected)","Use the container/platform-provided Hibernate consistently instead of mixing bundled and provided copies","Clean redeploy and restart to clear stale classloader state"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// verify Hibernate's internals are loadable from this classloader before boot\nstatic void assertHibernateIntact() {\n    try {\n        Class.forName(\"org.hibernate.boot.beanvalidation.BeanValidationIntegrator\", false,\n                      Thread.currentThread().getContextClassLoader());\n    } catch (ClassNotFoundException | LinkageError e) {\n        throw new IllegalStateException(\"hibernate-core is broken or invisible to this classloader\", e);\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    emf = Persistence.createEntityManagerFactory(\"pu\");\n} catch (HibernateException e) {\n    if (e.getMessage().contains(\"Could not locate TypeSafeActivator class\"))\n        throw new IllegalStateException(\"Classloader cannot see hibernate-core internals; check packaging/isolation\", e);\n    throw e;\n}","preventionTips":["Do not mix container-provided and bundled Hibernate in one deployment","Verify jar checksums after builds that copy artifacts around"],"tags":["hibernate","classloader","classnotfound","packaging"],"backgroundTag":"class-not-found","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}