问题
I tried to send events from WSO2 SP to activeMQ via siddhi-io-jms extension, but i have following error. Error connecting to JMS provider. NamingException while obtaining initial context. I have followed this doc for support jms transporting https://docs.wso2.com/display/SP400/Supporting+Different+Transports, put all necessary jar files to lib, also I set correctly @sink in siddhi app, factory.initial and provider.url are correct. Any idea, why SP can't connect to jms?
回答1:
According to OSGi JNDI spec, all the InitialContextFactories should be exposed as OSGi services. But activemq-client-5.x.x.jar file doesn't contain SPI, but rather they set system properties. This causes the NamingException while obtaining initial context. So we need to register those ICF to OSGi env.
For this we need to use the icf-provider.(sh|bat) tool within SP_HOME/bin. This will add a BundleActivator to the user provided jar/bundle which will register the user mentioned ICF implementation according to the OSGi JNDI spec.
e.g.
./icf-provider.sh org.apache.activemq.jndi.ActiveMQInitialContextFactory <Jar Directory/activemq-client-5.9.0.jar> <Destination>
Refer https://github.com/wso2-extensions/siddhi-io-jms/
来源:https://stackoverflow.com/questions/49506291/siddhi-error-connecting-to-jms-provider