Troubleshooting¶
This guide helps you diagnose and resolve common issues when using Forage.
Quick Diagnostics¶
Before diving into specific issues, try these diagnostic steps:
# Validate properties without running
camel run * --strict
# Enable debug logging
camel run * --logging-level=DEBUG
# Check Forage plugin installation
camel plugin list | grep forage
Common Configuration Issues¶
Missing Required Properties¶
Error:
Causes: - Property not set in any configuration source - Typo in property name - Wrong file location
Solutions:
-
Check property naming:
-
Verify file location:
- Properties files must be in the working directory
- Or set
FORAGE_CONFIG_DIRenvironment variable -
Or include in classpath
-
Check environment variable format:
Property Typos and Unknown Properties¶
Error:
Solution:
Use property validation to catch typos before runtime:
The validator uses Levenshtein distance to suggest corrections. See the Property Validation guide for details.
Bean Reference Errors¶
Error:
Causes: - Bean name doesn't match property prefix - Provider not on classpath - ServiceLoader registration missing
Solutions:
- Verify bean name matches prefix:
# Reference must match exactly
- to:
uri: sql
parameters:
dataSource: "#myDatabase" # Must match prefix
- Check provider dependency:
Runtime-Specific Issues¶
Camel JBang¶
Plugin Not Found¶
Error:
Solution:
Install or reinstall the plugin:
Verify installation:
Dependencies Not Resolved¶
Error:
Cause: - No forage.* properties in configuration files - Plugin not detecting properties
Solution:
- Ensure properties file exists with
forage.*keys - Run from directory containing properties files
- Check plugin is installed:
camel plugin list
Spring Boot¶
Beans Not Auto-Configured¶
Error:
Causes: - Missing starter dependency - AutoConfiguration.imports not found - Properties not in Spring Environment
Solutions:
-
Add starter dependency:
-
Check auto-configuration:
Look for ForageDataSourceAutoConfiguration in output.
- Verify properties location:
- Must be in
application.propertiesorapplication.yml - Or use
@PropertySourceto load custom files
Property Precedence Issues¶
Issue: Spring Environment properties override Forage ConfigStore.
Expected behavior: 1. Environment variables (highest) 2. System properties 3. Spring application.properties 4. Forage properties files (lowest)
Solution:
Use Spring's property syntax in application.properties:
# Spring Boot style
forage.myDb.jdbc.url=${DATABASE_URL:jdbc:postgresql://localhost:5432/db}
forage.myDb.jdbc.username=${DB_USER:admin}
Debugging Techniques¶
Enable Debug Logging¶
# Camel JBang
camel run * --logging-level=DEBUG
# Spring Boot
java -jar app.jar --logging.level.io.kaoto.forage=DEBUG
# Quarkus
mvn quarkus:dev -Dquarkus.log.category."io.kaoto.forage".level=DEBUG
Inspect Camel Registry¶
// List all beans
camelContext.getRegistry().findByType(DataSource.class)
.forEach((name, bean) ->
System.out.println("Bean: " + name + " = " + bean));
// Lookup specific bean
DataSource ds = camelContext.getRegistry()
.lookupByNameAndType("myDb", DataSource.class);
Validate Properties¶
# Strict mode - fail on warnings
camel run * --strict
# Show all warnings
camel run * # Warnings printed but doesn't fail
Camel JBang Debugging¶
For Java debugging and standard JBang debugging techniques, see the Camel JBang documentation.
Getting Help¶
If you're still stuck after trying these solutions:
- Check the documentation:
- Core Concepts
- Configuration System
-
Search existing issues:
-
Ask for help:
- GitHub Discussions
-
Include error messages, configuration, and Forage version
-
Report a bug:
- Create an issue
- Include minimal reproducible example