activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "metatech (JIRA)" <>
Subject [jira] [Commented] (AMQ-3692) ActiveMQ OSGi bundle should be stopped when broker stops itself
Date Thu, 15 Jan 2015 10:21:35 GMT


metatech commented on AMQ-3692:

Here is a workaround that allows to use the Blueprint XBean syntax, with "blueprint.aries.xml-validation:=false".
I did not find how to enhance the validator to allow it yet.
<blueprint xmlns=""
        Bundle-SymbolicName: activemq-broker.xml; blueprint.aries.xml-validation:=false

            <bean class="org.apache.activemq.util.osgi.BrokerBundleWatcher"  xmlns="">
                <property name="bundleContext" ref="blueprintBundleContext"/>


Without it, the error is the following in ServiceMix 4.5.3 : 

Unable to start blueprint container for bundle activemq-broker.xml
org.osgi.service.blueprint.container.ComponentDefinitionException: Unable to validate xml
        at org.apache.aries.blueprint.container.Parser.validate(
        at org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(
        at java.util.concurrent.Executors$
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(
        at java.util.concurrent.ScheduledThreadPoolExecutor$
        at java.util.concurrent.ThreadPoolExecutor.runWorker(
        at java.util.concurrent.ThreadPoolExecutor$
Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is
strict, but no declaration can be found for element 'bean'.

> ActiveMQ OSGi bundle should be stopped when broker stops itself
> ---------------------------------------------------------------
>                 Key: AMQ-3692
>                 URL:
>             Project: ActiveMQ
>          Issue Type: New Feature
>          Components: Broker
>    Affects Versions: 5.4.2
>         Environment: ServiceMix 4.3
>            Reporter: metatech
>            Assignee: Hiram Chirino
>             Fix For: 5.9.0
>         Attachments: BrokerBundleWatcher.patch, BrokerBundleWatcher_v2.patch, BrokerBundleWatcher_v3.patch,
BrokerService.patch, activemq-broker.xml
> In case of error, the ActiveMQ broker can stop itself.
> In an OSGi/Blueprint environment, the bundle is however still in Active/Created state,
which misleads an external monitoring software into thinking that the broker is running fine.
> This patch stops the bundle when the broker stops itself.
> This patch can also auto-restart the bundle, which will restart the broker.
> This is critical in an Master/Slave configuration : when the connection to the database
is lost, the broker cannot maintain the DB exclusive lock, and it stops itself.  The bundle
should be stopped and started again, so that it enters again the "Creating" state, in which
it waits to obtain the DB lock again.
> The class "BrokerBundleWatcher" needs to be registered with the "shutdownHooks" property
of the ActiveMQ "BrokerService".  However, there is a limitation with the XBean syntax in
a Blueprint XML, which does not allow to define inner beans.  The workaround is to define
the "activemq-broker.xml" in full native Blueprint syntax (no XBean).
> The patch also provides a modified version of the BrokerService, that injects its own
reference into the ShutdownHook's which implement the "BrokerServiceAware" interface.

This message was sent by Atlassian JIRA

View raw message