How to test WSO2 Message Broker with JMeter - jms

I'm having some issues getting JMeter to work against the WSO2 Message Broker using the JMS Publisher. I had JMeter working against ActiveMQ but I'm still new with the tool.
I copied the client libraries over to jmeter wso2mb-2.0.1\client-lib to apache-jmeter-2.9\lib
andes-client-0.13.wso2v4.jar
geronimo-jms_1.1_spec-1.1.0.wso2v1.jar
Settings:
Context Factory : org.wso2.andes.jndi.PropertiesFileInitialContextFactory
Provider Url : amqp://admin:admin#clientID/carbon?brokerlist='tcp://localhost:5672'
Connection Factory : qpidConnectionfactory
...also tried several other values
Destination: dynamicQueues/test
The error I'm getting is on the Connection Factory field.
I've tried several different values all of which generate a naming error like there is a setting missing.
When I leave it blank I get:
javax.naming.NamingException: Expected javax.jms.ConnectionFactory, found org.wso2.andes.jndi.ReadOnlyContext
Does anyone know what I'm missing here?
Suspect it's something simple.

I found the problem.
In short the qpid context factory org.wso2.andes.jndi.PropertiesFileInitialContextFactory does not use fields the same way as the activeMQ context factory org.apache.activemq.jndi.ActiveMQInitialContextFactory.
While ActiveMQ allows you to not use a separate properties file with Jmeter, Qpid does not.
Jmeter JMS Publisher:
Context Factory : org.wso2.andes.jndi.PropertiesFileInitialContextFactory
Provider Url : nameOfYouFile.properties
Connection Factory : qpidConnectionfactory
Destination : <QueuePropertyName>
nameOfYouFile.properties:
connectionfactory.qpidConnectionfactory = amqp://admin:admin#clientID/carbon?brokerlist='tcp://localhost:5672'
queue.JMeterQueue = JMeterQueue
Reference:
Qpid Wiki

Related

Weblogic JMS binding issue, class could not be initialized exception

Could not initialize class exception is coming when trying to view the jndi bindings for a JMS destination in Weblogic 12c server. I have setup JMS modules with JMS destination queues and connection factory. Below are the things that is deployed in the server :
JMS Module : MyAppJmsModule (JMSSystemResource)
JMS Server : MyAppJMSServer (Foreign Server)
JNDI Initial Context Factory: com.sun.jndi.fscontext.RefFSContextFactory
JNDI Connection URL: file:///abc/oracle/config/domains/domain_test/jms/MyAppJmsModule/MyAppJMSServer/jms
In the above path lies the .bindings file
Destination tab showing Name, Local JNDI name and Remote JNDI name correctly.
Connection Factories tab also showing the jndi names correctly.
Local jndi name is prefixed with jms/
Now when I am clicking on the destination inside the JNDI Tree, it gives me the below error:
Unexpected exception: failed to load return type: class java.lang.Object; nested exception is: java.lang.ClassNotFoundException: Failed to load class com.ibm.mq.jms.MQQueue
Error from weblogic log :
An error was generated by the RMI server:
weblogic.jndi.internal.RootNamingNode.lookup(Ljava.lang.String;Ljava.util.Hashtable;)
java.lang.NoClassDefFoundError: Could not initialize class com.ibm.mq.jms.MQXAQueueConnectionFactory.
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at com.ibm.mq.jms.MQXAQueueConnectionFactoryFactory.class$(MQXAQueueConnectionFactoryFactory.java:58)
at com.ibm.mq.jms.MQXAQueueConnectionFactoryFactory.getObjectInstance(MQXAQueueConnectionFactoryFactory.java:58)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321)
Successful JNDI binding should show something like this :
Binding Name: jms.QUEUENAME
Class: com.ibm.mq.jms.MQQueue
Hash Code: Some Value
toString Results: queue://QUEUEMGR/APP.QUEUENAME?persistence=2&expiry=0
I have deployed an appplication which got deployed successfully but in warning state. When I checked the monitoring tab for the application it is showing the below error :
Symtom{MDB,MEDIUM,MyApp-0.0.1-SNAPSHOT,MDB application MyApp-0.0.1-SNAPSHOT is NOT connected to messaging system.}
I have checked few of the classes that got loaded and I found the below relevant classes that is being displayed in application classpath :
~/application/config/com.ibm.mq-9.0.0.jar
~/application/config/com.ibm.mq.headers.jar
~/application/config/com.ibm.mq.jmqi-9.0.0.jar
~/application/config/com.ibm.mq.pcf-6.1.jar
~/application/config/com.ibm.mqjms-9.0.0.jar
~/application/config/commons-codec-1.10.jar
~/application/config/dhbcore.jar
~/application/config/fscontext.jar
~/application/config/javaee-api-5.jar
~/application/config/jms.jar
~/application/config/jndi.jar
~/application/config/providerutil.jar
Please help me to find out what is I am missing in my configurations.
The application got successfully deployed and it is connecting to the JMS messaging system. I have removed javaee-api jar as it was already there in the classpath with a different version and added the jms-api jar from weblogic library.
However, the destination in the JNDI tree is still giving the error.

