redisson/redisson · error · CacheException

Can't parse default config

Error message

Can't parse default config

What it means

Wrapped as CacheException('Can't parse default config') when Config.fromYAML(new File(configPath)) throws while parsing the Redisson YAML located by the 'hibernate.cache.redisson.config' property (filesystem variant of loadConfig). The underlying exception (unreadable file, malformed YAML, invalid Redisson schema values) is attached as the cause.

Source

Thrown at redisson-hibernate/redisson-hibernate-6/src/main/java/org/redisson/hibernate/RedissonRegionFactory.java:124

            String configPath = ConfigurationHelper.getString(REDISSON_CONFIG_PATH, properties);
            config = loadConfig(RedissonRegionFactory.class.getClassLoader(), configPath);
            if (config == null) {
                config = loadConfig(configPath);
            }
        }
        
        if (config == null) {
            throw new CacheException("Unable to locate Redisson configuration");
        }

        return Redisson.create(config);
    }
    
    private Config loadConfig(String configPath) {
        try {
            return Config.fromYAML(new File(configPath));
        } catch (IOException e) {
            throw new CacheException("Can't parse default config", e);
        }
    }
    
    private Config loadConfig(ClassLoader classLoader, String fileName) {
        InputStream is = classLoader.getResourceAsStream(fileName);
        if (is != null) {
            try {
                return Config.fromYAML(is);
            } catch (Exception e) {
                throw new CacheException("Can't parse config", e);
            }
        }
        return null;
    }

    @Override
    protected void releaseFromUse() {
        redisson.shutdown();

View on GitHub (pinned to 91188987c2)

Solutions

  1. Read the caused-by chain: CacheException.getCause() carries the exact YAML/parse error with line numbers.
  2. Validate the file standalone: new Config().fromYAML(...) or redisson CLI/tooling against the same file the property points to.
  3. Fix the reported YAML issue (indentation, key names, redis:// URL scheme for addresses).
  4. Confirm the property points to the file you actually edited (classpath resource vs working-dir-relative File).

Example fix

// before: redisson.yaml with an invalid address scheme
singleServerConfig:
  address: "localhost:6379"   # missing redis:// prefix
# -> CacheException: Can't parse default config

// after
singleServerConfig:
  address: "redis://localhost:6379"
Defensive patterns

Strategy: try-catch

Validate before calling

// Pre-validate the exact config the factory will read
org.redisson.config.Config test = new org.redisson.config.Config();
try (InputStream in = getClass().getClassLoader().getResourceAsStream("redisson.yaml")) {
    if (in == null) throw new IllegalStateException("redisson.yaml not on classpath");
    org.redisson.config.Config.fromYAML(in); // throws early if the YAML is broken
}

Try / catch

try (InputStream in = cl.getResourceAsStream(path)) {
    config = Config.fromYAML(in);
} catch (Exception e) {
    throw new IllegalStateException("Redisson config " + path + " is unparseable: " + e.getMessage(), e);
}

Prevention

When it happens

Trigger: hibernate.cache.redisson.config resolves to an existing file whose content is not valid Redisson YAML (bad indentation, unknown keys, wrong scalar types), or the file cannot be read (permissions, missing on disk at runtime).

Common situations: Hand-edited YAML with tab indentation; using JSON in a .yaml file; copying a cluster config into singleNodeAddress; environment-specific file replaced by CI; values like addresses missing the redis:// scheme.

Related errors


AI-assisted analysis of redisson/redisson@91188987c2 (2026-08-14). Data as JSON: /api/errors/7edfb03bed210298. Report an issue: GitHub.