Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Message Module - Weblogic JMS

    SmartGWT Pro 3.0 nightly Jan 30, 2011

    I am hoping to get some configuration help. I am unable to send a message (errors below) with the Message Module when I attempt to connect to WebLogic's JMS. My code works when using the LocalMessageDispatcher.

    As for my problem, I am able to get the MessageDispatcher and the subscribers but I receive a null pointer error when I try to send the message.

    I based my JMSMessageDispatcher configuration, shown below, off of the information found in the thread http://forums.smartclient.com/archiv...php/t-346.html. I have read the Messaging_QuickRef.pdf.

    WebLogic(10.3.5) has a default TopicConnectionFactory available via javax/jms/TopicConnectionFactory, but I couldn't figure out how to access it via server.properties.

    I have hacked away at the configuration but finally have to say 'Mercy'.
    I would be very, very thankful for any assistance/guidance.

    The error:
    Code:
    === 2012-02-15 19:00:47,540 [ng)'] ERROR JMSMessageDispatcher - Unable to deliver jms message
    java.lang.NullPointerException
    	at com.isomorphic.messaging.JMSMessageDispatcher.iscMessage(JMSMessageDispatcher.java:227)
    	at com.isomorphic.messaging.JMSMessageDispatcher.onMessage(JMSMessageDispatcher.java:179)
    	at weblogic.jms.client.JMSSession.onMessage(JMSSession.java:4659)
    	at weblogic.jms.client.JMSSession.execute(JMSSession.java:4345)
    	at weblogic.jms.client.JMSSession.executeMessage(JMSSession.java:3821)
    	at weblogic.jms.client.JMSSession.access$000(JMSSession.java:115)
    	at weblogic.jms.client.JMSSession$UseForRunnable.run(JMSSession.java:5170)
    	at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:528)
    	at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
    	at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
    Server code from ...DMI.java
    Code:
    ...
    	private ISCMessageDispatcher messageDispatcher = null;
    	private static final String CHANNEL_NAME = "feedbackChannel";
    
    	private void notifyUpdate(Object data) {
    		// Lazy Initialization - useless, since I'm using "new"
    		if (messageDispatcher == null) {
    			try {
    				messageDispatcher = ISCMessageDispatcher.instance();
    			} catch (Exception e1) {
    				e1.printStackTrace();
    			}
    		}
    
                    //Debugging
    		System.out.println("think I might want to send a message");
    
    		Set subsribers = messageDispatcher.getSubscribersForChannel(CHANNEL_NAME);
    		final boolean doSend = (messageDispatcher != null && subsribers != null && subsribers.size() != 0);
    
    		if (doSend) {
    			try {
                                //Debugging
    			    System.out.println("Sending message");
    
    				messageDispatcher.deliver(new ISCMessage(CHANNEL_NAME, null));
    			} catch (Exception e1) {
    				e1.printStackTrace();
    			}
    		}
    	}
    server.properties:
    Code:
    messaging.keepaliveInterval: 10000
    messaging.keepaliveReestablishDelay: 1000
    messaging.connectTimeout: 4000
    messaging.connectionTTL: 120000
    messaging.flushBufferSize: 8096
    messaging.dispatcherImplementer: com.isomorphic.messaging.JMSMessageDispatcher
    jndi.messaging.java.naming.factory.initial:weblogic.jndi.WLInitialContextFactory
    messaging.jms.context: messaging
    messaging.jms.jndiPrefix: jms
    messaging.jms.topicConnectionFactory: SmartClientTopicConnectionFactory
    jndi.properties:
    Code:
    java.naming.factory.initial=weblogic.jndi.WLInitialContextFactory
    connectionFactoryNames=SmartClientTopicConnectionFactory
    topic.jms.feedbackChannel=feedbackChannel
    WebLogic JMS configuration:
    Code:
    <?xml version='1.0' encoding='UTF-8'?>
    <weblogic-jms xmlns="http://xmlns.oracle.com/weblogic/weblogic-jms" xmlns:sec="http://xmlns.oracle.com/weblogic/security" xmlns:wls="http://xmlns.oracle.com/weblogic/security/wls" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.oracle.com/weblogic/weblogic-jms http://xmlns.oracle.com/weblogic/weblogic-jms/1.1/weblogic-jms.xsd">
      <connection-factory name="SmartClientTopicConnectionFactory">
        <sub-deployment-name>SmartClientSub</sub-deployment-name>
        <default-targeting-enabled>false</default-targeting-enabled>
        <jndi-name>jms/SmartClientTopicConnectionFactory</jndi-name>
        <client-params>
          <client-id-policy>Restricted</client-id-policy>
          <subscription-sharing-policy>Sharable</subscription-sharing-policy>
          <messages-maximum>10</messages-maximum>
        </client-params>
        <transaction-params>
          <transaction-timeout>3600</transaction-timeout>
          <xa-connection-factory-enabled>true</xa-connection-factory-enabled>
        </transaction-params>
        <security-params>
          <attach-jmsx-user-id>false</attach-jmsx-user-id>
        </security-params>
      </connection-factory>
      <topic name="feedbackChannel">
        <sub-deployment-name>SmartClientSub</sub-deployment-name>
        <attach-sender>supports</attach-sender>
        <production-paused-at-startup>false</production-paused-at-startup>
        <insertion-paused-at-startup>false</insertion-paused-at-startup>
        <consumption-paused-at-startup>false</consumption-paused-at-startup>
        <jndi-name>jms/feedbackChannel</jndi-name>
        <default-unit-of-order>false</default-unit-of-order>
        <saf-export-policy>All</saf-export-policy>
        <messaging-performance-preference>25</messaging-performance-preference>
        <unit-of-work-handling-policy>PassThrough</unit-of-work-handling-policy>
        <incomplete-work-expiration-time>-1</incomplete-work-expiration-time>
      </topic>
    </weblogic-jms>
    little debugging via a JNDI "tree walk":
    Code:
    -->weblogic: weblogic.jndi.internal.ServerNamingNode
    -->jms: weblogic.jndi.internal.ServerNamingNode
        -->SmartClientTopicConnectionFactory: weblogic.rmi.cluster.ClusterableRemoteObject
        -->feedbackChannel: weblogic.jms.common.WrappedDestinationImpl
    -->javax: weblogic.jndi.internal.ServerNamingNode
    -->jdbc: weblogic.jndi.internal.ServerNamingNode
        -->EmdwhGwtSvc: weblogic.rmi.cluster.ClusterableRemoteObject
    Attached Files

    #2
    Please try adding to your server.properties the following line:
    Code:
    jndi.messaging.java.naming.provider.url=t3://localhost:7001
    And use this code to test your configuration in weblogic:

    Code:
    public static Context getInitialContext() throws javax.naming.NamingException {
            Properties p = new Properties();
            p.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
            p.put(Context.PROVIDER_URL, "t3://localhost:7001");
            return new javax.naming.InitialContext(p);
        }
        
        public static void main(String[] args) {
            // TODO Auto-generated method stub
            Context context = null;
            TopicSession session = null;
            TopicPublisher publisher  = null;
            TopicConnection connection = null;
            TextMessage message = null;
            try { 
                   context = getInitialContext();
                   TopicConnectionFactory factory = (TopicConnectionFactory)context.lookup("TopicConnectionFactory");
                   Topic topic = (Topic)context.lookup("feedbackChannel");                   
                   // create the connection and session
                   connection = factory.createTopicConnection();
                   session = connection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
                   // create a publisher
                   publisher = session.createPublisher(topic);
                   publisher.setDeliveryMode(DeliveryMode.NON_PERSISTENT);                       
                   // create the message
                   message = session.createTextMessage();
                   message.setText("Hello...");
                   publisher.publish(message);
                   //
            } catch (Exception e) { 
                e.printStackTrace(); 
            }
            try {
            session.close();
            publisher.close();
            context.close();
            connection.close();
            } catch(Exception e) {}
        }

    Comment


      #3
      Thank you very much for your assistance.

      Your test code works if I use 'jms/SmartClientTopicConnectionFactory' and 'jms/feedbackChannel' as parameters. Well, at least the code doesn't generate any errors and the WebLogic Console Monitoring screen shows the 'Messages Received' incrementing accordingly. The counter is also incremented when I use the ISCMessageDispatcher so it seems that the MessageDispatcher is working at least partially.

      Are there any additional debugging parameters that I can set that will provide more information? Thanks again for you assistance.

      Code:
      === 2012-02-17 16:47:45,966 [ng)'] DEBUG JNDI - passing the following environment to JNDI: {
          "java.naming.factory.initial":"weblogic.jndi.WLInitialContextFactory",
          "java.naming.provider.url":"t3://localhost:7010"
      }
      === 2012-02-17 16:47:46,216 [ng)'] DEBUG ProxyHttpServletResponse - Using charset: UTF-8 (CompressionFilter)
      === 2012-02-17 16:47:46,232 [ng)'] ERROR JMSMessageDispatcher - Unable to deliver jms message
      java.lang.NullPointerException
      	at com.isomorphic.messaging.JMSMessageDispatcher.iscMessage(JMSMessageDispatcher.java:227)
      	at com.isomorphic.messaging.JMSMessageDispatcher.onMessage(JMSMessageDispatcher.java:179)
      	at weblogic.jms.client.JMSSession.onMessage(JMSSession.java:4659)
      	at weblogic.jms.client.JMSSession.execute(JMSSession.java:4345)
      	at weblogic.jms.client.JMSSession.executeMessage(JMSSession.java:3821)
      	at weblogic.jms.client.JMSSession.access$000(JMSSession.java:115)
      	at weblogic.jms.client.JMSSession$UseForRunnable.run(JMSSession.java:5170)
      	at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:528)
      	at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
      	at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
      Last edited by lextra; 17 Feb 2012, 08:05.

      Comment


        #4
        It looks like your config is right now, but your code is trying to deliver a null message:

        Code:
        messageDispatcher.deliver(new ISCMessage(CHANNEL_NAME, null));
        We should probably report this better, but this is invalid. Empty String ("") would be fine.

        Comment


          #5
          As you said, the configuration on the server seems to be correct. Thank you!
          A message is created successfully and SmartClient receives it from JMS.

          The problem now is that when JMSDispatcher forwards the message to the Client, the channel name includes the WebLogic module name as seen in the log entry below.
          The dispatcher appears to send a message to the result of Topic.getTopicName() which in my case is different from the declared channel name.

          Just to recap, my configured channel name is feedbackChannel. WebLogic 11g(10.3.5)

          Code:
          === 2012-02-21 16:58:51,166 [ng)'] DEBUG JMSMessageDispatcher - Received message from JMS
          === 2012-02-21 16:58:51,166 [ng)'] DEBUG JMSMessageDispatcher - Decoded jmsMessage for channel: SmartClientModule!feedbackChannel data: FromStandardJMS
          === 2012-02-21 16:58:51,166 [ng)'] DEBUG ISCMessageDispatcher - sending message to channel: SmartClientModule!feedbackChannel
          Last edited by lextra; 21 Feb 2012, 14:10.

          Comment


            #6
            Looking at this, it seems like a bug in WebLogic - it's WebLogic that's returning the special "SmartClientModule!feedbackChannel" String from getTopicName(), it does not happen in JBoss, and in WebLogic there does not appear to be an API by which we can find out the original channel name from either the Message or Topic. So we'd recommend just implementing a workaround for now.

            Comment


              #7
              FYI someone has recently posted about this to Oracle's forums, showing very simple code that strongly suggests this is a bug. No response yet.

              Comment


                #8
                Thank you. I posted that question in the Oracle forum. :-) I am also pursuing this directly through our Oracle support.

                Any advice for coding a workaround? A suggested override point?
                It seems to me that I would need to modify the result from getTopicName() ... I can feel the rumblings of a "pay for a patch" response. :-))
                Appreciate all your help.

                Comment


                  #9
                  Theres nothing to patch on our end..

                  Probably the best workaround is to deliver the module name to the browser somehow and then subscribe under both the original name and the name with the WebLogic-specific module prefix.

                  Comment


                    #10
                    I can see that WebLogic has "worked this way" since at least version 9.
                    Has the Realtime Messaging Module been tested with WebLogic?

                    Comment


                      #11
                      Yes it has. Not sure where you're getting your information, but this prefixing bug, if it's been there a while, is probably environment or deployment-model specific.

                      Comment


                        #12
                        Fair enough.
                        I just made a fresh install of WebLogic 9 and performed the same steps that I used with v. 11g(10.3.5):
                        Created JMS Server: SmartClientJMSServer
                        Created JMS Module: SmartClientModule
                        ->Created Subdeployment: SmartClientSub
                        ->Created TopicFactory: SmartClientConnectionFactory
                        ->Created Topic: feedbackChannel

                        I then deployed my test application (a simple war structure) web.xml and weblogic.xml.
                        Nothing any more fancy than that.
                        All I do know is that I get the same result from getTopicName in both versions of WebLogic. ModuleName!Topic.

                        I am waiting for Oracle support to get back to me and will post any news.
                        I would gladly share my test project if other WebLogic users would find it useful.

                        As always thanks for your help.

                        -- btw, I tried the your proposed work around of subscribing twice and was unsuccesful.
                        Last edited by lextra; 23 Feb 2012, 08:37.

                        Comment


                          #13
                          The eureka moment.

                          The messaging module assumes that the jndi-name (SmartClient channel name) and the Topic name are the same. I changed the jndi-name to match the WebLogic
                          "prefixed" Topic name et voila, the messages arrive at the client. This doesn't seem very portable though.

                          Cheers

                          Comment


                            #14
                            Just to complete the thread, this is not a WebLogic bug.

                            http://docs.oracle.com/cd/E12840_01/wls/docs103/jms/implement.html
                            Under "Use a Reference"
                            "
                            The value of queueName and/or topicName string is defined by:
                            -
                            A string is defined by JMS_Server_Name/Module_Name!Destination_Name (for example, myjmsserver/myModule-jms!mydestination). When referencing a destination in an interop module, the string is defined by JMS_Server_Name/interop-jms!Destination_Name (for example, myjmsserver/interop-jms!mydestination).

                            Note: To reference destination in releases prior to WebLogic 9.0, use a string defined by JMS_Server_Name!Destination_Name (for example, myjmsserver!mydestination).
                            "

                            Comment


                              #15
                              ??

                              WebLogic's documentation says they do this, that doesn't make it not a bug if it's not to spec. WebLogic still appears to be the odd man out here.

                              Of course, Oracle is now in a position to change an ambiguous spec to match their implementation, so the point may be moot :/

                              Comment

                              Working...
                              X