Solace NIFI JMSConnectionFactoryProvider

I am trying to connect to Solace Queues on a VPN different then default using Appache NIFI ConsumeJMS Processor. When I try to enable the JMSConnectionFactoryProvider I get the following error:
JMSConnectionFactoryProvider Failed to invoke #OnEnabled method due to
java.lang.IllegalStateException: java.lang.IllegalStateException:
Failed to load and/or instantiate class
'com.solacesystems.jms.SolConnectionFactory'
The NIFI JMSConnectionFactoryProvider provides a generic service to create vendor specific javax.jms.ConnectionFactory implementations. ConnectionFactory can be served once this service is configured successfully.
Why is NIFI Unable to find the class within the Solace JMS API Jar files?
----- Update --------
Solace JMS API 10.1.0 now contains an zero argument default constructor, and integration with NiFi is now possible.
Here is an example configuration:
Controller:
The MQ ConnectionFactory Implementation is set to com.solacesystems.jms.SolConnectionFactoryImpl.
ConsumeJMS Processor:
Username field can also take the form of "myUsername#myMessageVPN".
----- Original -------
The problem here is that Apache NiFi is not using a portable method of creating a ConnectionFactory. It is trying to create a ConnectionFactory by calling an zero argument default constructor, but there's no guarantee that one exists.
// From https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-jms-bundle/nifi-jms-cf-service/src/main/java/org/apache/nifi/jms/cf/JMSConnectionFactoryProvider.java
private void createConnectionFactoryInstance(ConfigurationContext context) {
String connectionFactoryImplName = context.getProperty(CONNECTION_FACTORY_IMPL).evaluateAttributeExpressions().getValue();
this.connectionFactory = Utils.newDefaultInstance(connectionFactoryImplName);
}
Note that there's an entry over at NiFi's JIRA https://issues.apache.org/jira/browse/NIFI-2701 to "Add JNDI Factory support for JMS ConnectionFactory service". (The initial description of that entry is a bit confusing, but the comments are clearer.)
At this point, Solace only supports the creation of the ConnectionFactory through the standard JNDI lookup - javax.naming.InitialContext.lookup() and through Solace's proprietary method - SolJmsUtility.createConnectionFactory().
Solace will investigate whether it is feasible to implement a zero argument default constructor for the ConnectionFactory.
A JNDI connection provider is developed and published at http://dev.solace.com/integration-guides/nifi/. For people that are interested in this provider, it is worthwhile finding out.

Connecting to a JMS Queue using a file system based Initial Context

