alibaba/spring-ai-alibaba · error · java.lang.IllegalStateException
not found default-default-application.yml
Error message
not found default-default-application.yml
What it means
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.
Source
Thrown at 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:35
import java.io.InputStream;
import java.util.List;
import java.util.Map;
import io.spring.initializr.generator.spring.properties.ApplicationProperties;
import io.spring.initializr.generator.spring.properties.ApplicationPropertiesCustomizer;
import org.yaml.snakeyaml.Yaml;
public class GraphAppPropertiesCustomizer implements ApplicationPropertiesCustomizer {
public GraphAppPropertiesCustomizer() {
}
@Override
public void customize(ApplicationProperties properties) {
try (InputStream in = getClass().getClassLoader().getResourceAsStream("templates/default-application.yml")) {
if (in == null) {
throw new IllegalStateException("not found default-default-application.yml");
}
Yaml yaml = new Yaml();
Object loaded = yaml.load(in);
if (loaded instanceof Map<?, ?>) {
flattenAndAdd(properties, "", (Map<String, Object>) loaded);
}
}
catch (Exception ex) {
throw new IllegalStateException("parse default-default-application.yml failed", ex);
}
}
@SuppressWarnings("unchecked")
private void flattenAndAdd(ApplicationProperties props, String prefix, Map<String, Object> map) {
for (Map.Entry<String, Object> entry : map.entrySet()) {
String key = prefix.isEmpty() ? entry.getKey() : prefix + "." + entry.getKey();
Object value = entry.getValue();
if (value instanceof Map) {View on GitHub (pinned to f82da0b50f)
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
Example fix
// before (missing resource in pom filter) <resource><directory>src/main/resources</directory><excludes><exclude>templates/**</exclude></excludes></resource> // after <resource><directory>src/main/resources</directory></resource>
Defensive patterns
Strategy: try-catch
Validate before calling
boolean present = getClass().getClassLoader().getResource("templates/default-application.yml") != null;
if (!present) { throw new IllegalStateException("default-application.yml missing from classpath"); } Type guard
boolean templateAvailable(ClassLoader cl) {
return cl.getResource("templates/default-application.yml") != null;
} Try / catch
try {
customizer.customize(properties);
} catch (IllegalStateException e) {
log.error("Default application template missing: {}", e.getMessage(), e);
// fall back to programmatic defaults
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "Config file not found": what it means and how to fix it in docker-sync, Maven, Vagrant, Turborepo and other tools — this error's family across 60 libraries.
Related errors
- parse default-default-application.yml failed
- Could not find lib directory in resources
- BuildToolSchemaError
- Type "token" is not allowed.
- MISSING_PARAMS
AI-assisted analysis of alibaba/spring-ai-alibaba@f82da0b50f (2026-09-09).
Data as JSON: /api/errors/62b5b0a37a87dd32.
Report an issue: GitHub.