2 Replies Latest reply on Aug 6, 2003 12:34 AM by jpbonn

    JMS Applet Problem

    Nima Mazloumi Newbie

      Hi there,
      I have a problem to create a TopicConnectionFactory from my applet. Can someone help?
      -------------------------------------------
      Here my code snippet (see JBoss doc example):
      -------------------------------------------

      String myServer = this.getCodeBase().getHost();
      Properties jndiProps = new Properties() ;
      jndiProps.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory" ) ;
      jndiProps.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces" ) ;
      jndiProps.setProperty("java.naming.provider.url", myServer) ;

      Context jndiContext = new InitialContext(jndiProps);
      TopicConnectionFactory factory = (TopicConnectionFactory)jndiContext.lookup("UILConnectionFactory");
      Topic topic = (Topic) jndiContext.lookup("topic/testTopic");
      TopicConnection connect = factory.createTopicConnection("applet", "applet");
      --------------------------------------------------
      TopicSession session = connect.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
      TopicSubscriber subscriber = session.createSubscriber(topic);
      subscriber.setMessageListener(this);
      connect.start();
      --------------------------------------
      Comment
      --------------------------------------
      I added a user "applet" with password "applet" in the jbossmq-state.xml and changed the java.policy of the client to be able to contact the server, commented all org.jboss.proxy.SecurityInterceptor for clients in the standardjboss.xml but I get the following exception when getting to the above underlined call (createTopicConnection) no matter if I use a user "applet" or not:
      -----------------------------------------
      Exception:
      ----------------------------------------
      java.lang.ExceptionInInitializerError
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Class.java:140)
      at org.jboss.util.NestedThrowable$Util.class$(NestedThrowable.java:27)
      at org.jboss.util.NestedThrowable$Util.(NestedThrowable.java:101)
      at org.jboss.mq.SpyJMSException.(SpyJMSException.java:67)
      at org.jboss.mq.Connection.authenticate(Connection.java:766)
      at org.jboss.mq.Connection.(Connection.java:233)
      ....
      -----------------------------------------
      Caused by:
      -----------------------------------------
      Caused by: java.security.AccessControlException: access denied (java.util.PropertyPermission org.jboss.util.NestedThrowable.parentTraceEnabled read)
      ....
      ----------------------------------------
      Full Stacktrace:
      ----------------------------------------
      java.lang.ExceptionInInitializerError
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Class.java:140)
      at org.jboss.util.NestedThrowable$Util.class$(NestedThrowable.java:27)
      at org.jboss.util.NestedThrowable$Util.(NestedThrowable.java:101)
      at org.jboss.mq.SpyJMSException.(SpyJMSException.java:67)
      at org.jboss.mq.Connection.authenticate(Connection.java:766)
      at org.jboss.mq.Connection.(Connection.java:233)
      at org.jboss.mq.SpyConnection.(SpyConnection.java:48)
      at org.jboss.mq.SpyConnectionFactory.createTopicConnection(SpyConnectionFactory.java:97)
      at applet.JMSApplet.connectToJMS(JMSApplet.java:157)
      at applet.JMSApplet.callEjbButton_actionPerformed(JMSApplet.java:96)
      at applet.JMSApplet$1.actionPerformed(JMSApplet.java:45)
      at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1764)
      at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1817)
      at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:419)
      at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:257)
      at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:245)
      at java.awt.Component.processMouseEvent(Component.java:5093)
      at java.awt.Component.processEvent(Component.java:4890)
      at java.awt.Container.processEvent(Container.java:1566)
      at java.awt.Component.dispatchEventImpl(Component.java:3598)
      at java.awt.Container.dispatchEventImpl(Container.java:1623)
      at java.awt.Component.dispatchEvent(Component.java:3439)
      at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3450)
      at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3165)
      at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3095)
      at java.awt.Container.dispatchEventImpl(Container.java:1609)
      at java.awt.Component.dispatchEvent(Component.java:3439)
      at java.awt.EventQueue.dispatchEvent(EventQueue.java:450)
      at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:197)
      at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:144)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:136)
      at java.awt.EventDispatchThread.run(EventDispatchThread.java:99)
      Caused by: java.security.AccessControlException: access denied (java.util.PropertyPermission org.jboss.util.NestedThrowable.parentTraceEnabled read)
      at java.security.AccessControlContext.checkPermission(AccessControlContext.java:270)
      at java.security.AccessController.checkPermission(AccessController.java:401)
      at java.lang.SecurityManager.checkPermission(SecurityManager.java:542)
      at java.lang.SecurityManager.checkPropertyAccess(SecurityManager.java:1291)
      at java.lang.System.getProperty(System.java:611)
      at org.jboss.util.NestedThrowable$Util.getBoolean(NestedThrowable.java:123)
      at org.jboss.util.NestedThrowable.(NestedThrowable.java:39)
      ... 34 more