5 Replies Latest reply on Aug 4, 2011 8:22 AM by frankhil

    ActiveMQConnectionFactory.setBrokerUrl hangs when called from an applet

    frankhil

      Guys,

       

      I am building an Applet that is a JMS client.

      When I call the method ActiveMQConnectionFactory.setBrokerUrl from an applet the program hangs.

      By this I mean the program cursor does not get to the next statement but I do not receive an exception in the JConsole.

      When I execute the same code outside of the browser everything works fine.

      I have tried this both with a (self) signed applet as well as with an unsigned applet.

      The result is the same.

      Does anybody have any clue how I can get beyond this?

      It is driving me nuts.

        • 1. Re: ActiveMQConnectionFactory.setBrokerUrl hangs when called from an applet
          frankhil

          I looked at a the following bug report on www.apache.org that seemed to apply to my problem.

           

          https://issues.apache.org/jira/browse/AMQ-3181

           

          This bug fix was included on the latest release of Apache ActiveMQ on www.apache.org.

           

          So I downloaded the ActiveMQ broker from there and used activemq-all-5.5.0.jar from that release in my netbeans project.

           

          Unfortunately that did not fix the problem.

          • 2. Re: ActiveMQConnectionFactory.setBrokerUrl hangs when called from an applet
            garytully

            can you post a thread dump of the hung process?

            • 3. Re: ActiveMQConnectionFactory.setBrokerUrl hangs when called from an applet
              frankhil

              Here it is:

               

              -


              Dump thread stack?

              -


              2011-08-02 07:30:19

              Full thread dump Java HotSpot(TM) 64-Bit Server VM (20.1-b02-384 mixed mode):

               

              "TimerQueue" daemon prio=5 tid=1018d1000 nid=0x11d469000 in Object.wait()

                 java.lang.Thread.State: WAITING (on object monitor)

                   at java.lang.Object.wait(Native Method)

                   - waiting on <7f42bec90> (a javax.swing.TimerQueue)
              at javax.swing.TimerQueue.run(TimerQueue.java:232)
              - locked <7f42bec90> (a javax.swing.TimerQueue)

                   at java.lang.Thread.run(Thread.java:680)

               

              "ConsoleWriterThread" daemon prio=5 tid=101aac000 nid=0x11f842000 in Object.wait()

                 java.lang.Thread.State: WAITING (on object monitor)

                   at java.lang.Object.wait(Native Method)

                   - waiting on <7f42bed20> (a java.lang.Object)
              at java.lang.Object.wait(Object.java:485)
              at com.sun.deploy.util.ConsoleTraceListener$ConsoleWriterThread.run(ConsoleTraceListener.java:72)
              - locked <7f42bed20> (a java.lang.Object)

               

              "TimerQueue" daemon prio=4 tid=101988800 nid=0x11e777000 in Object.wait()

                 java.lang.Thread.State: TIMED_WAITING (on object monitor)

                   at java.lang.Object.wait(Native Method)

                   - waiting on <7f42beda0> (a javax.swing.TimerQueue)
              at javax.swing.TimerQueue.run(TimerQueue.java:232)
              - locked <7f42beda0> (a javax.swing.TimerQueue)

                   at java.lang.Thread.run(Thread.java:680)

               

              "thread applet-projms3.ProJms-1" prio=4 tid=101988000 nid=0x11e674000 in Object.wait()

                 java.lang.Thread.State: WAITING (on object monitor)

                   at java.lang.Object.wait(Native Method)

                   - waiting on <7f42bee28> (a java.lang.Object)
              at java.lang.Object.wait(Object.java:485)
              at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Plugin2Manager.java:1760)
              - locked <7f42bee28> (a java.lang.Object)

                   at java.lang.Thread.run(Thread.java:680)

               

              "TimerQueue" daemon prio=5 tid=102b32000 nid=0x11e571000 in Object.wait()

                 java.lang.Thread.State: WAITING (on object monitor)

                   at java.lang.Object.wait(Native Method)

                   - waiting on <7f42beec8> (a javax.swing.TimerQueue)
              at javax.swing.TimerQueue.run(TimerQueue.java:232)
              - locked <7f42beec8> (a javax.swing.TimerQueue)

                   at java.lang.Thread.run(Thread.java:680)

               

              "Timer-2" daemon prio=6 tid=1018f7000 nid=0x11e46e000 in Object.wait()

                 java.lang.Thread.State: WAITING (on object monitor)

                   at java.lang.Object.wait(Native Method)

                   - waiting on <7f42e41d8> (a java.util.TaskQueue)
              at java.lang.Object.wait(Object.java:485)
              at java.util.TimerThread.mainLoop(Timer.java:483)
              - locked <7f42e41d8> (a java.util.TaskQueue)

                   at java.util.TimerThread.run(Timer.java:462)

               

              "Java2D Disposer" daemon prio=10 tid=1019a7800 nid=0x11de23000 in Object.wait()

                 java.lang.Thread.State: WAITING (on object monitor)

                   at java.lang.Object.wait(Native Method)

                   - waiting on <7f42b16f8> (a java.lang.ref.ReferenceQueue$Lock)
              at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:118)
              - locked <7f42b16f8> (a java.lang.ref.ReferenceQueue$Lock)

                   at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:134)

                   at sun.java2d.Disposer.run(Disposer.java:127)

                   at java.lang.Thread.run(Thread.java:680)

               

              "AWT-EventQueue-1" prio=6 tid=102a30000 nid=0x11da7b000 waiting on condition

                 java.lang.Thread.State: RUNNABLE

                   at com.sun.deploy.util.ConsoleHelper.dumpAllStacksImpl(Native Method)

                   at com.sun.deploy.util.ConsoleHelper.dumpAllStacks(ConsoleHelper.java:66)

                   at sun.plugin2.applet.Plugin2ConsoleController.dumpAllStacks(Plugin2ConsoleController.java:116)

                   at com.sun.deploy.util.ConsoleWindow$5.actionPerformed(ConsoleWindow.java:188)

                   at javax.swing.JComponent$ActionStandin.actionPerformed(JComponent.java:3368)

                   at javax.swing.SwingUtilities.notifyAction(SwingUtilities.java:1645)

                   at javax.swing.JComponent.processKeyBinding(JComponent.java:2851)

                   at javax.swing.KeyboardManager.fireBinding(KeyboardManager.java:267)

                   at javax.swing.KeyboardManager.fireKeyboardAction(KeyboardManager.java:216)

                   at javax.swing.JComponent.processKeyBindingsForAllComponents(JComponent.java:2928)

                   at javax.swing.JComponent.processKeyBindings(JComponent.java:2920)

                   at javax.swing.JComponent.processKeyEvent(JComponent.java:2814)

                   at java.awt.Component.processEvent(Component.java:6150)

                   at java.awt.Container.processEvent(Container.java:2085)

                   at java.awt.Component.dispatchEventImpl(Component.java:4735)

                   at java.awt.Container.dispatchEventImpl(Container.java:2143)

                   at java.awt.Component.dispatchEvent(Component.java:4565)

                   at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1850)

                   at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:712)

                   at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:990)

                   at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:855)

                   at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:676)

                   at java.awt.Component.dispatchEventImpl(Component.java:4607)

                   at java.awt.Container.dispatchEventImpl(Container.java:2143)

                   at java.awt.Window.dispatchEventImpl(Window.java:2478)

                   at java.awt.Component.dispatchEvent(Component.java:4565)

                   at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:679)

                   at java.awt.EventQueue.access$000(EventQueue.java:85)

                   at java.awt.EventQueue$1.run(EventQueue.java:638)

                   at java.awt.EventQueue$1.run(EventQueue.java:636)

                   at java.security.AccessController.doPrivileged(Native Method)

                   at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)

                   at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)

                   at java.awt.EventQueue$2.run(EventQueue.java:652)

                   at java.awt.EventQueue$2.run(EventQueue.java:650)

                   at java.security.AccessController.doPrivileged(Native Method)

                   at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)

                   at java.awt.EventQueue.dispatchEvent(EventQueue.java:649)

                   at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)

                   at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)

                   at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)

                   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)

                   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)

                   at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

               

              "AWT-EventQueue-2" prio=4 tid=1019a8000 nid=0x11db7e000 in Object.wait()

                 java.lang.Thread.State: WAITING (on object monitor)

                   at java.lang.Object.wait(Native Method)

                   - waiting on <7f42f3100> (a java.awt.EventQueue)
              at java.lang.Object.wait(Object.java:485)
              at java.awt.EventQueue.getNextEvent(EventQueue.java:520)
              - locked <7f42f3100> (a java.awt.EventQueue)

                   at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:263)

                   at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)

                   at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)

                   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)

                   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)

                   at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

               

              "Applet 1 LiveConnect Worker Thread" prio=4 tid=1019a6800 nid=0x11d978000 in Object.wait()

                 java.lang.Thread.State: WAITING (on object monitor)

                   at java.lang.Object.wait(Native Method)

                   - waiting on <7f42f7748> (a java.lang.Object)
              at java.lang.Object.wait(Object.java:485)
              at sun.plugin2.main.client.LiveConnectSupport$PerAppletInfo$LiveConnectWorker.run(LiveConnectSupport.java:1732)
              - locked <7f42f7748> (a java.lang.Object)

                   at java.lang.Thread.run(Thread.java:680)

               

              "Poller SunPKCS11-Darwin" daemon prio=1 tid=1018c9800 nid=0x11d875000 waiting on condition

                 java.lang.Thread.State: TIMED_WAITING (sleeping)

                   at java.lang.Thread.sleep(Native Method)

                   at sun.security.pkcs11.SunPKCS11$TokenPoller.run(SunPKCS11.java:692)

                   at java.lang.Thread.run(Thread.java:680)

               

              "Browser Side Object Cleanup Thread" prio=5 tid=1019ad800 nid=0x11d772000 in Object.wait()

                 java.lang.Thread.State: WAITING (on object monitor)

                   at java.lang.Object.wait(Native Method)

                   - waiting on <7f432b2e8> (a java.lang.ref.ReferenceQueue$Lock)
              at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:118)
              - locked <7f432b2e8> (a java.lang.ref.ReferenceQueue$Lock)

                   at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:134)

                   at sun.plugin2.main.client.LiveConnectSupport$BrowserSideObjectCleanupThread.run(LiveConnectSupport.java:247)

               

              "CacheCleanUpThread" daemon prio=5 tid=10191d800 nid=0x10b562000 in Object.wait()

                 java.lang.Thread.State: WAITING (on object monitor)

                   at java.lang.Object.wait(Native Method)

                   - waiting on <7f432b318> (a com.sun.deploy.cache.CleanupThread)
              at java.lang.Object.wait(Object.java:485)
              at com.sun.deploy.cache.CleanupThread.run(CleanupThread.java:270)
              - locked <7f432b318> (a com.sun.deploy.cache.CleanupThread)

               

              "CacheMemoryCleanUpThread" daemon prio=5 tid=1029fc000 nid=0x11d66f000 in Object.wait()

                 java.lang.Thread.State: WAITING (on object monitor)

                   at java.lang.Object.wait(Native Method)

                   - waiting on <7f432b6c8> (a java.lang.ref.ReferenceQueue$Lock)
              at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:118)
              - locked <7f432b6c8> (a java.lang.ref.ReferenceQueue$Lock)

                   at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:134)

                   at com.sun.deploy.cache.MemoryCache$LoadedResourceCleanupThread.run(MemoryCache.java:219)

               

              "AWT-EventQueue-0" prio=6 tid=102917000 nid=0x11d56c000 in Object.wait()

                 java.lang.Thread.State: WAITING (on object monitor)

                   at java.lang.Object.wait(Native Method)

                   - waiting on <7f42c0070> (a java.awt.EventQueue)
              at java.lang.Object.wait(Object.java:485)
              at java.awt.EventQueue.getNextEvent(EventQueue.java:520)
              - locked <7f42c0070> (a java.awt.EventQueue)

                   at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:263)

                   at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)

                   at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatc

              Trace message truncated for length over 10K

              • 4. Re: ActiveMQConnectionFactory.setBrokerUrl hangs when called from an applet
                garytully

                thanks for the stack trace. I don't see any activemq calls in any of those threads, so it does no look like a call to setBrokerUrl is hanging.

                • 5. Re: ActiveMQConnectionFactory.setBrokerUrl hangs when called from an applet
                  frankhil

                  It may be missing because the thread dump gets truncated at 10K and I don't know how to extend that.

                  Anyway this is what I am observing.

                  I have the following debug messages.

                   

                  System.out.println("Before this.connectionFactory.setUserName(this.user)");

                                this.connectionFactory.setUserName(this.user);

                  System.out.println("Before this.connectionFactory.setPassword(this.password)");

                                this.connectionFactory.setPassword(this.password);

                  System.out.println("Before this.connectionFactory.setBrokerURL(icConnectUrl)");

                                this.connectionFactory.setBrokerURL(icConnectUrl);

                  System.out.println("Before Create Connection");

                   

                  When I execute from this code as an applet I do not get the ""Before Create Connection" message. When I execute the same code not as an applet I do.