5 Replies Latest reply on Dec 22, 2007 4:02 AM by libinggang

    how to send message to remote server with http

    libinggang

      hi,all
      i want to send messages to a remote server with http,but i don't know how .
      how can i get ConnectionFactory from jndi that resides on the remote server (with http)? or can i create a ConnectionFactory that connects to the remote server without jndi?

      Thanks a lot !

      binggangli

        • 1. Re: how to send message to remote server with http
          ataylor

          You need to configure jBoss Remoting. theres an example under docs/examples/http.

          • 2. Re: how to send message to remote server with http
            libinggang

             

            "ataylor" wrote:
            You need to configure jBoss Remoting. theres an example under docs/examples/http.


            thanks!
            is docs/examples/http the same as jboss-messaging-1.4.0.SP3/examples/http?

            I can run that example successfully,but the access to jndi in that example is not over http,and i tried change configure in the jndi.properties from
            [
            java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
            java.naming.provider.url=jnp://172.25.67.39:1099
            java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
            ]

            to
            [
            java.naming.factory.initial=org.jboss.naming.HttpNamingContextFactory
            java.naming.provider.url=http://172.25.67.39:8080/invoker/JMXInvokerServlet
            java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces

            ]

            but i got this exception:

            sleep:
            [echo] Sleeping for 2 seconds ...

            run:
            [java] javax.naming.NoInitialContextException: Cannot instantiate class: org.jboss.naming.HttpNamingContextFactory [Ro
            .ClassNotFoundException: org.jboss.naming.HttpNamingContextFactory ]
            [java] at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:657)
            [java] at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
            [java] at javax.naming.InitialContext.init(InitialContext.java:223)
            [java] at javax.naming.InitialContext.(InitialContext.java:175)
            [java] at org.jboss.example.jms.common.Util.doesDestinationExist(Util.java:51)
            [java] at org.jboss.example.jms.common.ExampleSupport.setup(ExampleSupport.java:214)
            [java] at org.jboss.example.jms.common.ExampleSupport.setup(ExampleSupport.java:194)
            [java] at org.jboss.example.jms.common.ExampleSupport.run(ExampleSupport.java:146)
            [java] at org.jboss.example.jms.http.HttpExample.main(HttpExample.java:136)
            [java] Caused by: java.lang.ClassNotFoundException: org.jboss.naming.HttpNamingContextFactory
            [java] at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
            [java] at java.security.AccessController.doPrivileged(Native Method)
            [java] at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
            [java] at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
            [java] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
            [java] at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
            [java] at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
            [java] at java.lang.Class.forName0(Native Method)
            [java] at java.lang.Class.forName(Class.java:242)
            [java] at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:42)
            [java] at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:654)
            [java] ... 8 more
            [java]
            [java] #####################
            [java] ### FAILURE! ###
            [java] #####################

            BUILD FAILED


            what should i do next?
            Thanks a lot!

            • 3. Re: how to send message to remote server with http
              ataylor

               

              is docs/examples/http the same as jboss-messaging-1.4.0.SP3/examples/http?


              yes thats right.

              The exception you are getting is because HttpNamingContextFactory is not in the classpath. This gets picked up from jbossall-client.jar under the jboss installation. Make sure that you have JBOSS_HOME set correctly.

              Also, there is a bug in the JBoss documentation, change jndi.properties to

              java.naming.factory.initial=org.jboss.naming.HttpNamingContextFactory
              java.naming.provider.url=http://172.25.67.39:8080/invoker/JNDIFactory
              java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
              


              • 4. Re: how to send message to remote server with http
                libinggang

                Thank you very much,ataylor,
                i can run the example successfully now.
                libinggang

                • 5. Re: how to send message to remote server with http
                  libinggang

                  One reason that i got the exception is that there is a white space at the end of item java.naming.factory.initial=org.jboss.naming.HttpNamingContextFactory