-
1. Re: Applet JMS Problem
stephanenicoll Oct 9, 2003 1:47 AM (in response to bobbysun)Without seeing the part of your code that handles JMS connections, I doubt someone could help you.
Regards,
Stephane -
2. Re: Applet JMS Problem
bobbysun Oct 9, 2003 7:34 PM (in response to bobbysun)You're right!
Code snippet:
public class MsgConsole extends JPanel {
......
......
protected void msgSubscribe() {
try {
InitialContext ctx = getContext();
TopicConnectionFactory factory = (TopicConnectionFactory) ctx.lookup("ConnectionFactory");
/* TopicConnectionFactory factory = (TopicConnectionFactory) ctx.lookup("UIL2ConnectionFactory");
*/
topic = (Topic)ctx.lookup("topic/ocdMsgTopic");
connection = factory.createTopicConnection();
session = connection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
TopicSubscriber subscriber = session.createSubscriber(topic);
subscriber.setMessageListener(new MessageListener() {
public void onMessage(Message msg) {
procMessage(msg);
}
});
connection.start();
} catch (Exception e) {
e.printStackTrace();
}
}
protected void msgUnSubscribe() {
try {
connection.stop();
session.close();
connection.close();
}
catch (Exception e) {
e.printStackTrace();
}
}
......
......
}
Applet Code Snippet:
public class MsgConsoleApplet extends JApplet {
MsgConsole mc = new MsgConsole();
public void init() {
System.out.println("MsgConsoleApplet Init");
getContentPane().add(mc);
String operatorID = getParameter("operatorID");
System.out.println("operatorID: " + operatorID);
String role = getParameter("role");
System.out.println("role: " + role);
mc.setOperatorID(operatorID);
mc.setRole(role);
mc.msgSubscribe();
}
public void start() {
System.out.println("MsgConsoleApplet Start");
}
public void stop() {
System.out.println("MsgConsoleApplet Stop");
mc.msgUnSubscribe();
}
public void destroy() {
System.out.println("MsgConsoleApplet Destroy");
}
}
Regards
Bobby -
3. Re: Applet JMS Problem
sulfur Dec 3, 2003 8:29 PM (in response to bobbysun)Hi just wondering of anyone has a solution.
I have the exact same problem using Netscape 7.1/Mozilla 1.4 but the applet code works perfectly in IE 6. Is there a known issue with Mozilla?
Using JBoss 3.2.1-Tomcat 4.1.24 & JDK 1.4.2. Applet trusted via self signed JARs.
I have a standard applet with init(), start(), stop(), destroy(). I noticed both Mozilla & IE will stop & destroy applet on page exit or refresh. My code does explicitly stop & close the TopicConnection & Session.
I've tried OIL & UIL2 and got similar errors.
Stack Trace w/ OIL:
DEBUG [thread myClass] (SpyConnectionFactoryObjectFactory.java:44) - Extracting SpyConnectionFactory from reference
DEBUG [thread myClass] (SpyConnectionFactoryObjectFactory.java:52) - The GenericConnectionFactory is: GenericConnectionFactory:[server=org.jboss.mq.il.oil.OILServerIL@1898115,connectionProperties={OIL_TCPNODELAY_KEY=yes, PingPeriod=60000, OIL_PORT_KEY=8090, ClientILService=org.jboss.mq.il.oil.OILClientILService, OIL_ADDRESS_KEY=172.16.125.217}]
DEBUG [thread myClass] (GenericConnectionFactory.java:75) - Handing out ClientIL: org.jboss.mq.il.oil.OILClientILService
DEBUG [thread myClass] (Connection.java:961) - Cannot start a the client IL service
java.lang.IllegalThreadStateException
at java.lang.ThreadGroup.add(Unknown Source)
at java.lang.Thread.init(Unknown Source)
at java.lang.Thread.(Unknown Source)
at org.jboss.mq.il.oil.OILClientILService.start(OILClientILService.java:295)
at org.jboss.mq.Connection.startILService(Connection.java:954)
at org.jboss.mq.Connection.(Connection.java:249)
at org.jboss.mq.Connection.(Connection.java:315)
at org.jboss.mq.SpyConnection.(SpyConnection.java:59)
at org.jboss.mq.SpyConnectionFactory.createTopicConnection(SpyConnectionFactory.java:78)
(...snip...)
DEBUG [thread myClass] (NestedThrowable.java:128) - org.jboss.util.NestedThrowable.parentTraceEnabled=true
DEBUG [thread myClass] (NestedThrowable.java:128) - org.jboss.util.NestedThrowable.nestedTraceEnabled=false
DEBUG [thread myClass] (NestedThrowable.java:128) - org.jboss.util.NestedThrowable.detectDuplicateNesting=true
Thanks,
Anthony. -
4. Re: Applet JMS Problem
e4muell1 Feb 13, 2004 1:27 PM (in response to bobbysun)Hi
We have the same problem and found out that this is a bug in JBoss. The problem is complex:
- Browsers use the same virtual machine for different applets. They use different classloaders for different sites and same class loaders for same site. So far no problem.
- BUT: If an applet is loaded and another page is displayed (where there is no applet), the Applet.destroy() method is called AND the virtual machine destroys ALL the threads and THREAD GROUPS!
- And here comes the bug: OILClientILService uses a static THREAD GROUP where it adds a new thread when starting. But this thread is DESTROYED when re-visiting the applet. -> BUM, IllegalThreadStateException.
Sad that JBoss still is not production capable.
Regards,
Stefan