hibernate/hibernate-orm · error · HibernateException
Unable to locate TypeSafeActivator#activate method
Error message
Unable to locate TypeSafeActivator#activate method
What it means
The Bean Validation API was detected as available and TypeSafeActivator loaded, but the reflective lookup of activate(ActivationContext) threw NoSuchMethodException: the activator class on the classpath does not match the shape the driving BeanValidationIntegrator expects — the signature of a different Hibernate version.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/boot/beanvalidation/BeanValidationIntegrator.java:118
if ( modes.size() > 1 ) {
BEAN_VALIDATION_LOGGER.multipleValidationModes( ValidationMode.loggable( modes ) );
}
activate( metadata, sessionFactory, serviceRegistry, modes, constraintInfluence );
}
private void activate(Metadata metadata, SessionFactoryImplementor sessionFactory, ServiceRegistryImplementor serviceRegistry, Set<ValidationMode> modes, ValidationConstraintDdlInfluence constraintInfluence) {
final var classLoaderService = serviceRegistry.requireService( ClassLoaderService.class );
// see if the Bean Validation API is available on the classpath
if ( isBeanValidationApiAvailable( classLoaderService ) ) {
// and if so, call out to the TypeSafeActivator
try {
final var activationContext =
new ActivationContextImpl( modes, constraintInfluence, metadata, sessionFactory,
(SessionFactoryServiceRegistry) serviceRegistry );
callActivateMethod( classLoaderService, activationContext );
}
catch (NoSuchMethodException e) {
throw new HibernateException( "Unable to locate TypeSafeActivator#activate method", e );
}
}
else {
// otherwise check the validation modes
// todo : in many ways this duplicates the checks done on the TypeSafeActivator when a ValidatorFactory could not be obtained
validateMissingBeanValidationApi( modes, constraintInfluence );
}
}
private void callActivateMethod(ClassLoaderService classLoaderService, ActivationContext activationContext)
throws NoSuchMethodException {
final var activateMethod =
loadTypeSafeActivatorClass( classLoaderService )
.getMethod( ACTIVATE_METHOD_NAME, ActivationContext.class );
try {
activateMethod.invoke( null, activationContext );
}
catch (InvocationTargetException e) {View on GitHub (pinned to fad1729dce)
Solutions
- Deduplicate hibernate-core: dependency:tree / gradle dependencies, then enforce a single version
- If shading, rebuild the shaded artifact against the current Hibernate version
- On platforms like WildFly/Quarkus, use the Hibernate provided by the platform and remove explicit hibernate-core dependencies
Defensive patterns
Strategy: validation
Validate before calling
// same dedupe guard that prevents the method-lookup variant
static void assertSingleHibernateCore() throws IOException {
Enumeration<URL> urls = Thread.currentThread().getContextClassLoader().getResources(
"org/hibernate/boot/beanvalidation/BeanValidationIntegrator.class");
if (Collections.list(urls).size() > 1)
throw new IllegalStateException("Multiple hibernate-core copies; align versions");
} Try / catch
try {
sessionFactory = new Configuration().buildSessionFactory();
} catch (HibernateException e) {
if (e.getCause() instanceof NoSuchMethodException)
throw new IllegalStateException("hibernate-core version mix-up: duplicate artifacts present", e);
throw e;
} Prevention
- Upgrade hibernate-core as a whole, never mix jars of different versions
- Let the platform (Boot/WildFly/Quarkus) manage the Hibernate version
When it happens
Trigger: SessionFactory bootstrap with validation active (CALLBACK/AUTO) while mismatched hibernate-core artifacts coexist, so the loaded TypeSafeActivator lacks the activate(ActivationContext) method the integrator is calling.
Common situations: Version drift after upgrading hibernate-core but leaving a stale or shaded copy behind; frameworks pulling hibernate-core transitively at a different version than the one on the classpath.
Related errors
- Unable to check validity of passed ValidatorFactory
- Could not locate method needed for ValidatorFactory validati
- Multiple active MetadataBuilder definitions were discovered
- Validation failed for classes {} during {} time for groups [
- Error activating Bean Validation integration
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/303423839a74423a.
Report an issue: GitHub.