-
Notifications
You must be signed in to change notification settings - Fork 0
Common Errors
Common errors and issues encountered during QQQ development, along with their solutions and prevention strategies.
Error: Unsupported class file major version X
Cause: Using Java version older than 17
Solution:
# Check Java version
java -version
# Must show Java 17 or higher
# If not, install Java 17+ and set JAVA_HOME
export JAVA_HOME=/path/to/java17
export PATH=$JAVA_HOME/bin:$PATHPrevention: Always verify Java version before building
Error: Plugin execution not covered by lifecycle configuration
Cause: Maven version too old (QQQ requires 3.8+)
Solution:
# Check Maven version
mvn -version
# Must show Maven 3.8 or higher
# If not, update Maven
brew install maven # macOS
# or download from maven.apache.orgPrevention: Use Maven 3.8+ for QQQ development
Error: Coverage check failed
Cause: Test coverage below required thresholds (80% instructions, 95% classes)
Solution:
# Check current coverage
mvn jacoco:report
# View coverage report
open target/site/jacoco/index.html
# Add tests for uncovered code
# Focus on instruction coverage firstPrevention: Write tests alongside code, maintain coverage as you develop
Error: Checkstyle violations found
Cause: Code doesn't follow QQQ style rules
Solution:
# Check style violations
mvn checkstyle:check
# Fix formatting issues
# Import Kingsrook code style in IntelliJ
# Use auto-format (Cmd+Alt+L on macOS)
# Verify fixes
mvn checkstyle:checkPrevention: Use QQQ IDE configuration, run checkstyle locally before committing
Error: QContext not initialized
Cause: Missing QContext setup in tests
Solution:
// ❌ WRONG - Missing context
@Test
void testMyFeature()
{
// Test without QContext
action.execute(input); // Will fail
}
// ✅ CORRECT - Proper context setup
@Test
void testMyFeature()
{
// BaseTest handles QContext automatically
super.setUp();
// Your test logic
action.execute(input); // Will work
}Prevention: Always extend BaseTest or manually manage QContext
Error: Backend not found: memory
Cause: Memory backend not properly configured in tests
Solution:
@Test
void testWithMemoryBackend()
{
// BaseTest provides memory backend automatically
// If you need custom setup:
QInstance instance = TestUtils.defineInstance();
instance.addBackend(new MemoryBackend());
QContext.init(instance, TestUtils.newSession());
// Your test logic
}Prevention: Use BaseTest or TestUtils.defineInstance() for test setup
Error: Tests affecting each other Cause: Shared state between tests Solution:
@BeforeEach
void setUp()
{
super.setUp(); // BaseTest handles cleanup
// Additional setup if needed
// Each test gets fresh state
}
@AfterEach
void tearDown()
{
// BaseTest handles cleanup automatically
super.tearDown();
}Prevention: Use BaseTest, avoid static state, clean up in @AfterEach
Error: QInstance not found in context
Cause: QContext not properly initialized
Solution:
// ❌ WRONG - Missing context initialization
public void myMethod()
{
QInstance instance = QContext.getQInstance(); // Will be null
}
// ✅ CORRECT - Proper context setup
public void myMethod()
{
QContext.init(instance, session);
try
{
QInstance instance = QContext.getQInstance(); // Will work
// Your logic
}
finally
{
QContext.clear(); // Always clean up
}
}Prevention: Always initialize QContext before use, clean up in finally block
Error: Backend module not found: mymodule
Cause: Backend module not properly registered
Solution:
// ❌ WRONG - Missing registration
public class MyBackendModule implements QBackendModuleInterface
{
// Implementation without registration
}
// ✅ CORRECT - Self-registering module
public class MyBackendModule implements QBackendModuleInterface
{
static
{
// Register with QQQ's module system
QBackendModuleDispatcher.register(new MyBackendModule());
}
// Implementation
}Prevention: Always register backend modules in static initialization blocks
Error: Metadata producer not found for type X
Cause: Metadata producer not properly configured
Solution:
// ❌ WRONG - Missing producer configuration
QInstance instance = new QInstance();
// No metadata producers configured
// ✅ CORRECT - Configure metadata producers
QInstance instance = new QInstance();
instance.addMetaDataProducer(new MyMetaDataProducer());
// Or use MetaDataProducerHelper
MetaDataProducerHelper.populateInstance(instance);Prevention: Configure metadata producers or use helper methods
Error: Required environment variable not set
Cause: Missing required environment configuration
Solution:
# Check environment setup
setup-environments.sh --qqq
# Verify .env files exist
ls -la .env*
# Check specific variables
echo $DB_URL
echo $API_KEYPrevention: Run setup-environments.sh after cloning repository
Error: Database connection failed
Cause: Database configuration or connectivity issues
Solution:
# Check configuration
qqq:
database:
backend: "rdbms"
connection:
url: "jdbc:postgresql://localhost:5432/mydb"
username: "${DB_USERNAME}"
password: "${DB_PASSWORD}"
# Add connection pool settings
pool-size: 10
timeout: 30sPrevention: Test database connectivity, use connection pooling, handle timeouts
Error: Port 8080 already in use
Cause: Another service using the same port
Solution:
# Check what's using the port
lsof -i :8080
# Kill the process or change port
kill -9 <PID>
# Or change QQQ port in configuration
qqq:
server:
port: 8081 # Use different portPrevention: Use dynamic port allocation or configure unique ports
Error: Code formatting doesn't match QQQ standards Cause: IDE not using QQQ code style Solution:
-
Import code style:
qqq-dev-tools/intellij/Kingsrook_Code_Style.xml -
Import copyright:
qqq-dev-tools/intellij/Kingsrook_Copyright_Profile.xml - Install plugin: Kingsrook Commentator Plugin
- Enable auto-format: Actions on Save → Reformat Code
Prevention: Always import QQQ IDE configuration files
Error: Checkstyle violations not showing in IDE Cause: Checkstyle plugin not properly configured Solution:
- Install plugin: Checkstyle-IDEA
-
Configure rules: Use
qqq/checkstyle/config.xml - Set scope: Apply to project files
- Enable real-time: Checkstyle runs as you type
Prevention: Verify plugin installation and configuration
Error: QQQ live templates not working Cause: Templates not imported Solution:
-
Import templates:
qqq-dev-tools/intellij/live-templates/ - Restart IDE: After importing templates
- Verify shortcuts: Check template abbreviations
- Test templates: Try common QQQ patterns
Prevention: Import live templates during initial setup
Error: Builds taking too long Cause: Inefficient build configuration or dependencies Solution:
# Use parallel builds
mvn clean install -T 1C
# Skip tests for faster iteration
mvn clean install -DskipTests
# Build only changed modules
mvn clean install -pl qqq-backend-core
# Use offline mode if dependencies cached
mvn clean install -oPrevention: Use incremental builds, parallel execution, skip tests during development
Error: OutOfMemoryError during build
Cause: Insufficient memory for Maven
Solution:
# Increase Maven memory
export MAVEN_OPTS="-Xmx2g -XX:MaxPermSize=512m"
# Or set in IDE
# IntelliJ → Help → Edit Custom VM Options
-Xmx2g
-XX:MaxPermSize=512mPrevention: Set appropriate memory limits for your system
Error: Tests timing out Cause: Long-running tests or infinite loops Solution:
# Increase test timeout
mvn test -Dtest.timeout=300
# Run specific slow test
mvn test -Dtest=SlowTest#slowMethod
# Profile test execution
mvn test -Dtest.timeout=600Prevention: Set reasonable timeouts, avoid infinite loops, mock external dependencies
Error: Dependency convergence errors
Cause: Conflicting dependency versions
Solution:
# Check dependency tree
mvn dependency:tree
# Resolve conflicts
mvn dependency:resolve
# Update QQQ dependencies
update-all-qqq-deps.sh
# Clean and rebuild
mvn clean installPrevention: Use QQQ's dependency management tools, avoid version conflicts
Error: Class not found
Cause: Missing required dependencies
Solution:
<!-- Check pom.xml for missing dependencies -->
<dependency>
<groupId>com.kingsrook.qqq</groupId>
<artifactId>qqq-backend-core</artifactId>
<version>${qqq.version}</version>
</dependency>
<!-- Add missing dependencies -->
<dependency>
<groupId>missing.group</groupId>
<artifactId>missing-artifact</artifactId>
<version>1.0.0</version>
</dependency>Prevention: Review dependency requirements, use QQQ's module structure
- Verify environment: Java 17+, Maven 3.8+, QQQ dev tools
- Import IDE config: Code style, copyright, live templates
- Run initial build: Ensure everything works from start
- Check documentation: Understand QQQ patterns and standards
- Run tests frequently: Catch issues early
- Check style locally: Run checkstyle before committing
- Maintain coverage: Write tests as you code
- Follow patterns: Use established QQQ conventions
-
Full build:
mvn clean install -
Style check:
mvn checkstyle:check -
Test coverage:
mvn verify - Self-review: Check your code as if reviewing it
- Check this page: Look for similar errors
- Search issues: Look for reported problems
- Check logs: Review error details and stack traces
- Ask community: Use GitHub issues or discussions
When asking for help, include:
- Error message: Exact error text
- Environment: OS, Java version, Maven version
- Steps: How to reproduce the error
- Logs: Relevant log output or stack traces
- Building Locally - Build issues
- Testing - Testing problems