Re: Reference annotation null instance with javax.jms.ConnectionFactory

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Reference annotation null instance with javax.jms.ConnectionFactory

jbonofre
Unfortunately your message is not well formatted and not easy to read.

You can use @Reference to get a javax.jms.ConnectionFactory service (using a
filter if you want).

Is it your question ?

Regards
JB

On 07/28/2017 01:54 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 = singletonProvided by :  activemq-cf
> (38)**karaf@root()> jndi:names            JNDI Name                      │
> Class Nameosgi:service/jms/activemq-moss │
> org.apache.activemq.jms.pool.PooledConnectionFactoryosgi:service/mossorder
> │ org.postgresql.jdbc2.optional.SimpleDataSourceosgi: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/Reference-annotation-null-instance-with-javax-jms-ConnectionFactory-tp4051118.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>

--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Reference annotation null instance with javax.jms.ConnectionFactory

fpapon
Yes I see before sending the post :(

I post a new message well formatted
Loading...