Applet not getting initialized on the browser while using jms to connect to activemq

585 views Asked by At

I have created a java applet which acts like a whiteboard and transmits realtime coordinates using jms connected to activemq broker using Websphere application Server.

While i run the applet in applet viewer of eclipse my code runs fine and the receiving end draws the coordinates on whiteboard

when i embed the applet in a html file and try running the same through the browser i get an error "applet not initialized". I tried running the same through the appletviewer provided by sun (iam using linux-fedora), iam getting this error in the terminal :-


java.lang.ExceptionInInitializerError at org.apache.activemq.ActiveMQConnectionFactory.setBrokerURL(ActiveMQConnectionFactory.java:373) at org.apache.activemq.ActiveMQConnectionFactory.(ActiveMQConnectionFactory.java:135) at org.apache.activemq.ActiveMQConnectionFactory.(ActiveMQConnectionFactory.java:131) at jmspub.Pub.init(Pub.java:26) at sun.applet.AppletPanel.run(AppletPanel.java:436) at java.lang.Thread.run(Thread.java:636) Caused by: java.security.AccessControlException: access denied (java.util.PropertyPermission * read,write) at java.security.AccessControlContext.checkPermission(AccessControlContext.java:342) at java.security.AccessController.checkPermission(AccessController.java:553) at java.lang.SecurityManager.checkPermission(SecurityManager.java:549) at java.lang.SecurityManager.checkPropertiesAccess(SecurityManager.java:1269) at java.beans.PropertyEditorManager.setEditorSearchPath(PropertyEditorManager.java:169) at org.apache.activemq.util.IntrospectionSupport.(IntrospectionSupport.java:57) ... 6 more


error is in this line of the code:- ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory("tcp://localhost:61616");

Please Help me find a solution....

2

There are 2 answers

0
Andrew Thompson On

AccessControlExceptions are indicating this applet needs to be trusted.

OTOH this statement is suspicious.

ActiveMQConnectionFactory factory = new 
    ActiveMQConnectionFactory("tcp://localhost:61616");

How is that String formed? Does it point back to the 'home' server? If it does, the JRE seems to be confused and the applet will not need signing.

0
Hiram Chirino On

Looks like ActiveMQ is trying to register a PropertyEditor which is not allowed by the applet security sandbox. I've opened bug report AMQ-3181. Every thing should work fine even if the property editor does not get registered so it's a simple case of just having to trap the exception.