{"record":{"id":"62b5b0a37a87dd32","repo":"alibaba/spring-ai-alibaba","slug":"not-found-default-default-application-yml","errorCode":null,"errorMessage":"not found default-default-application.yml","messagePattern":"not found default-default-application\\.yml","errorType":"exception","errorClass":"java.lang.IllegalStateException","httpStatus":null,"severity":"error","filePath":"spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-start/src/main/java/com/alibaba/cloud/ai/studio/admin/builder/generator/service/generator/GraphAppPropertiesCustomizer.java","lineNumber":35,"sourceCode":"\nimport java.io.InputStream;\nimport java.util.List;\nimport java.util.Map;\n\nimport io.spring.initializr.generator.spring.properties.ApplicationProperties;\nimport io.spring.initializr.generator.spring.properties.ApplicationPropertiesCustomizer;\nimport org.yaml.snakeyaml.Yaml;\n\npublic class GraphAppPropertiesCustomizer implements ApplicationPropertiesCustomizer {\n\n\tpublic GraphAppPropertiesCustomizer() {\n\t}\n\n\t@Override\n\tpublic void customize(ApplicationProperties properties) {\n\t\ttry (InputStream in = getClass().getClassLoader().getResourceAsStream(\"templates/default-application.yml\")) {\n\t\t\tif (in == null) {\n\t\t\t\tthrow new IllegalStateException(\"not found default-default-application.yml\");\n\t\t\t}\n\t\t\tYaml yaml = new Yaml();\n\t\t\tObject loaded = yaml.load(in);\n\t\t\tif (loaded instanceof Map<?, ?>) {\n\t\t\t\tflattenAndAdd(properties, \"\", (Map<String, Object>) loaded);\n\t\t\t}\n\t\t}\n\t\tcatch (Exception ex) {\n\t\t\tthrow new IllegalStateException(\"parse default-default-application.yml failed\", ex);\n\t\t}\n\t}\n\n\t@SuppressWarnings(\"unchecked\")\n\tprivate void flattenAndAdd(ApplicationProperties props, String prefix, Map<String, Object> map) {\n\t\tfor (Map.Entry<String, Object> entry : map.entrySet()) {\n\t\t\tString key = prefix.isEmpty() ? entry.getKey() : prefix + \".\" + entry.getKey();\n\t\t\tObject value = entry.getValue();\n\t\t\tif (value instanceof Map) {","sourceCodeStart":17,"sourceCodeEnd":53,"githubUrl":"https://github.com/alibaba/spring-ai-alibaba/blob/f82da0b50f35744c13968191be2b1cd2452ef550/spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-start/src/main/java/com/alibaba/cloud/ai/studio/admin/builder/generator/service/generator/GraphAppPropertiesCustomizer.java#L17-L53","documentation":"GraphAppPropertiesCustomizer.customize() loads the classpath resource 'templates/default-application.yml' to seed default application properties for a generated project. If the resource is absent from the classloader, it throws IllegalStateException with a (buggy, doubled-prefix) message 'not found default-default-application.yml'. This is an internal packaging invariant: the YAML template ships inside the jar and must always be present.","triggerScenarios":"Calling customize(ApplicationProperties) when templates/default-application.yml is missing from the classpath — typically because the admin-server jar was built without resources, the templates directory was excluded by build filters, or a repackaged/shaded jar dropped non-class resources.","commonSituations":"Building the admin server with resource filtering that excluded templates/, running from an IDE with incomplete resource copying, deploying a trimmed container image, or a version change where the template file was renamed/moved.","solutions":["Verify templates/default-application.yml exists under spring-ai-alibaba-admin-server-start/src/main/resources and rebuild the module with ./mvnw -pl spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-start -B package -DskipTests=true","Check the built jar: jar tf target/*.jar | grep default-application.yml — if missing, fix maven-resource-plugin includes/filters","If running in an IDE, re-import the project / run 'mvn process-resources' so resources are copied to target/classes","If you intentionally removed the template, override customize() or provide your own default-application.yml on the classpath"],"exampleFix":"// before (missing resource in pom filter)\n<resource><directory>src/main/resources</directory><excludes><exclude>templates/**</exclude></excludes></resource>\n// after\n<resource><directory>src/main/resources</directory></resource>","handlingStrategy":"try-catch","validationCode":"boolean present = getClass().getClassLoader().getResource(\"templates/default-application.yml\") != null;\nif (!present) { throw new IllegalStateException(\"default-application.yml missing from classpath\"); }","typeGuard":"boolean templateAvailable(ClassLoader cl) {\n    return cl.getResource(\"templates/default-application.yml\") != null;\n}","tryCatchPattern":"try {\n    customizer.customize(properties);\n} catch (IllegalStateException e) {\n    log.error(\"Default application template missing: {}\", e.getMessage(), e);\n    // fall back to programmatic defaults\n}","preventionTips":["Verify the built jar contains templates/default-application.yml before deploying (jar tf)","Avoid resource-exclude filters on src/main/resources","Run 'mvn process-resources' after IDE config changes","Pin template files in a packaging test"],"tags":["spring-boot","resources","classpath","yaml"],"backgroundTag":"config-file-not-found","analyzedSha":"f82da0b50f35744c13968191be2b1cd2452ef550","analyzedAt":"2026-09-09T15:32:42.421Z","contentChangedAt":"2026-09-09T15:32:42.421Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}