activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Amichai Rothman (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (AMQ-4777) ActiveMQ broker silently fails to start in Karaf
Date Sun, 06 Oct 2013 16:14:44 GMT

    [ https://issues.apache.org/jira/browse/AMQ-4777?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13787659#comment-13787659
] 

Amichai Rothman commented on AMQ-4777:
--------------------------------------

Update: I followed up on my original direction of investigation, and found out that both dosgi
and an app custom feature had included the osgi compendium bundle as a dependency, and the
latter even had osgi core specified in it. Manually removing the three bundle references from
the features xml files in karaf/system folder before first launching Karaf seems to resolve
the issue. While there is now a usable workaround, there are still a few open questions which
hopefully someone can answer:

1. Should these bundles be referenced in the custom feature? It is created by karaf-maven-plugin
(3.0.0-SNAPSHOT) with includeTransitiveDependency set to true for offline deployment. In the
poms that define them as dependencies they have scope set to 'provided'. Should such provided
bundles be included in a feature definition or not? Is this a bug? It's good for completeness
and documenting the real dependencies, but it also seems to break things here. Perhaps features
should support some form of 'provided' attribute for dependencies?

2. Is Karaf supposed to do anything about such provided dependencies, or just ignore them
since they are already provided? Is this a bug?

3. How exactly do these bundle references cause ActiveMQ to fail?

4. Why does ActiveMQ fail silently and not show an error anywhere?

5. What can be improved in order to either protect against such occurrences (if they are to
be flagged as invalid) or make it clearer where the problem lies for future instances of this
error (this might happen with features other than ActiveMQ)?

Any further insights would be appreciated :-)


> ActiveMQ broker silently fails to start in Karaf
> ------------------------------------------------
>
>                 Key: AMQ-4777
>                 URL: https://issues.apache.org/jira/browse/AMQ-4777
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: OSGi/Karaf
>    Affects Versions: 5.8.0
>         Environment: Kubuntu 64-bit, Oracle JDK 7u40, Karaf 2.3.3
>            Reporter: Amichai Rothman
>            Assignee: Jean-Baptiste Onofré
>
> I have an application, deployed into Karaf. I install the activemq-broker feature, and
one of the app bundles uses ActiveMQConnectionFactory to get a javax.jms.Connection instance
and then uses the JMS API only (no other ActiveMQ-specific APIs in use). I'll note that this
bundle depends on another bundle which uses the JMS API as well (no ActiveMQ imports there
at all). The application also depends on other karaf features such as cxf-dosgi.
> ActiveMQ fails to start in a couple of ways, depending on the order of installation of
the features and app:
> At first I got a LinkageError:
> java.lang.LinkageError: loader constraint violation: when resolving method "org.apache.activemq.ActiveMQConnectionFactory.createConne
> ction()Ljavax/jms/Connection;" the class loader (instance of org/eclipse/osgi/internal/baseadaptor/DefaultClassLoader)
of the current
>  class, com/myprojectgroup/bus/activemq/ActiveMQSession, and the class loader (instance
of org/eclipse/osgi/internal/baseadaptor/D
> efaultClassLoader) for resolved class, org/apache/activemq/ActiveMQConnectionFactory,
have different Class objects for the type Ljava
> x/jms/Connection; used in the signature
>         at com.myprojectgroup.bus.activemq.ActiveMQSession.createConnection(ActiveMQSession.java:38)
>         at com.myprojectgroup.messaging.jms.Session.open(Session.java:70)[68:com.myprojectgroup.messaging:0.1.0.SNAPSHOT]
>         at com.myprojectgroup.messaging.jms.Session$1.run(Session.java:108)[68:com.myprojectgroup.messaging:0.1.0.SNAPSHOT]
> The only bundle that exports the javax.jms package is org.apache.geronimo.specs.geronimo-jms_1.1_spec,
though after further investigation I found that the activemq-web-console bundle does have
another copy of it internally, which I think might be the cause of the conflict (it does not
import the package in the manifest, so I can't just remove the package from the jar since
it won't find the package exported by the geronimo-jms bundle without a corresponding import
declaration). The activemq-osgi bundle has a DynamicImport-Package: *, which may further complicate
things. If it also had an explicit Import-Package directive for the statically-linked classes
it uses such as javax.jms ones, perhaps it would go through the regular bundle classloading
mechanism and avoid the problem - I think it takes precedence over dynamic imports, though
I'm not sure).
> Next, I played around with reordering the installation, and got to another failure mode
where there is no exception at all or any error in the logs, but the broker simply fails to
start silently. Perhaps this is also caused by classloader issues but they are just occurring
somewhere within ActiveMQ and being silently ignored. This mode of failure I've managed to
recreate easily:
> On a fresh stock installation of Karaf 2.3.3,  add two feature urls:
> features:addurl mvn:org.apache.activemq/activemq-karaf/5.8.0/xml/features mvn:org.apache.cxf.dosgi/cxf-dosgi/1.6-SNAPSHOT/xml/features
> (you might need to add the apache snapshot repo to karaf for it to find the dosgi snapshot
feature)
> And then install them in this order:
> features:install -v cxf-dosgi-discovery-distributed activemq-broker
> The broker will not be started, although the logs will have no errors.
> Strangely, if you now uninstall the activemq-web-console bundle (not feature) and restart
karaf, the broker will start ok. Also if you install only activemq-broker and not dosgi, it
will start ok.
> To simplify, I found that instead of the dosgi feature it's enough to install and start
the mvn:org.osgi/org.osgi.compendium/4.3.1 bundle before installing activemq-broker to make
it fail - this is from looking at the innards of the dosgi feature, however if I remove this
bundle from the feature the broker still fails to start, so it's not the only bundle causing
problems, but just an example.
> The only workaround I've found so far is to install everything, then uninstall the activemq-web-console
bundle and restart - then everything works as it should. Strangely, not installing it in the
first place doesn't work either - the broker won't start unless the web console is first started,
then uninstalled.
> Some details of the LinkageError are in http://pastebin.com/TKZt7hUA (pasted to karaf
irc channel originally).



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Mime
View raw message