5 Replies Latest reply on Nov 16, 2004 12:26 AM by Edmond Shiau

    Applet as JMS Client

    Edmond Shiau Newbie

      In order to call InitialContext(), what information should be supplied with Context.INITIAL_CONTEXT_FACTORY? The code fragment is as fllow.
      Hashtable env = new Hashtable();
      env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory ");
      env.put(Context.PROVIDER_URL, hostName);
      env.put(Context.APPLET,this);
      Context context = new InitialContext(env);

      But get error as "can not instantiate the class:: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: org/jnp/interfaces/NamingContextFactory ]"

      And what should be included in the HTML's ARCHIVE parameter besides "jboss-j2ee.jar?"

        • 1. Re: Applet as JMS Client
          Darran Lofthouse Master

          You will need jbossall-client.jar not jboss-j2ee.jar.

          • 2. Re: Applet as JMS Client
            Edmond Shiau Newbie

            I tried jbossall-client.jar, but the error message was the same.

            • 3. Re: Applet as JMS Client
              Darran Lofthouse Master

              I have an application running on JBoss 3.2.3 that sends messages to a JMS Topic, I have an applet that subscribes to the topic to receive the messages.

              The archives referenced in my html are jbossall-client.jar and my applets jar.

              Have you put the jbossall-client.jar in the same folder as the jar for your applet?

              Also you may need to sign the jar for your applet and jbossall-client.jar.

              • 4. Re: Applet as JMS Client
                Edmond Shiau Newbie

                 

                "darranl" wrote:

                Have you put the jbossall-client.jar in the same folder as the jar for your applet?

                Yes.

                "darranl" wrote:

                Also you may need to sign the jar for your applet and jbossall-client.jar.

                I have tried according to your advise. However, the result was the same.

                • 5. Re: Applet as JMS Client
                  Edmond Shiau Newbie

                   

                  "edmond" wrote:
                  In order to call InitialContext(), what information should be supplied with Context.INITIAL_CONTEXT_FACTORY? The code fragment is as fllow.
                  Hashtable env = new Hashtable();
                  env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory ");
                  env.put(Context.PROVIDER_URL, hostName);
                  env.put(Context.APPLET,this);
                  Context context = new InitialContext(env);

                  But get error as "can not instantiate the class:: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: org/jnp/interfaces/NamingContextFactory ]"


                  I have catched the problem. It is the white space at the end of string "org.jnp.interfaces.NamingContextFactory"!!