5 Replies Latest reply on Apr 5, 2005 6:57 AM by wikey

    Pls Help!!! HTTPInvoker Does not Work

    wikey

      Hi, i have a problem access my JBOSS thru firewall, i have followed the instruction below but unfortunately no luck!

      http://www.nemesisit.ro/opendocs/simplearch/simplejboss.html

      I think i have missed out something as the xml file below.

      BTW, do i need to specified the "firewall ip" or the "server ip" that running JBOSS?

      If the firewall ip, which port should use?


      jboss-service.xml
      ============
      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE server>

      <!-- The HTTP invoker service configration-->

      http://192.168.0.71:8080/invoker/EJBInvokerServlet


      http://192.168.0.71:8080/invoker/EJBInvokerHAServlet

      <!-- Expose the Naming service interface via HTTP -->

      <!-- The Naming service we are proxying -->
      jboss:service=Naming
      http://192.168.0.71:8080/invoker/JMXInvokerServlet
      org.jnp.interfaces.Naming


      <!-- Expose the Naming service interface via clustered HTTP. This maps to the ReadOnlyJNDIFactory servlet URL-->

      jboss:service=Naming
      http://192.168.0.71:8080/invoker/JMXInvokerServlet
      org.jnp.interfaces.Naming



        • 1. Re: Pls Help!!! HTTPInvoker Does not Work
          wikey

          ...

          • 2. Re: Pls Help!!! HTTPInvoker Does not Work

            Check Chapter 8.8 in the Admin/Developer guide, which instructs on how to use JBoss from behind a firewall (http://www.jboss.org/docs/index#as). Also can reference wiki entry at http://www.jboss.org/wiki/Wiki.jsp?page=UsingJBossBehindAFirewall.

            • 3. Re: Pls Help!!! HTTPInvoker Does not Work
              wikey

              Hi, Tom. Thks for reply.

              The external_host_name is refer to the firewall ip or the server ip that running jboss?

              -Djava.rmi.server.hostname=<external_host_name>
              -Djava.rmi.server.useLocalHostname=false


              • 4. Re: Pls Help!!! HTTPInvoker Does not Work
                wikey

                Hi Tom,

                I have tried the instruction from the site you given which is
                http://www.jboss.org/wiki/Wiki.jsp?page=UsingJBossBehindAFirewall
                but unfortunately still no luck!

                Hereby, i post all my related source code and configuration file for your reference.


                Thank in advance,
                Wikey

                My testing client code
                ================

                import java.net.InetAddress;
                import java.util.Hashtable;

                import httpTest.interfaces.HttpTest;
                import httpTest.interfaces.HttpTestHome;

                import javax.naming.Context;
                import javax.naming.InitialContext;
                import javax.rmi.PortableRemoteObject;

                /**
                * User: len
                * Date: Dec 4, 2004
                * Time: 12:48:24 AM
                * @author Marilen Corciovei
                * @version $Id: HttpTestRemote.java,v 1.1.1.1 2004/12/03 23:55:10 len Exp $
                */
                public class HttpTestRemote {

                private static int limit = 5;

                public static void main(String[] args) {
                HttpTestHome home = null;
                try {
                if (args.length == 0)
                throw new Exception("IP and port not specified");
                System.out.println("hostname:" + InetAddress.getLocalHost());
                String ip = args[0];
                Hashtable env = new Hashtable();
                env.put(
                Context.INITIAL_CONTEXT_FACTORY,
                "org.jboss.naming.HttpNamingContextFactory");
                //Context.
                env.put(
                Context.PROVIDER_URL,
                "http://" + ip + "/invoker/JNDIFactory");

                InitialContext iniCtx = new InitialContext(env);
                Object objref = iniCtx.lookup("ejb/HttpTest");

                //Context context = new InitialContext();
                //context.getEnvironment();
                //Object ref = context.lookup("ejb/HttpTest");
                home =
                (HttpTestHome) PortableRemoteObject.narrow(
                objref,
                HttpTestHome.class);
                HttpTest bean = home.create();
                String result = bean.simpleMethod("I am a remote client");
                bean.remove();

                System.out.println("result = " + result);
                } catch (Exception e) {
                //do not handle this (out of scope)
                e.printStackTrace();
                }
                }
                }

                ejb-jar.xml
                ==========

                <?xml version="1.0" encoding="UTF-8"?>
                <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">

                <ejb-jar >

                <![CDATA[No Description.]]>
                <display-name>HttpTest</display-name>

                <enterprise-beans>

                <!-- Session Beans -->

                <![CDATA[Description for HttpTest]]>
                <display-name>Name for HttpTest</display-name>

                <ejb-name>HttpTest</ejb-name>

                httpTest.interfaces.HttpTestHome
                httpTest.interfaces.HttpTest
                <ejb-class>httpTest.ejb.HttpTestBean</ejb-class>
                <session-type>Stateful</session-type>
                <transaction-type>Container</transaction-type>



                </enterprise-beans>

                <!-- Relationships -->

                <!-- Assembly Descriptor -->
                <assembly-descriptor >
                <!-- finder permissions -->
                <!-- transactions -->
                <!-- finder transactions -->
                </assembly-descriptor>

                </ejb-jar>


                C:\jboss-4.0.0\server\all\conf\jboss-service.xml snippet
                =======================================

                <!-- RMI/JRMP invoker -->


                4444
                jboss:service=TransactionManager



                1099
                1098



                C:\jboss-4.0.0\server\all\deploy\http-invoker.sar\META-INF\jboss-service.xml
                =======================================================


                <?xml version="1.0" encoding="UTF-8"?>
                <!DOCTYPE server>

                <!-- The HTTP invoker service configration-->

                http://www.abc.com:8001/invoker/EJBInvokerServlet



                http://www.abc:8001/invoker/EJBInvokerHAServlet


                <!-- Expose the Naming service interface via HTTP -->


                <!-- The Naming service we are proxying -->
                jboss:service=Naming
                http://www.abc:8001/invoker/JMXInvokerServlet
                org.jnp.interfaces.Naming




                <!-- Expose the Naming service interface via clustered HTTP. This maps to the ReadOnlyJNDIFactory servlet URL-->

                jboss:service=Naming
                http://www.abc:8001/invoker/JMXInvokerServlet
                org.jnp.interfaces.Naming




                run.bat snippet
                ===========

                set JAVA_OPTS=%JAVA_OPTS% -Xms128m -Xmx512m -Djava.rmi.server.hostname=www.abc.com -Djava.rmi.server.useLocalHostname=false

                • 5. Re: Pls Help!!! HTTPInvoker Does not Work
                  wikey

                  Hi, i manage to solve the problem.

                  I changed the port 4444 to something else...

                  btw, i have enable all ports from the firewall setting but somehow it was block.

                  4444 is not a good number...for chinese :)

                  Cheers,