1 2 Previous Next 15 Replies Latest reply on Nov 24, 2003 12:17 PM by Anthony Law

    Applet & JNDI

    Marcin Newbie

      Hi. Some times ago I tried to communicate EJB component from an applet and it failed :(. Now I have the same problem with registering applet as a JMS subscriber, but now i have to do it.
      The problem is when I try to lookup the JNDI name:

      topicConnectionFactory = (TopicConnectionFactory) jndiContext.lookup("ConnectionFactory");

      I got the following exception:


      I have the following question: How should I configure JBoss and JVM to allow applet lookup the topic.

      Thanks for your help.


        • 1. Re: Applet & JNDI
          Marcin Newbie

          Now I'm a little bit closer. Now I get the following exception when running an applet on the html page:

          at java.lang.Class.forName0(Native Method)
          at java.lang.Class.forName(Class.java:140)
          at org.jboss.util.NestedThrowable$1.class$(NestedThrowable.java:101)
          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:769)
          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 com.mobileis.web.messageApplet.init(messageApplet.java:52)
          at sun.applet.AppletPanel.run(AppletPanel.java:348)
          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)

          I guess that's still problem of configuration.... Please help!

          • 2. Re: Applet & JNDI
            Marcin Newbie

            hmmm, and I guess important is that this exception is raising in this line:

            topicConnection = topicConnectionFactory.createTopicConnection();


            • 3. Re: Applet & JNDI
              Stephane Nicoll Master

              The first one was a security issue. You are not allowed to open TCP/IP sockets on any host but the one where the applet was downloaded.

              I assume you solved the issue

              The other one is a Class.forName which failed. Are you sure your applet have all the classes needed (check client jars)

              Does your applet work fine with the AppletViewer?



              • 4. Re: Applet & JNDI
                Marcin Newbie

                Yes, I was very surprised that it works fine in Appletviewer, is it something with misiing jars?

                • 5. Re: Applet & JNDI
                  Stephane Nicoll Master

                  You shouldn't be surprised. Doing what you are trying to achieve in an applet is not that easy. My first guess is a corrupted/missing jar.

                  In any case, it's related to your configuration/deployment. It has nothing to do with JBoss nor JMS in general.



                  • 6. Re: Applet & JNDI
                    Marcin Newbie

                    Sorry, I tried another time with appletviewer, and it doesn't work. I've got the same exception when using



                    • 7. Re: Applet & JNDI
                      Stephane Nicoll Master

                      Is your JBoss running on ?



                      • 8. Re: Applet & JNDI
                        Marcin Newbie

                        Yes, I have two network adapters, but my main IP is My JBoss is running on that IP.


                        • 9. Re: Applet & JNDI
                          Stephane Nicoll Master

                          DAMNIT! please provide the full stracktrace when you have a problem...

                          If you check the cause, it's a security exception being thrown by the applet (meaning the applet has not the right to read some JBoss property or something)

                          You will have to sign your applet and give it the needed rights.



                          • 10. Re: Applet & JNDI
                            Marcin Newbie

                            Thanks, and don't be agry, the full stacktrace is in my firsty post. I thought you've seen it... :)



                            • 11. Re: Applet & JNDI
                              Stephane Nicoll Master

                              I am not angry :o

                              • 12. Re: Applet & JNDI
                                Marcin Newbie

                                Anyway, thanks for your help...


                                • 13. Re: Applet & JNDI
                                  abhijit_deb Newbie

                                  Could you solve this problem at all! I am having the same problem and it looks like not a problem of missing jar or some thing.
                                  Thanks in advance,

                                  • 14. Re: Applet & JNDI
                                    Anthony Law Newbie

                                    People, this is basic applet behaviour. It is restricted by the sandbox security.

                                    Look at the root cause of your exception. It is trying to do a getProperty() which it doesn't have permission to. It has nothing to do with missing jars!

                                    To make it work, either:

                                    1) Modify the java.policy file on your client to grand permission, or

                                    2) Sign the damn JAR file :P

                                    1 2 Previous Next