activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cameleer <kai.reich...@gmail.com>
Subject activemq-broker and osgi service registry
Date Tue, 12 Nov 2013 12:33:47 GMT
I've successfully installed an ActiveMQ 5.9.0 server in karaf-2.3.3 with the
following command:

 karaf@root> features:chooseurl activemq 5.9.0
 karaf@root> features:install activemq-broker

The default configuration file activemq.xml is placed in the /etc directory.
So far so good. Now I want to register the "pooledConnectionFactory" bean to
the OSGi service registry.

Since the configuration file activemq.xml is spring xml I thought I could
just add the osgi namespace like so:

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:amq="http://activemq.apache.org/schema/core" 
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:osgi="http://www.springframework.org/schema/osgi" 
  xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
  http://activemq.apache.org/schema/core
http://activemq.apache.org/schema/core/activemq-core.xsd
  http://activemq.apache.org/camel/schema/spring
http://activemq.apache.org/camel/schema/spring/camel-spring.xsd
  http://www.springframework.org/schema/osgi
http://www.springframework.org/schema/osgi/spring-osgi.xsd">
  
   …
   
  <bean class="org.apache.activemq.pool.PooledConnectionFactory"
id="pooledConnectionFactory">
    <property name="maxConnections" value="8"/>
		<property name="connectionFactory" ref="activemqConnectionFactory"/>
	</bean>

	<osgi:service ref="pooledConnectionFactory">
		<osgi:interfaces>
			<value>javax.jms.ConnectionFactory</value>
		</osgi:interfaces>
		<osgi:service-properties>
			<entry key="name" value="localhost"/>
		</osgi:service-properties>
	</osgi:service>
</beans>

At startup I ran into the following exception:

org.osgi.service.cm.ConfigurationException: null : Cannot start the broker
	at
org.apache.activemq.osgi.ActiveMQServiceFactory.updated(ActiveMQServiceFactory.java:110)[98:org.apache.activemq.activemq-osgi:5.9.0]
	at
org.apache.felix.cm.impl.helper.ManagedServiceFactoryTracker.provideConfiguration(ManagedServiceFactoryTracker.java:88)[5:org.apache.felix.configadmin:1.6.0]
	at
org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceFactoryUpdate.provide(ConfigurationManager.java:1593)[5:org.apache.felix.configadmin:1.6.0]
	at
org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceFactoryUpdate.run(ConfigurationManager.java:1536)[5:org.apache.felix.configadmin:1.6.0]
	at
org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:103)[5:org.apache.felix.configadmin:1.6.0]
	at java.lang.Thread.run(Thread.java:724)[:1.7.0_40]
*Caused by: org.springframework.beans.factory.BeanDefinitionStoreException:
Unrecognized xbean namespace mapping:
http://www.springframework.org/schema/osgi*
	at
org.apache.xbean.spring.context.v2c.XBeanNamespaceHandler.parseBeanFromExtensionElement(XBeanNamespaceHandler.java:284)[97:org.apache.xbean.spring:3.14.0]
	at
org.apache.xbean.spring.context.v2c.XBeanNamespaceHandler.parse(XBeanNamespaceHandler.java:156)[97:org.apache.xbean.spring:3.14.0]
	at
org.apache.xbean.spring.context.v2.XBeanNamespaceHandler.parse(XBeanNamespaceHandler.java:49)[97:org.apache.xbean.spring:3.14.0]
	at
org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1438)[61:org.springframework.beans:3.2.4.RELEASE]
	at
org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1428)[61:org.springframework.beans:3.2.4.RELEASE]
	at
org.apache.xbean.spring.context.v2.XBeanBeanDefinitionDocumentReader.parseBeanDefinitions(XBeanBeanDefinitionDocumentReader.java:84)[97:org.apache.xbean.spring:3.14.0]
	at
org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:139)[61:org.springframework.beans:3.2.4.RELEASE]
	at
org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:108)[61:org.springframework.beans:3.2.4.RELEASE]
	at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:493)[61:org.springframework.beans:3.2.4.RELEASE]
	at
org.apache.xbean.spring.context.v2.XBeanXmlBeanDefinitionReader.registerBeanDefinitions(XBeanXmlBeanDefinitionReader.java:79)[97:org.apache.xbean.spring:3.14.0]
	at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390)[61:org.springframework.beans:3.2.4.RELEASE]
	at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)[61:org.springframework.beans:3.2.4.RELEASE]
	at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)[61:org.springframework.beans:3.2.4.RELEASE]
	at
org.apache.xbean.spring.context.ResourceXmlApplicationContext.loadBeanDefinitions(ResourceXmlApplicationContext.java:111)[97:org.apache.xbean.spring:3.14.0]
	at
org.apache.xbean.spring.context.ResourceXmlApplicationContext.loadBeanDefinitions(ResourceXmlApplicationContext.java:104)[97:org.apache.xbean.spring:3.14.0]
	at
org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130)[63:org.springframework.context:3.2.4.RELEASE]
	at
org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:537)[63:org.springframework.context:3.2.4.RELEASE]
	at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:451)[63:org.springframework.context:3.2.4.RELEASE]
	at
org.apache.activemq.osgi.ActiveMQServiceFactory.updated(ActiveMQServiceFactory.java:90)[98:org.apache.activemq.activemq-osgi:5.9.0]
	... 5 more

If I have to register another self instantiated ConnectionFactory in another
osgi bundle (or blueprint/spring-file) how can I enforce activemq-broker to
be started first?

In a production environment it may even make sense to register a connection
factory per application/bundle, just because every application may have
different access credentials.
But at some point it's convienent to share a global connection factory to
keep the utilized resources low.


Any great ideas?



--
View this message in context: http://activemq.2283324.n4.nabble.com/activemq-broker-and-osgi-service-registry-tp4674205.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Mime
View raw message