Results 1 to 9 of 9
  1. #1
    Member
    Join Date
    Jul 2010
    Location
    Alpharetta
    Posts
    5

    Stocklist JMS demo with WebSphere MQ

    Stocklist JMS demo uses TIBCO Enterprise Message Service(TM) as JMS provider. Do we have a example that uses MQ as the JMS provider ?

  2. #2
    Power Member
    Join Date
    Jul 2006
    Location
    Cesano Maderno, Italy
    Posts
    784
    Hi,

    please read the JMS Adapter Example.pdf file available in the LS_HOME/DOCS-SDKs/sdk_adapter_java/examples/StockListDemo_JMS_DataAdapter folder, it explains how to configure the adapter/generator to run with JbossMQ.

    HTH

  3. #3
    Member
    Join Date
    Jul 2010
    Location
    Alpharetta
    Posts
    5
    Thanks for the reply.

    I went through that PDF - I am looking for a demo with MQ as JMS provider, not JBoss. Do we have such a demo somewhere ?

    Thanks
    Sharathbabu

  4. #4
    Power Member
    Join Date
    Jul 2006
    Location
    Cesano Maderno, Italy
    Posts
    784
    sorry, i thought that with MQ you were referring to JbossMQ
    btw as you can see there is not much difference in configuring the demo with JbossMQ Jboss Messaging or Tibco EMS so that I suppose that also with your MQ it should be straightforward.

    You just have to locate the correct jar(s) from your MQ and configure the jmsUrl, initialContextFactory, topicConnectionFactory, queueConnectionFactory,topicName and queueName in the adapters.xml file.

    Obviously I assume that you've already created the need topic and queue in your MQ.

    Do you get stuck somewhere?

  5. #5
    Member
    Join Date
    Jul 2010
    Location
    Alpharetta
    Posts
    5
    I am trying to run the Generator

    I made two changes -
    1) Changed provided to Websphere MQ
    2) Change Initial Context factory to FileSystem context - like this

    ===================test.conf=========
    #Websphere MQ Messaging example configuration
    jmsUrl=file:/c://Lightstreamer//Generator//JMS
    initialContextFactory=com.sun.jndi.fscontext.RefFS ContextFactory
    topicConnectionFactory=TopicConnectionFactory
    queueConnectionFactory=QueueConnectionFactory
    topicName=topic/stocksTopic
    queueName=queue/stocksQueue
    =====================

    Created a .bindings file in folder "c://Lightstreamer//Generator//JMS" using following jndi file
    ==================================
    def qcf(QueueConnectionFactory) qmanager(BROKER2_QM) HOSTNAME(localhost) PORT(1415) CHANNEL(SYSTEM.DEF.SVRCONN) TRANSPOT(CLIENT)
    *
    def q(queue/stocksQueue) qu(QUEUE.STOCKSQUEUE)
    *
    def tcf(TopicConnectionFactory) qmanager(BROKER2_QM) HOSTNAME(localhost) PORT(1415) CHANNEL(SYSTEM.DEF.SVRCONN) TRANSPOT(CLIENT)
    *
    def t(topic/stocksTopic) topic(TOPIC.STOCKSTOPIC)
    *
    DIS CTX
    END
    ================================================
    Copied following Websphere MQ libs to generator lib
    jms.jar
    jndi.jar
    fscontext.jar
    providerutil.jar
    com.ibm.mqjms.jar
    com.ibm.mq.jar

    ---
    updated start_generator.bat to include MQ libs

    When I run: start_generator.bat - I get a "java.lang.ClassCastException" exception

    ===============
    29-Jul-10 19:25:47,628 |INFO |SLGenerator |Thread-2 |JNDI Context[{java.naming.provider.url=file:/c://Lightstreamer//Generator//JMS, java.naming.factory.initial=com.sun.jndi.fscontext .RefFSContextFactory}]...
    29-Jul-10 19:25:47,628 |INFO |SLGenerator |Thread-2 |Looking up topic connection
    factory [TopicConnectionFactory]...
    Exception in thread "Thread-2" java.lang.ClassCastException: javax.naming.Reference
    29-Jul-10 19:25:47,644 |ERROR|SLGenerator |Thread-3 |Unable to send message - JMS
    Exception:Topic publisher not ready
    at stocklist_jms_demo.common.JMSHandler.initTopicSess ion(JMSHandler.java:205)
    at stocklist_jms_demo.common.JMSHandler.initTopicPubl isher(JMSHandler.java:304)29-Jul-10 19:25:47,644 |DEBUG|SLG
    enerator |Thread-3 |Heartbeat sent: 452

    at stocklist_jms_demo.feed_simulator.Generator$Connec tionLoopTPQR.connectionCall(Generator.java:399)
    at stocklist_jms_demo.common.ConnectionLoop.run(Conne ctionLoop.java:40)
    29-Jul-10 19:25:48,644 |ERROR|SLGenerator |Thread-3 |Unable to send message - JMS
    Exception:Topic publisher not ready
    ============

    Thanks
    Sharathbabu

  6. #6
    Power Member
    Join Date
    Jul 2006
    Location
    Cesano Maderno, Italy
    Posts
    784
    hi,
    it seems that you've not configured the needed topic on your JMS server, is that correct?

  7. #7
    Member
    Join Date
    Jul 2010
    Location
    Alpharetta
    Posts
    5
    The problem is in this line of code in JMSHandler.java -

    ==
    topicConnectionFactory = (TopicConnectionFactory) jndiContext.lookup(topicConnectionFactoryName);
    ==

    The "jndiContext.lookup()" is returning a " javax.naming.Reference" - which is not getting cast to "javax.jms.TopicConnectionFactory"

    Same thing with Queue connection factory - not able to cast javax.naming.Reference to "javax.jms.QueueConnectionFactory"

    Thanks
    Sharathbabu
    Unable to figure out what is missing.

  8. #8
    Power Member
    Join Date
    Jul 2006
    Location
    Cesano Maderno, Italy
    Posts
    784
    is your problem similar to this one? http://theaveragelife.wordpress.com/...on-server-6-1/

  9. #9
    Member
    Join Date
    Jul 2010
    Location
    Alpharetta
    Posts
    5
    Got the Generator working with WebSphere MQ JMS provider

    The problem was due to some missing JARs in CLASSPATH. Still have not figured out which specific JAR. in start_generator.bat, included all the MQ JARs in CLASSPATH like this
    ===
    set EXT_DIR="C:\Program Files\IBM\WebSphere MQ\Java\lib"
    set command=%JAVA_HOME%\bin\java.exe -Djava.ext.dirs=%EXT_DIR% -cp %cpath% %class% %CONF_FILE%

    %command%
    ===

    Now working on the Adapter part to get the demo going.

    Thanks for your quick replies
    Sharathbabu

 

 

Similar Threads

  1. 2 ArrayList for two pages ?? (StockList example)
    By mohamida in forum Adapter SDKs
    Replies: 2
    Last Post: November 17th, 2009, 03:46 PM
  2. Replies: 8
    Last Post: May 22nd, 2008, 06:01 AM
  3. Replies: 8
    Last Post: May 7th, 2008, 10:53 AM
  4. Replies: 4
    Last Post: March 19th, 2008, 11:10 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT +1. The time now is 07:23 AM.