Using Websphere MQ Explorer, I have created a new file system based initial contextfor JMS. Using the new initial context, I have created a JMS queue to connect to an existing queue (currently accessed using a non java based framework).
Within the application code, I can succesfully connect to the context, as follows:
properties.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.fscontext.RefFSContextFactory");
properties.put(Context.PROVIDER_URL, "file:C://folder-name//");
try {
val ctx = new InitialContext(properties)
Next, I create a QueueConnectionFactory:
val qcf = (ctx.lookup("com.ibm.mq.jms.MQQueueFactory")).asInstanceOf[QueueConnectionFactory]
However, this throws the following exception:
javax.naming.NameNotFoundException: com.ibm.mq.jms.MQQueueFactory
at com.sun.jndi.fscontext.RefFSContext.getObjectFromBindings(RefFSContext.java:400)
at com.sun.jndi.fscontext.RefFSContext.lookupObject(RefFSContext.java:327)
at com.sun.jndi.fscontext.RefFSContext.lookup(RefFSContext.java:146)
at com.sun.jndi.fscontext.FSContext.lookup(FSContext.java:127)
at javax.naming.InitialContext.lookup(InitialContext.java:411)
I used com.ibm.mq.jms.MQQueueFactory as the connection factory name, because in the .bindings file, there is the following line:
MY.QUEUE/FactoryName=com.ibm.mq.jms.MQQueueFactory
But that throws an exception.
Where would the correct connection factory name be defined?
Thanks
Problem solved - under the file based context (under JMS Administered Objects), a Connection Factory must be defined.

Add authoraization in Jmeter load testing with JMeter jms point to point queue

I am using jmeter jms point to point queue for load testing.
But I am getting the following error:
javax.naming.NamingException: Failed to create remoting connection [Root exception is java.lang.RuntimeException: javax.security.sasl.SaslException: Authentication failed: all available authentication mechanisms failed]
I am using jmeter 2.11 version
I add user name and password in jndi properties. But still it is not working. Here is the configuration i am using:
QueueConnectionFactory: RemoteConnectionFactory
initial context factory: org.jboss.naming.remote.client.InitialContextFactory
url : remote://localhost:4447
JNDI Prpperties:
username: ..............
password: ...........
Your Jndi properties seem wrong, check this:
http://docs.oracle.com/cd/E19182-01/820-7853/ghyco/index.html
Login / password props are :
java.naming.security.principal
The identity of the principal for authenticating the caller to the service. For more information, see the Java API documentation for javax.naming.Context.SECURITY_PRINCIPAL.
java.naming.security.credentials
The credentials of the principal for authenticating the caller to the service. For more information, see the Java API documentation for javax.naming.Context.SECURITY_CREDENTIALS.
I have encountered similar problem while using jmeter for solace, hope this help to someone having similar issue.
For solace jms testing need to use jndi properties since there is no place holder for VPN name. JNDI properties file will look something like this:
java.naming.factory.initial=com.solacesystems.jndi.SolJNDIInitialContextFactory
java.naming.provider.url=<IP:port><br>
Solace_JMS_VPN=<VPN Name><br>
java.naming.security.principal=<username><br>
java.naming.security.credentials=<password>
Here the jndi properties has to be packaged as a jar file and placed in the jmeter lib folder in order to be picked at runtime.
jar cvf my-jndi-properties.jar jndi.properties
Hope this helps.

JMeter and TIBCO EMS

Is it possible to use Jmeter with TIBCO EMS? Because I am trying to connect to EMS servers through JMeter JMS plugin and not able to succeed on that.
Any help on this would be greatly appreciated.
EDIT: Error Log
WARN - jmeter.protocol.jms.sampler.JMSSampler: Name not found: 'com.tibco.tibjms.TibjmsQueueConnectionFactory' javax.naming.NameNotFoundException: Name not found: 'com.tibco.tibjms.TibjmsQueueConnectionFactory'
at com.tibco.tibjms.naming.TibjmsContext.lookup(TibjmsContext.java:713)
at com.tibco.tibjms.naming.TibjmsContext.lookup(TibjmsContext.java:489)
at javax.naming.InitialContext.lookup(Unknown Source)
at org.apache.jmeter.protocol.jms.sampler.JMSSampler.threadStarted(JMSSampler.java:295)
at org.apache.jmeter.threads.JMeterThread$ThreadListenerTraverser.addNode(JMeterThread.java:504)
at org.apache.jorphan.collections.HashTree.traverseInto(HashTree.java:984)
at org.apache.jorphan.collections.HashTree.traverseInto(HashTree.java:985)
at org.apache.jorphan.collections.HashTree.traverse(HashTree.java:967)
at org.apache.jmeter.threads.JMeterThread.threadStarted(JMeterThread.java:479)
at org.apache.jmeter.threads.JMeterThread.initRun(JMeterThread.java:468)
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:239)
at java.lang.Thread.run(Unknown Source)
We did come across this problem in the past but worked around using BSF Sampler and scripted using tib library in groovy.
Well that sounds like your ConnectionFactory (via JNDI) could not be found on the EMS Server side. Check within TIBCO EMS what the configured connection factory names are ;)
Usually QueueConnectionFactory should be there as default name.
copy the jars from TIBCO_HOME\ems\version\lib to jmeter\lib
Initial Context Factory: com.tibco.tibjms.naming.TibjmsInitialContextFactory
restart jmeter
Follow below steps, it will work
Initial connection Factory :
com.tibco.tibjms.naming.TibjmsInitialContextFactory
Provider URL : tcp://hostname:7222
ConnectionFactory : QueueConnectionFactory or(TopicConnectionFactory)
Destination : sample
username : raghu
password : raghu

Resources