hibernate/hibernate-orm · error · HibernateException

Could not find a FormatMapper for the XML format, which is r

Error message

Could not find a FormatMapper for the XML format, which is required for mapping XML types. XML FormatMapper configuration is automatic, but requires that you have either Jackson XML or a JAXB implementation like Glassfish JAXB on the class path.

What it means

Error "Could not find a FormatMapper for the XML format, which is required for mapping XML types. XML FormatMapper configuration is automatic, but requires that you have either Jackson XML or a JAXB implementation like Glassfish JAXB on the class path." thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/boot/internal/SessionFactoryOptionsBuilder.java:1579

		return preferLocaleLanguageTagEnabled;
	}

	@Override
	@Nonnull
	public FormatMapper getJsonFormatMapper() {
		if ( jsonFormatMapper == null ) {
			throw new HibernateException(
					"Could not find a FormatMapper for the JSON format, which is required for mapping JSON types. JSON FormatMapper configuration is automatic, but requires that you have either Jackson or a JSONB implementation like Yasson on the class path."
			);
		}
		return jsonFormatMapper;
	}

	@Override
	@Nonnull
	public FormatMapper getXmlFormatMapper() {
		if ( xmlFormatMapper == null ) {
			throw new HibernateException(
					"Could not find a FormatMapper for the XML format, which is required for mapping XML types. XML FormatMapper configuration is automatic, but requires that you have either Jackson XML or a JAXB implementation like Glassfish JAXB on the class path."
			);
		}
		return xmlFormatMapper;
	}

	@Override
	public boolean isXmlFormatMapperLegacyFormatEnabled() {
		return xmlFormatMapperLegacyFormatEnabled;
	}

	@Override
	public boolean isPassProcedureParameterNames() {
		return passProcedureParameterNames;
	}

	@Override
	public boolean isPreferJdbcDatetimeTypesInNativeQueriesEnabled() {

View on GitHub (pinned to fad1729dce)

Solutions

  1. Add com.fasterxml.jackson.dataformat:jackson-dataformat-xml or a JAXB implementation (e.g. org.glassfish.jaxb:jaxb-runtime) to the classpath.
  2. If XML mapping is not needed, remove the @JdbcTypeCode(SqlTypes.XML)/XML-typed attribute from the entity.
  3. Alternatively register a custom FormatMapper via hibernate.type.xml_format_mapper.

When it happens

Trigger: No FormatMapper for the requested format is found while mapping a JSON/XML column.

Common situations: Mapping a JSON or XML attribute without Jackson (or a JSON-B/JAXB implementation such as Yasson/Glassfish JAXB) on the classpath.


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