'Unable To Send Message to ASB Queue from WSO2 EI 6.6.0 : Not an AMQP URL

I am trying to send message from WSO2 EI 6.6.0 to Microsoft Azure Service bus Queue by following this.

Prerequisite:

  • added queue in azure portal

queue

  • placed the following jar files in the <EI_HOME>/lib directory

JAR file

  • Added the transport sender configuration as below in <EI_HOME>/conf/axis2/axis2.xml file. axis2
  • Added the connection URL as shown below in <EI_HOME>/conf/jndi.properties file.

jndi

syntax:

connectionfactory.ASBQueueConnectionFactory = amqps://[PolicyName]:[EncodedSharedAccessKey]@[myNamespace].servicebus.windows.net
  • Server restart done after made all above changes.

while server starts,got below error log in wso2 ei server

[2022-03-29 12:06:39,699]  WARN {org.wso2.andes.jndi.PropertiesFileInitialContextFactory} - Unable to create factory:Not an AMQP URL amqps://RootManageSharedAccessKey:***@wso2asb.servicebus.windows.net
[2022-03-29 12:06:39,699] ERROR {org.wso2.carbon.inbound.endpoint.protocol.jms.factory.JMSConnectionFactory} - NamingException while obtaining initial context. Failed to parse entry: Not an AMQP URL amqps://RootManageSharedAccessKey:***@wso2asb.servicebus.windows.net due to : Not an AMQP URL: amqps://RootManageSharedAccessKey:***@wso2asb.servicebus.windows.net javax.naming.ConfigurationException: Failed to parse entry: Not an AMQP URL amqps://RootManageSharedAccessKey:***@wso2asb.servicebus.windows.net due to : Not an AMQP URL: amqps://RootManageSharedAccessKey:***@wso2asb.servicebus.windows.net [Root exception is Not an AMQP URL amqps://RootManageSharedAccessKey:***@wso2asb.servicebus.windows.net]
        at org.wso2.andes.jndi.PropertiesFileInitialContextFactory.createFactory(PropertiesFileInitialContextFactory.java:318)
        at org.wso2.andes.jndi.PropertiesFileInitialContextFactory.createConnectionFactories(PropertiesFileInitialContextFactory.java:187)
        at org.wso2.andes.jndi.PropertiesFileInitialContextFactory.getInitialContext(PropertiesFileInitialContextFactory.java:153)
        at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:694)
        at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:313)
        at javax.naming.InitialContext.init(InitialContext.java:244)
        at javax.naming.InitialContext.<init>(InitialContext.java:216)
        at org.wso2.carbon.inbound.endpoint.protocol.jms.factory.JMSConnectionFactory.<init>(JMSConnectionFactory.java:80)
        at org.wso2.carbon.inbound.endpoint.protocol.jms.factory.CachedJMSConnectionFactory.<init>(CachedJMSConnectionFactory.java:38)
        at org.wso2.carbon.inbound.endpoint.protocol.jms.JMSPollingConsumer.<init>(JMSPollingConsumer.java:78)
        at org.wso2.carbon.inbound.endpoint.protocol.jms.JMSProcessor.init(JMSProcessor.java:89)
        at org.apache.synapse.inbound.InboundEndpoint.init(InboundEndpoint.java:78)
        at org.apache.synapse.deployers.InboundEndpointDeployer.deploySynapseArtifact(InboundEndpointDeployer.java:57)
        at org.apache.synapse.deployers.AbstractSynapseArtifactDeployer.deploy(AbstractSynapseArtifactDeployer.java:200)
        at org.wso2.carbon.application.deployer.synapse.SynapseAppDeployer.deployArtifactType(SynapseAppDeployer.java:1099)
        at org.wso2.carbon.application.deployer.synapse.SynapseAppDeployer.deployArtifacts(SynapseAppDeployer.java:114)
        at org.wso2.carbon.application.deployer.internal.ApplicationManager.deployCarbonApp(ApplicationManager.java:272)
        at org.wso2.carbon.application.deployer.CappAxis2Deployer.deploy(CappAxis2Deployer.java:72)
        at org.apache.axis2.deployment.repository.util.DeploymentFileData.deploy(DeploymentFileData.java:136)
        at org.apache.axis2.deployment.DeploymentEngine.doDeploy(DeploymentEngine.java:807)
        at org.apache.axis2.deployment.repository.util.WSInfoList.update(WSInfoList.java:144)
        at org.apache.axis2.deployment.RepositoryListener.update(RepositoryListener.java:377)
        at org.apache.axis2.deployment.RepositoryListener.checkServices(RepositoryListener.java:254)
        at org.apache.axis2.deployment.DeploymentEngine.loadServices(DeploymentEngine.java:135)
        at org.wso2.carbon.core.CarbonAxisConfigurator.deployServices(CarbonAxisConfigurator.java:568)
        at org.wso2.carbon.core.internal.DeploymentServerStartupObserver.completingServerStartup(DeploymentServerStartupObserver.java:51)
        at org.wso2.carbon.core.internal.CarbonCoreServiceComponent.notifyBefore(CarbonCoreServiceComponent.java:258)
        at org.wso2.carbon.core.internal.StartupFinalizerServiceComponent.completeInitialization(StartupFinalizerServiceComponent.java:166)
        at org.wso2.carbon.core.internal.StartupFinalizerServiceComponent.serviceChanged(StartupFinalizerServiceComponent.java:323)
        at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:113)
        at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:985)
        at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:234)
        at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:151)
        at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:866)
        at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:804)
        at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130)
        at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:228)
        at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:525)
        at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:544)
        at org.wso2.carbon.throttling.agent.internal.ThrottlingAgentServiceComponent.registerThrottlingAgent(ThrottlingAgentServiceComponent.java:118)
        at org.wso2.carbon.throttling.agent.internal.ThrottlingAgentServiceComponent.activate(ThrottlingAgentServiceComponent.java:96)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.eclipse.equinox.internal.ds.model.ServiceComponent.activate(ServiceComponent.java:260)
        at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.activate(ServiceComponentProp.java:146)
        at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build(ServiceComponentProp.java:345)
        at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(InstanceProcess.java:620)
        at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:197)
        at org.eclipse.equinox.internal.ds.Resolver.getEligible(Resolver.java:343)
        at org.eclipse.equinox.internal.ds.SCRManager.serviceChanged(SCRManager.java:222)
        at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:113)
        at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:985)
        at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:234)
        at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:151)
        at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:866)
        at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:804)
        at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130)
        at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:228)
        at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:525)
        at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:544)
        at org.wso2.carbon.core.init.CarbonServerManager.initializeCarbon(CarbonServerManager.java:529)
        at org.wso2.carbon.core.init.CarbonServerManager.removePendingItem(CarbonServerManager.java:305)
        at org.wso2.carbon.core.init.PreAxis2ConfigItemListener.bundleChanged(PreAxis2ConfigItemListener.java:118)
        at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:973)
        at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:234)
        at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:345)
