Better here ;)

Your SCR component is immediate ?

Regards
JB

On 07/28/2017 01:55 PM, fpapon wrote:
Hi,

I'm using SCR to get instance of service like LogService, ConfigurationAdmin
and it work well.
I tried to do the same with JMS Factory with the activemq-cf feature and my
service can't resolve the ConnectionFactory...

*  @Reference
   private LogService logService;*
* @Reference
   private ConfigurationAdmin configAdmin;*
* @Reference(target="(osgi.jndi.service.name=jms/activemq-moss)")
   private ConnectionFactory jmsConnectionFactory;*

In console :

*karaf@root()> service:list ConnectionFactory
15:48:40
[javax.jms.ConnectionFactory]
-----------------------------
  osgi.jndi.service.name = jms/activemq-moss
  service.bundleid = 38
  service.id = 180
  service.scope = singleton
Provided by :
  activemq-cf (38)

*karaf@root()> jndi:names
JNDI Name                      │ Class Name

osgi:service/jms/activemq-moss │
org.apache.activemq.jms.pool.PooledConnectionFactory
osgi:service/mossorder         │
org.postgresql.jdbc2.optional.SimpleDataSource
osgi:service/jndi              │
org.apache.karaf.jndi.internal.JndiServiceImpl*


when installing the feature :
*
resolution:=mandatory [caused by: Unable to resolve
myservice/1.0.0.SNAPSHOT: missing requirement [myservice/1.0.0.SNAPSHOT]
osgi.service; filter:="(objectClass=javax.jms.ConnectionFactory)";
effective:=active]]*


However, if I do this in the activate method of my service :

*
jmsConnectionFactory =
bndContext.getService(bndContext.getServiceReferences(ConnectionFactory.class, "(osgi.jndi.service.name=jms/activemq-moss)").iterator().next());*

It's work !







--
View this message in context: 
http://karaf.922171.n3.nabble.com/Karaf-4-0-1-Reference-annotation-null-instance-with-javax-jms-ConnectionFactory-tp4051119.html
Sent from the Karaf - User mailing list archive at Nabble.com.


--
Jean-Baptiste Onofré
jbono...@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Reply via email to