hibernate/hibernate-orm · error · HibernateException
Could not locate TypeSafeActivator class
Error message
Could not locate TypeSafeActivator class
What it means
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.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/boot/beanvalidation/BeanValidationIntegrator.java:84
}
throw new HibernateException( "Unable to check validity of passed ValidatorFactory", e );
}
catch (IllegalAccessException e) {
throw new HibernateException( "Unable to check validity of passed ValidatorFactory", e );
}
}
catch (HibernateException e) {
throw e;
}
catch (Exception e) {
throw new HibernateException( "Could not locate method needed for ValidatorFactory validation", e );
}
}
catch (HibernateException e) {
throw e;
}
catch (Exception e) {
throw new HibernateException( "Could not locate TypeSafeActivator class", e );
}
}
@Override
public void integrate(
Metadata metadata,
Integrator.Context context,
SessionFactoryImplementor sessionFactory) {
final var serviceRegistry = sessionFactory.getServiceRegistry();
// IMPL NOTE: see the comments on ActivationContext.getValidationModes() as to why this is multi-valued...
final var modes = getValidationModes( serviceRegistry );
ValidationConstraintDdlInfluence constraintInfluence = ValidationConstraintDdlInfluence.resolve( serviceRegistry, modes );
if ( constraintInfluence == ValidationConstraintDdlInfluence.DISABLED && modes.contains( ValidationMode.NONE ) ) {
return;
}
if ( modes.size() > 1 ) {
BEAN_VALIDATION_LOGGER.multipleValidationModes( ValidationMode.loggable( modes ) );
}View on GitHub (pinned to fad1729dce)
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
Defensive patterns
Strategy: validation
Validate before calling
// verify Hibernate's internals are loadable from this classloader before boot
static void assertHibernateIntact() {
try {
Class.forName("org.hibernate.boot.beanvalidation.BeanValidationIntegrator", false,
Thread.currentThread().getContextClassLoader());
} catch (ClassNotFoundException | LinkageError e) {
throw new IllegalStateException("hibernate-core is broken or invisible to this classloader", e);
}
} Try / catch
try {
emf = Persistence.createEntityManagerFactory("pu");
} catch (HibernateException e) {
if (e.getMessage().contains("Could not locate TypeSafeActivator class"))
throw new IllegalStateException("Classloader cannot see hibernate-core internals; check packaging/isolation", e);
throw e;
} Prevention
- Do not mix container-provided and bundled Hibernate in one deployment
- Verify jar checksums after builds that copy artifacts around
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Unable to check validity of passed ValidatorFactory
- Could not locate method needed for ValidatorFactory validati
- Unable to load TypeSafeActivator class
- Unable to load class {}
- {uee.getMessage()} ('{entityClass.getSimpleName()}' does not
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/7dbcae59f78d6d94.
Report an issue: GitHub.