2 Replies Latest reply on Jul 3, 2003 10:10 PM by Anthony Mowers

    jms applet stange errors

    Citu Adrian Newbie

      Hi,
      I have jboss3.0.3 on a xp station. I have an applet that it connects to a topin on the server.

      If i launch the applet from the appletviewer it's working fine but the problem is when i try to load the applet in the browser. The error is:


      java.lang.ExceptionInInitializerError

      at java.lang.Class.forName0(Native Method)

      at java.lang.Class.forName(Class.java:130)

      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.Connection.(Connection.java:264)

      at org.jboss.mq.SpyConnection.(SpyConnection.java:59)

      at org.jboss.mq.SpyConnectionFactory.createTopicConnection(SpyConnectionFactory.java:78)

      at JmsApplet.Applet1.init(Applet1.java:84)

      at sun.applet.AppletPanel.run(AppletPanel.java:341)

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

      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)




      And now i will give the applet code:


      Hashtable env = new Hashtable();

      env.put ("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");

      env.put ("java.naming.provider.url", "jnp://"+this.getCodeBase().getHost()+":1099");
      env.put("java.naming.rmi.security.manager", "yes");


      env.put ("java.naming.factory.url.pkgs", "org.jboss.naming:org.jboss.interfaces");
      env.put ("jnp.socketFactory", "org.jnp.interfaces.TimedSocketFactory");


      InitialContext jndi = new InitialContext(env);
      System.out.println("I have InitialContext");

      // Lookup a JMS connection factory
      //TopicConnectionFactory conFactory = (TopicConnectionFactory)jndi.lookup("ConnectionFactory");
      TopicConnectionFactory conFactory = (TopicConnectionFactory)jndi.lookup("UILConnectionFactory");

      System.out.println("I have my Factory");

      // Create a JMS connection
      connection = conFactory.createTopicConnection();

      System.out.println("Apres connection");
      // Create a JMS session object
      pubSession = connection.createTopicSession(false,Session.AUTO_ACKNOWLEDGE);
      subSession = connection.createTopicSession(false,Session.AUTO_ACKNOWLEDGE);

      jbInit();

      Topic chatTopic = (Topic)jndi.lookup("topic/testTopic");
      System.out.println("I have my Topic");

      publisher = pubSession.createPublisher(chatTopic);
      subscriber = subSession.createSubscriber(chatTopic);

      // Set a JMS message listener
      subscriber.setMessageListener(this);
      connection.start();


      So what's the problem? what's the difference between an appletviewer execution and browser execution?

      Thank's

      Ady

        • 1. Re: jms applet stange errors
          Citu Adrian Newbie

          Hi,

          Finaly i found the solution; i've modified tte java.policy file of my plug-in and i add the newt line:
          permission java.security.AllPermission;

          • 2. Re: jms applet stange errors
            Anthony Mowers Newbie

            I encountered the same error when trying to use JMS from a java application launched by web start.

            After reading through the source code for the JBoss JMS I think I discovered the problem.

            During authentication the SocketHandler code calls System.getProperty to see if special configuration options have been set for connection creation.

            System.getProperty is an operation that cannot be called from an applet or web start application because it violates the default security restrictions of the applet's secure sandbox.

            This explains why your change to security permissions fixed the problem.