GUI receiving log messages from JMS

Hi,
I have three classes: GUI, EventListener and JMSListener. What I want to do is to create a login dialog. The user enters his username and password, presses the login button and waits (as this process can take a while). While waiting, he can see log messages sent via JMS.
I set up a TextListener (in my case a JMSListener) and a subscriber like it is described here: http://java.sun.com/products/jms/tutorial/1_3_1-fcs/doc/client.html#1027256.
But the JMSListener never gets any message although the connection is set up correctly (this is just a guess as no exception is thrown). I think that this is a GUI problem. Because if only the JMSListener is running, it does receive messages. Is it possible that the GUI blocks somehow?
Here is some code... First the class that holds the main method:
package de.dtnet.client.run;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import de.dtnet.client.gui.SWDemoGUI;
import de.dtnet.client.listener.SWDemoEventlistener;
public class SWDemoClient {
    private static SWDemoGUI swdemo = null;
     * @param args
    public static void main(String[] args) {
        swdemo = new SWDemoGUI();
        SWDemoEventlistener listener = new SWDemoEventlistener(swdemo);
        swdemo.registerEventlistener(listener);
}The code from the GUI (only the important parts):
package de.dtnet.client.gui;
import de.dtnet.client.listener.SWDemoEventlistener;
public class SWDemoGUI extends JFrame implements Serializable {
    private static final long serialVersionUID = 1L;
     * Default constructor
    public SWDemoGUI() {
        initialize();
     * Creates widget objects and puts everything together
    public void initialize() {
        // GUI with JTextPane for log messages
    public void logOK(String msg) {
        log(OK, msg);
    public void logInfo(String msg) {
        log(INFO, msg);
    public void logWarning(String msg) {
        log(WARNING, msg);
    public void logError(String msg) {
        log(ERROR, msg);
    public void log(String level, String msg) {
        StyledDocument doc = messagesTextPane.getStyledDocument();
        try {
            doc.insertString(doc.getLength(), msg + "\n", doc.getStyle(level));
        } catch (BadLocationException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        messagesTextPane.setCaretPosition(doc.getLength());
    public void registerEventlistener(SWDemoEventlistener listener) {
        loginBtn.addActionListener(listener);
        usernameTxt.addFocusListener(listener);
        passwordField.addFocusListener(listener);
}The enventlistener:
package de.dtnet.client.listener;
// imports
public class SWDemoEventlistener implements ActionListener, FocusListener {
    private SWDemoGUI gui = null;
    private String logLevel = null;
    private String logMessage = null;
    private TopicConnectionFactory conFactory = null;
    private TopicConnection connection = null;
    private TopicSession topicSession = null;
    private Topic topic = null;
    private TopicSubscriber subscriber = null;
    public SWDemoEventlistener(SWDemoGUI gui) {
        this.gui = gui;
        initJMS();
    private InitialContext getInitialContext() {
        // set the properties for the InitalContext
        Properties env = new Properties( );
        env.put("java.naming.provider.url",
                "jnp://localhost:1099");
        env.put("java.naming.factory.initial",
                "org.jnp.interfaces.NamingContextFactory");
        env.put("java.naming.factory.url.pkgs", "org.jnp.interfaces");
        try {
            // initalize and return the InitalContext with
            // the specified properties
            return new InitialContext(env);
        } catch (NamingException ne) {
            System.out.println("NamingException: " + ne);
        return null;
    private void initJMS() {
        try {
            // Obtain a JNDI connection
            InitialContext jndi = getInitialContext();
            Object ref = jndi.lookup("ConnectionFactory");
            // Look up a JMS connection factory
            conFactory = (TopicConnectionFactory) PortableRemoteObject.narrow(
                    ref, TopicConnectionFactory.class);
            // Create a JMS connection
            connection = conFactory.createTopicConnection();
            // Create a JMS session objects
            topicSession = connection.createTopicSession(
                    false, Session.AUTO_ACKNOWLEDGE);
            // Look up a JMS topic
            topic = (Topic) jndi.lookup("topic/testTopic");
        } catch (NamingException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (JMSException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
    public void actionPerformed(ActionEvent e) {
        if (e.getSource() == gui.getLoginButton()) {
            // Do some authentication stuff etc.
            /* Now awaitening messages from JMS */
            subscribe(sessionID);
    public void subscribe(Long sessionID) {
        String selector =  "SessionID='" + sessionID.toString() + "'";
        gui.logInfo("Selector: " + selector);
        try {
            //subscriber = topicSession.createSubscriber(topic, selector, true);
            subscriber = topicSession.createSubscriber(topic);
            JMSListener listener = new JMSListener(gui);
            subscriber.setMessageListener(listener);
            connection.start();
            gui.logOK("Verbindung zu JMS erfolgreich");
        } catch (JMSException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
}and finally the JMSListener:
ackage de.dtnet.client.listener;
public class JMSListener implements MessageListener {
    private SWDemoGUI gui = null;
    private String logLevel = null;
    private String logMessage = null;
    public JMSListener(SWDemoGUI gui) {
        super();
        this.gui = gui;
    public void onMessage(Message incomingMessage) {
        System.out.println("You got message!");
        try {
            MapMessage msg = (MapMessage) incomingMessage;
            logMessage = msg.getString("Message");
            logLevel = msg.getString("Level");
        } catch (JMSException e) {
            e.printStackTrace();
        Runnable logTopicMessage = new Runnable() {
            public void run() {
                System.out.println("Now updating the GUI");
                gui.log(logLevel, logMessage);
        SwingUtilities.invokeLater(logTopicMessage);
        System.out.println("Message fully retrieved!");
}I spent a whole day on this and I'm really becoming desperate as I can't see where the problem is and my time is running out (this is for my diploma thesis)! Does anyone of you? Please!
Thank you!
-Danny

Hello Veronica4468,
After reviewing your post, I have located an article that can help in this situation. It contains a number of troubleshooting steps and helpful advice concerning Messages and SMS:
iOS: Troubleshooting Messages
http://support.apple.com/kb/ts2755
Thank you for contributing to Apple Support Communities.
Cheers,
BobbyD

Similar Messages

  • Receive asynchronous message from JMS  topic over web service

    Hi,
    I have a JMS topic and I want to expose it as a web service so that clients can
    make durable subcription to the topic and receive messages asynchronously. What
    is the best way of doing this ? Is there a portable (to other containers) way
    of do this ? If not, is there a web logic specific way of doing this ?
    Thanks,
    Siva

    So you expect clients to be receiving SOAP messages over HTTP? In this
    case, the clients are really servers that are capable of servicing SOAP
    requests, correct? And how about the senders: are they also using
    SOAP/HTTP to send messages that are delivered to the receivers?
    It should be possible to write this yourself using JMS not as the
    transport, but as a mechanism for distributing the message to a set of
    clients. You'll need to implement a Web Service for publishing to a
    topic, an operation for registering an end point to recieve messages,
    and an MDB (or other form of JMS subscriber) executing on the server to
    relay the message to the end point.
    Siva wrote:
    Hi,
    I have a JMS topic and I want to expose it as a web service so that clients can
    make durable subcription to the topic and receive messages asynchronously. What
    is the best way of doing this ? Is there a portable (to other containers) way
    of do this ? If not, is there a web logic specific way of doing this ?
    Thanks,
    Siva

  • Recieve/Read  Messages  from JMS Queue through ALSB

    Hi,
    I have configured JMS Queue in weblogic server.
    I have created Messaging Service in ALSB which sends messages in MESSAGE QUEUE.
    Now Is it possinle to receive messages from JMS Queue by creating business service in Aqualogic Service bus???

    Hi dear,
    <br>
    I am sending Message through Serializable Object.
    <br>
    I have JMS Proxy which gets invoked when i send message to JMs Queue. JMS Proxy then calls business service.
    <br>
    <br>
    Business Service has two functions. One is taking String as input and one is taking Serializable Object as Input.
    <br>
    <br>
    public void recieveString(String str)<br>
    public void recieveObject(Trade obj)<br>
    --------------------------------------------------<br>
    Now I have configured Proxy Services' Request and Response
    Message Type as a "TEXT". and I am sending ObjectMessage here so what kind of change I require.
    <BR>
    I also want to configure my proxy so that if JMS queue recieves TextMessage then it should invoke reciveString() function and if Object Message then vice versa.....
    <BR><BR>
    But i am not able to handle object even...
    When I am sending Object Message it takes as a TextMessage.
    I am getting following exception when I am sending Object Message to JMS QUEUE. Request and Response Message types are XML Schema of that object.
    <BR>
    <BR>
    <Nov 30, 2006 4:57:19 PM IST> <Warning> <EJB> <BEA-010065>
    <BR>
    <MessageDrivenBean threw an Exception in onMessage(). The exception was: java.lang.AssertionError.<BR>
    java.lang.AssertionError at com.bea.wli.sb.transports.jms.JmsInboundMDB.onMessage(JmsInboundMDB.j
    ava:112)
    at weblogic.ejb.container.internal.MDListener.execute(MDListener.java:42
    9)
    at weblogic.ejb.container.internal.MDListener.transactionalOnMessage(MDL
    istener.java:335)
    at weblogic.ejb.container.internal.MDListener.onMessage(MDListener.java:
    291)
    at weblogic.jms.client.JMSSession.onMessage(JMSSession.java:4060)
    Truncated. see log file for complete stacktrace
    >
    Message was edited by:
    alwaysvaghu

  • Hi, I recently got the iPhone 6, a bit of mucking around with iMessage, over it to be honest. When i message from my macbook air my recipients receive my message from my email. HELP! it never used to do this. its so annoyingly frustrating.

    Hi, I recently got the iPhone 6, a bit of mucking around with iMessage, over it to be honest. When i message from my macbook air my recipients receive my message from my email. HELP! it never used to do this. its so annoyingly frustrating.

    Please read this whole message before doing anything.
    This procedure is a diagnostic test. It’s unlikely to solve your problem. Don’t be disappointed when you find that nothing has changed after you complete it.
    The purpose of this exercise is to determine whether the problem is caused by third-party system modifications that load automatically at startup or login. Disconnect all wired peripherals except those needed for the test, and remove all aftermarket expansion cards. Boot in safe mode and log in to the account with the problem. The instructions provided by Apple are as follows:
    Be sure your Mac is shut down.
    Press the power button.
    Immediately after you hear the startup tone, hold the Shift key. The Shift key should be held as soon as possible after the startup tone, but not before the tone.
    Release the Shift key when you see the gray Apple icon and the progress indicator (looks like a spinning gear).
    Safe mode is much slower to boot and run than normal, and some things won’t work at all, including wireless networking on certain Macs.
    The login screen appears even if you usually log in automatically. You must know your login password in order to log in. If you’ve forgotten the password, you will need to reset it before you begin.
    Test while in safe mode. Same problem(s)?
    After testing, reboot as usual (i.e., not in safe mode.)

  • How can I send and receive a message from  a queue using standalone program

    Hi,
    I want to write a standalone Java program which has to post a message to a queue and receive a message from a queue thats specified as a replyto queue.I want to have my application to be completely standalone without the need of a Application server.What all the Jars do I need to include in the application.My aim is to have the application standalone and portable so that the application runs on any machine that has a JRE.
    Thanks in advance,
    Prathima

    Hi,
    You can get quite simple standalone MQ Java programs from this site http://www.capitalware.biz/mq_code_java.html.
    Also regarding the jars required for your application depends on the API being used. If you use MQI API few jars are required and if you decide to use JMS API you'll require few other jars. But you got to either install Websphere MQ Java Client, which will copy the jars to the respective location, or you can choose to copy the jars from some other machine manually.
    Eventually, all the jars related to MQI and JMS API will reside under /usr/mqm/java/lib/ or /var/mqm/java/lib/ UNIX Environment. And in case of WINTEL, you should find the jars under C:\Program Files\IBM\WebSphere MQ\Java\lib.
    Trust it clarifies...
    Naren

  • How to read Java Object message from JMS Queue using JMS Adapter .

    Dear All,
    In my scenario i have to read a java object message from JMS Queue . I tried by using the JMS Adaper ,but i am not getting any Payload . Can any one tell me is there any special settings for JMS Adapter to read the Java Object message .
    I am able to read the Message successfully thru JMS Adapter but in SXMB_MONI it is not showing any payload .
    I also went in Message monitoring but i am getting this type of message in Sender JMS Adapter  in Audit Log.
    JMS Message ID XXXXX Message Type Null unknown.Payload can not be read and will be empty.
    JMS Message ID XXXXX Payload Empty can not read.
    Please Help.
    Lateef

    Hi,
    As far as i know, JMS Object Messages is not supported by XI JMS adapter.
    you need to have the JMS provider to transform the message to bytes messages.
    (Refer to SAP note 856346)

  • Since updating to ios7, i'm not receiving texts messages from certain people. Help!

    I have an iphone 4s and I recently updated to ios7. I've noticed that I can't receive text messages from certain people. I went into settings>messages and made sure that imessage was turned on. I noticed that directly under that was "waiting for activation". I clicked on "use your apple ID for messages" then logged in......it responded with "please check your network connections". That's confusing because I have full bars. Is there something that I'm missing

    Yes, your iMessage is not activated yet. Turn it off, wait a short period and turn it back on. You should wait 24 hours before getting overly concerned about it still waiting for activation. Check this support document http://support.apple.com/kb/TS4268

  • I cant receive email from my mothers email and cant receive pic messages from my phone but was able to before

    about 5 months ago my email stopped receiving emails from my mothers email account she can get them from me but i dont receive any thing from her. my email also stopped receiving picture messages from my cell phone it receives text messages from my phone but not picture messages it used to but for some reason it stopped i can receive text a pic messages from any other source just not those two please help

    If you log into your account at your providers webmail page are the missing messages in the inbox there? Thunderbird downloads messages form your inbox on your providers server. If the messages do not make it into your server inbox Thnuderbird can do nothing about that.
    Check the Spam folder on the server. Maybe your provider is filtering the missing messages into that folder.

  • I can call out but all incoming calls are going directly to VM with no signal that I missed a call or have VM. I can send/receive text messages from other iPhone/iPad/iTouch users, I am assuming this is really "iMessage." Is it apple software?

    I have spent hours on the phone with Apple and AT&T. I went thought reset, on/off, etc, etc with both companies to no avail. Each company pointed fingers at the other....as being the source of the problem.
    Problems: Suddenly ALL  incoming calls were going directly to VM with no signal I missed calls and/or had VM. I was also unable to receive all Text Messages...Oddly, I could send text messages to anyone (even non-apple users but I could not receive their responses)........then I when I got home I started receiving text messages from other apples users ONLY. I assume now - iMessage kicked in and I could text (send/receive)  other iPhone/iPad/iTouch users ONLY. ....yes, I could still (send) text messages to my husband's blackberry (he received my messages fine) but my phone would NOT receive his text respones.
    Finally, I googled the problem and found this community where other people have had the exact same problems! One person said he "turned off 3 G" which was the solution for him....so I did the same and VIOLA! My problem  solved! Nevermind the fact that I pay for 3G and cannot use it....so here's my question, if 3G is the problem on my phone is this an APPLE issue or a NETWORK problem? Do I purchase a new phone and slip in my same SIM card and hope the same does not occur or do I get a whole new SIM card and phone? What is the long term resolution to this problem?
    I am happy however to find that my problem is NOT an isolated incident and wish Apple or AT&T had told me this is not so uncommon because I thought (based on the baffled response from Apple) that this has never occurred before.  Where is Steve Jobs when we need him?

        jsavage9621,
    It pains me to hear about your experience with the Home Phone Connect.  This device usually works seamlessly and is a great alternative to a landline phone.  It sounds like we've done our fair share of work on your account here.  I'm going to go ahead and send you a Private Message so that we can access your account and review any open tickets for you.  I look forward to speaking with you.
    TrevorC_VZW
    Follow us on Twitter @VZWSupport

  • LG Revolution not receiving text messages from iphone user

    I am not receiving text messages from iphone user, sporatically.  The messages are showing as reveived on Verizon website in usage detail, but not being received on my phone.

        This issue needs fixed asap! I have a few suggestions that should help you get this resolved. If they are showing up in the usage details, that means they are hitting the Verizon network, but for some reason they are not showing up on the phone.   I recommend clearing the cache from your messaging/text messaging programs. Go to settings> applications> manage apps> all> Messaging/Text Messaging> Force Stop/Clear Cache/Clear Data. Erase the old text threads that you have saved and retry.
    If that doesn't work, please let us know the following:
    1) Do they come in delayed or not at all?
    2) Do you have any 3rd party messaging apps installed?
    3) Do they have any problems receiving messages from you?
    4) When they're sending messages, are they directly to you, or do you have this problem when the iPhone user sends to a group of people?
    Thanks for the additional info! I'm sure we can find a fix.
    Regards,
    MikeS_VZW
    Follow us on Twitter @VZWSupport

  • TS4268 I CAN NOT RECEIVE TEXT MESSAGES FROM PEOPLE USING IMESSAGE - I HAVE MY IMESSAGE TURNED OFF BECAUSE I DO NOT WANT TEXTS GOING TO ALL MY ACCOUNTS - HOW DO I RESOLVE THIS PLEASE HELP - MISSING SEVERAL IMPORTANT COMMUNICATIONS...

    I CAN NOT RECEIVE TEXT MESSAGES FROM PEOPLE USING IMESSAGE

    On an iPhone your iMessages will go to your phone number.
    You can select another email to use on iPod or iPad.
    Go to settings
    Messages
    Send and receive
    Check your phone number and uncheck the common Apple ID you share so your messages will not go to other devices.

  • HT4061 I recently switched from my iphone to a samsung Galaxy S4, trading in my iphone. I now can not send/receive text messages from any iphones to my galaxy S4. Since I traded the iphone in, I can't access it to make any changes. Any ideas?

    I recently switched from my iphone to a samsung Galaxy S4, trading in my iphone. I now can not send/receive text messages from any iphones to my galaxy S4. Since I traded the iphone in, I can't access it to make any changes. Any ideas?

    http://support.apple.com/kb/TS5185

  • Ever since I enabled iMessage on my Mac Airbook, I can no longer receive text messages from the iMessage people on my iPhone, only on my iMessage now!!  How do I get the messages to reach both iMessage and iPhone??

    Ever since I enabled iMessage on my Mac Airbook, I can no longer receive text messages from the iMessage people on my iPhone, only on my iMessage now!!  How do I get the messages to reach both iMessage and iPhone??

    We are suffering very similar issues when communicating from my iphone to a friend who has both iphone and iPad enabled.
    As long as I reply to an existing text chain, then it is visible on the target iphone.  If I SMS the phone number, it gets routed to the IPAD!!   And NO, I should not have to disable imessage when I want to send an SMS!!

  • HT1657 I rented the hunger games yesterday on my Apple TV it said it was going take 7-14 hours to download so i left it to download. I then received a message from Apple that i had purchased this movie. But now when I try to find it it"s not anywhere to b

    I recently rented a movie using Apple TV and it said it was going to take 7-14 hours to download so I let it run. I also received a message from apple telling me that there was a request for this movie and they took the funds. But when I tried to find it on my purchases it was not there and when I went back to that movie it was asking me to purchase it again is this common and how do I get it back.

    Not sure what happend there. But ATV only streams, no HD so if you leave it too long, the whole download gets lost.
    Check with iTS.
    iTunes Store Support
    http://www.apple.com/emea/support/itunes/contact.html

  • HT201270 I keep receiving an error 1051 when trying to receive a message from short code 71441. I get message error

    Hi,
    I keep getting an error msg 1051 when texting to short code 71441. I checked with Sprint &amp; there is no block on any of my messaging and all my settings are correct on my phone, everything is updated. I receive all other text messages regular &amp; short code. This particular number just stopped working without cause. Do you know why?

    I have this problem also.  I have an iPhone 5c; well both my wife and I have iPhones 5c and we are having the same problem.  She doesn't use her phone to send text messages to online accounts just to her friends so she doesn't encounter the problem that I am but I checked her phone and she has the same problem on her phone.  I can receive text message from some online account; most specifically from my Gmail account but I cannot receive text messages from either my AOL or Paypal accounts.  I've took my iPhone to the Sprint store where I purchased it without any results.  I called both Sprint and Apple still without any resolution.  I called both Paypal and AOL and they could not offer any good advice or fix the problem.  Everyone seem to be referring to someone else like the carrier or the manufacturer. 
    I went online to check my settings on my online MySprint account and saw no problem there.  If I cannot get any help from this online community my next step will be to take it to an Apple Store and then contact the manufacturer and try to have them exchange it for a new iPhone.  So far this seem to be point to a manufacturer defect. 
    My iPhone specs are:
              iPhone 5c
              ios 8.0.2
              carrier:     Sprint 17.1
              Model:     ME567LL/A
              Serial Number:     FCDN60C4FFHM

Maybe you are looking for

  • Problem with Delivery, Sales and Conditions cubes

    Hello everybody, I will be thankful to you all if you can send a reply ASAP as I need the solution immediately . I have 2 Questions: No.1: I am developing Delivery, Sales and Conditions cubes. I am using 2LIS_11_VAITM data source for Sales, 2LIS_12_V

  • How do I answer a facetime call on my macbook air?

    I received a factime call on my new MacBook Air laptop and was unable to answer it.  It kept ringing but there was no place to either accept or decline the call as there is on my iPad 2. How do I answer a facetime call? Also, how do I enlarge the ima

  • SAP  Back ground Jobs getting cancel automatically

    Hi All, All schedule Background jobs getting cancel  automatically in ECC 5 server. Also not getting any job log in respective schedule job. please help me out with expert suggestions. Regards Gyan

  • Problem moving through CardLayout

    Hi, I have been unable to find any solid examples of CardLayout, so I have been using some code I found in this forum. I'm getting hung up on how to move forward or backwards through the cards. I know it is myCard.next but for some reason I'm getting

  • Build successfull, deployment not working

    Hi all! We are using NWDI for Web Dynpro Apps service pack 19, today we faced this problem: An activation from developer studio has been activated, the build runs fine but when it comes to deployment, it won't finish. So you can see a green complete