Caused by: Not an AMQP URL amqps://RootManageSharedAccessKey:***@wso2asb.servicebus.windows.net
        at org.wso2.andes.url.URLHelper.parseError(URLHelper.java:141)
        at org.wso2.andes.url.URLHelper.parseError(URLHelper.java:136)
        at org.wso2.andes.client.url.URLParser.parseURL(URLParser.java:175)
        at org.wso2.andes.client.url.URLParser.<init>(URLParser.java:51)
        at org.wso2.andes.client.AMQConnectionURL.<init>(AMQConnectionURL.java:65)
        at org.wso2.andes.client.AMQConnectionFactory.<init>(AMQConnectionFactory.java:83)
        at org.wso2.andes.jndi.PropertiesFileInitialContextFactory.createFactory(PropertiesFileInitialContextFactory.java:312)
        ... 67 more

API Code:

<api xmlns="http://ws.apache.org/ns/synapse" name="SendToASB" context="/send2asb">
   <resource methods="POST">
      <inSequence>
         <property name="messageType" scope="axis2" type="STRING" value="application/json"/>
    <property name="ContentType" scope="axis2" type="STRING" value="application/json"/>
    <property name="OUT_ONLY" scope="default" type="STRING" value="true"/>
         <call>
           <endpoint key="jms://wso2eiqueue?transport.jms.ConnectionFactoryJNDIName=ASBQueueConnectionFactory&amp;java.naming.factory.initial=org.apache.qpid.amqp_1_0.jms.jndi.PropertiesFileInitialContextFactory&amp;java.naming.provider.url=conf/jndi.properties&amp;transport.jms.DestinationType=queue"/>
         </call>
         <respond/>
      </inSequence>
      <outSequence/>
   </resource>
</api>

When i hit above API via postman, below error i got in log.

[2022-03-29 12:30:55,705]  INFO {org.apache.synapse.mediators.builtin.LogMediator} - To: /send2asb, MessageID: urn:uuid:caa56ed0-0f1e-4fd3-bf91-b0953998b213, Direction: request, MESSAGE = Executing default 'fault' sequence, ERROR_CODE = 305100, ERROR_MESSAGE = Couldn't find the endpoint with the key : jms://wso2eiqueue?transport.jms.ConnectionFactoryJNDIName=ASBQueueConnectionFactory&java.naming.factory.initial=org.apache.qpid.amqp_1_0.jms.jndi.PropertiesFileInitialContextFactory&java.naming.provider.url=conf/jndi.properties&transport.jms.DestinationType=queue, Payload: {
    "SENDTO":"ASB"
}

Kindly let me know where i made mistake (thought like jndi file url)and help me to resolve this?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source