jahia-java-osgi

Implement and review OSGi components in Jahia Java modules.

Updated Mar 10, 2026
One-click install
npx skills add https://github.com/Jahia/formidable --skill jahia-java-osgi
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: jahia-java-osgi
Source: https://github.com/Jahia/formidable/tree/main/.agents/skills/jahia-java-osgi
Command: npx skills add https://github.com/Jahia/formidable --skill jahia-java-osgi

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill covers how to write OSGi components correctly in a Jahia Java module. It highlights proper usage of @Component lifecycle, @Reference, Export-Package, whiteboard services, and thread safety, including pitfalls that lead to NPEs, stale state, or leaked internals. Load this skill when implementing or reviewing any class annotated with @Component, @Reference, or @Activate.

Core Features & Use Cases

  • Correct patterns for SCR activation, configuration, and service references.
  • Clear guidance on avoiding common pitfalls and ensuring thread safety.
  • Use cases for real-world Jahia Java module development and review.

Quick Start

Follow the guidance to start validating and implementing OSGi components that align with Jahia best practices.

Frequently Asked Questions about jahia-java-osgi

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement OSGi components correctly in a Jahia Java module?

To implement OSGi components correctly in a Jahia Java module, follow documented patterns for SCR activation, configuration reloads, and service references using @Component, @Reference, and @Activate annotations to enforce lifecycle correctness and safe reference handling.

Why does my Jahia OSGi component throw a NullPointerException during activation?

A Jahia OSGi component throws a NullPointerException during activation due to improper @Reference handling or unsafe service binding. Enforcing correct OSGi lifecycle patterns and safe reference handling prevents these NPEs and avoids leaked internals.

What is the best way to handle configuration reloads in Jahia OSGi services?

The best way to handle configuration reloads in Jahia OSGi services is by applying documented practices for @Activate lifecycle management, ensuring clear configuration reload patterns that prevent stale state and maintain thread safety.

How do I ensure thread safety when using OSGi whiteboard services in Jahia?

To ensure thread safety when using OSGi whiteboard services in Jahia, apply correct OSGi patterns for service references and component lifecycle management, which mitigate stale state and ensure reliable concurrent execution.

Do I need to specify Export-Package when building Jahia Java modules?

You need to specify Export-Package when building Jahia Java modules to correctly expose your OSGi services. Proper usage of Export-Package alongside whiteboard services and @Component patterns prevents leaked internals.

When should I review Jahia Java classes for OSGi lifecycle pitfalls?

You should review Jahia Java classes annotated with @Component, @Reference, or @Activate whenever you need to validate lifecycle correctness, ensure thread safety, and identify pitfalls that lead to stale state or leaked internals during module development.