hibernate/hibernate-orm · error · InstantiationException

No appropriate constructor for type

Error message

No appropriate constructor for type

What it means

Error "No appropriate constructor for type" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/boot/internal/TypeBeanInstanceProducer.java:56

			try {
				return bootstrapContextAwareConstructor.newInstance( this );
			}
			catch ( Exception e ) {
				throw new InstantiationException( "Could not instantiate type", beanType, e );
			}
		}
		else {
			final var constructor = getConstructorOrNull( beanType );
			if ( constructor != null ) {
				try {
					return constructor.newInstance();
				}
				catch ( Exception e ) {
					throw new InstantiationException( "Could not instantiate type", beanType, e );
				}
			}
			else {
				throw new InstantiationException( "No appropriate constructor for type", beanType );
			}
		}
	}

	@Override
	public <B> B produceBeanInstance(String name, Class<B> beanType) {
		return produceBeanInstance( beanType );
	}

	@Override
	public Map<String, Object> getConfigurationSettings() {
		return configurationService.getSettings();
	}

	@Override
	public ServiceRegistry getServiceRegistry() {
		return serviceRegistry;
	}

View on GitHub (pinned to fad1729dce)

Solutions

  1. Add a constructor matching the expected signature (usually no-arg) to the type class.
  2. Check the TypeBeanInstanceProducer expectations for the given type category (UserType, BasicType, etc.).
  3. If the type needs constructor arguments, register a pre-built instance instead of letting Hibernate instantiate it.

When it happens

Trigger: CDI-style bean creation of a custom Hibernate type fails.

Common situations: A custom UserType/AttributeConverter bean that cannot be instantiated, lacking an injectable or no-arg constructor.


AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22). Data as JSON: /api/errors/864031b76aad8f71. Report an issue: GitHub.