{"record":{"id":"864031b76aad8f71","repo":"hibernate/hibernate-orm","slug":"no-appropriate-constructor-for-type","errorCode":null,"errorMessage":"No appropriate constructor for type","messagePattern":"No appropriate constructor for type","errorType":"exception","errorClass":"InstantiationException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/boot/internal/TypeBeanInstanceProducer.java","lineNumber":56,"sourceCode":"\t\t\ttry {\n\t\t\t\treturn bootstrapContextAwareConstructor.newInstance( this );\n\t\t\t}\n\t\t\tcatch ( Exception e ) {\n\t\t\t\tthrow new InstantiationException( \"Could not instantiate type\", beanType, e );\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tfinal var constructor = getConstructorOrNull( beanType );\n\t\t\tif ( constructor != null ) {\n\t\t\t\ttry {\n\t\t\t\t\treturn constructor.newInstance();\n\t\t\t\t}\n\t\t\t\tcatch ( Exception e ) {\n\t\t\t\t\tthrow new InstantiationException( \"Could not instantiate type\", beanType, e );\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tthrow new InstantiationException( \"No appropriate constructor for type\", beanType );\n\t\t\t}\n\t\t}\n\t}\n\n\t@Override\n\tpublic <B> B produceBeanInstance(String name, Class<B> beanType) {\n\t\treturn produceBeanInstance( beanType );\n\t}\n\n\t@Override\n\tpublic Map<String, Object> getConfigurationSettings() {\n\t\treturn configurationService.getSettings();\n\t}\n\n\t@Override\n\tpublic ServiceRegistry getServiceRegistry() {\n\t\treturn serviceRegistry;\n\t}","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/boot/internal/TypeBeanInstanceProducer.java#L38-L74","documentation":"Error \"No appropriate constructor for type\" thrown in hibernate/hibernate-orm.","triggerScenarios":"CDI-style bean creation of a custom Hibernate type fails.","commonSituations":"A custom UserType/AttributeConverter bean that cannot be instantiated, lacking an injectable or no-arg constructor.","solutions":["Add a constructor matching the expected signature (usually no-arg) to the type class.","Check the TypeBeanInstanceProducer expectations for the given type category (UserType, BasicType, etc.).","If the type needs constructor arguments, register a pre-built instance instead of letting Hibernate instantiate it."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}