{"record":{"id":"96137bc493872732","repo":"quarkusio/quarkus","slug":"missing-attribute-nodename-class","errorCode":null,"errorMessage":"Missing attribute '${nodeName}.class'","messagePattern":"Missing attribute '(.+?)\\.class'","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/JpaJandexScavenger.java","lineNumber":263,"sourceCode":"        }\n\n        enlistOrmXmlMappingListeners(collector, packagePrefix, managed.getEntityListenerContainer());\n    }\n\n    private void enlistOrmXmlMappingListeners(Collector collector, String packagePrefix,\n            JaxbEntityListenerContainerImpl entityListeners) {\n        if (entityListeners == null) {\n            return;\n        }\n        for (var listener : entityListeners.getEntityListeners()) {\n            collector.potentialCdiBeanTypes.add(DotName.createSimple(qualifyIfNecessary(packagePrefix, listener.getClazz())));\n        }\n    }\n\n    private static String safeGetClassName(String packagePrefix, JaxbManagedType managedType, String nodeName) {\n        String name = managedType.getClazz();\n        if (name == null) {\n            throw new IllegalArgumentException(\"Missing attribute '\" + nodeName + \".class'\");\n        }\n        return qualifyIfNecessary(packagePrefix, name);\n    }\n\n    // See org.hibernate.cfg.annotations.reflection.internal.XMLContext.buildSafeClassName(java.lang.String, java.lang.String)\n    private static String qualifyIfNecessary(String packagePrefix, String name) {\n        if (name.indexOf('.') < 0) {\n            return packagePrefix + name;\n        } else {\n            // The class name is already qualified; don't apply the package prefix.\n            return name;\n        }\n    }\n\n    private void enlistHbmXmlMapping(Collector collector, JaxbHbmHibernateMapping mapping) {\n        String packageValue = mapping.getPackage();\n        String packagePrefix = packageValue == null ? \"\" : packageValue + \".\";\n","sourceCodeStart":245,"sourceCodeEnd":281,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/JpaJandexScavenger.java#L245-L281","documentation":"When parsing managed types (entity/mapped-superclass/embeddable) from a mapping file (orm.xml), Quarkus's JpaJandexScavenger calls safeGetClassName to extract the class attribute of the XML element. If the element has no 'class' attribute, the type cannot be identified and IllegalArgumentException('Missing attribute <nodeName>.class') is thrown.","triggerScenarios":"An orm.xml contains an <entity>, <mapped-superclass>, or <embeddable> element (the nodeName) without a class=\"...\" attribute, and the element is processed via name()/safeGetClassName.","commonSituations":"Hand-written or generated orm.xml missing class attribute; XML copied from a catalog example with placeholders; XML manipulation/tooling that dropped attributes; mistakenly using <entity> for a package-level metadata element.","solutions":["Add the class attribute to the offending element in the orm.xml, e.g. <entity class=\"com.acme.MyEntity\">","Locate the element by nodeName in the error message (it names the XML element) and fix it","Regenerate or validate the orm.xml against the JPA XSD, which can catch missing required attributes early"],"exampleFix":"<!-- before -->\n<entity access=\"FIELD\">\n  <table name=\"T1\"/>\n</entity>\n<!-- after -->\n<entity class=\"com.acme.Thing\" access=\"FIELD\">\n  <table name=\"T1\"/>\n</entity>","handlingStrategy":"validation","validationCode":"// Validate orm.xml elements carry class attributes before build\nDocumentBuilderFactory f = DocumentBuilderFactory.newInstance();\nNodeList entities = f.newDocumentBuilder().parse(new File(\"src/main/resources/META-INF/orm.xml\"))\n    .getElementsByTagName(\"entity\");\nfor (int i = 0; i < entities.getLength(); i++) {\n    if (((Element) entities.item(i)).getAttribute(\"class\").isEmpty())\n        throw new IllegalArgumentException(\"<entity> missing class attribute in orm.xml\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate orm.xml against the JPA XSD in CI","Prefer annotations over orm.xml where possible to reduce XML drift","When generating orm.xml, assert class attributes are present in a unit test"],"tags":["quarkus","hibernate-orm","orm-xml","xml-validation"],"backgroundTag":"malformed-mapping-xml","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}