3 Replies Latest reply on Jun 26, 2008 8:19 AM by robert.geisler

    multiple clientConnectAddresses?

    robert.geisler

      hello und sorry for my poor english...
      i have got some questions concerning EJB3 and Remoting. i am using JBoss 4.2.2.GA and i am trying to access EJB3s through HTTP.

      the use case:
      i have my application deployed on JBoss and my application should get accessed by clients from LAN and over the internet. lets say, JBoss is running on machine A, then there is a machine B within the LAN which knows machine A as 192.168.1.58, and there is a machine C which connects over the internet and knows machine A as 217.18.182.49.
      additionally i am not allowed to open too much ports, so i want to use just port 8080 and access my EJBs through servlets. machine B than could use 192.168.1.58:8080 to communicate to jboss, machine C could use 217.18.182.49:28086 and would get redirected to the internal address of machine A (192.168.1.58:8080).

      the solution:
      i started with http://wiki.jboss.org/wiki/Accessing_EJB3s_over_HTTP_HTTPS that told me to

      • configure web containers (deploy/jboss-web.deployer/server.xml),
      • configure servlets (deploy/servlet-invoker.war/WEB-INF/web.xml),
      • configure EJB 3.0 connector (deploy/ejb3.deployer/META-INF/jboss-service.xml). and
      • add @RemoteBinding(clientBindUrl="servlet://host:port//servlet-invoker/ServerInvokerServlet") to all of my beans i want to access remotely.i followed the instructions and yes, it seems to work: after i deployed the ServerInvokerServlet and i configured the EJB 3.0 Connector, especially the "Configuration"-attribute including clientConnectAddress and clientConnectPort, my client tried to connect to the external address (217.18.182.49:28086) and threw some ConnectionException (org.jboss.remoting.transport.http.WebServerError, "Connection refused"). so my configuration is correct, i guess.

        the question(s):
        there still is a problem with the clientConnectAddress. for sure, external clients could be able to communicate with my application (machine A), because JBoss tells the clients (machine C) to connect to the external address. but what about machine B? machine B gets told from JBoss to connect to the external address, too. but machine B does not even know this address.

        some weeks ago i got this all working for EJB 2.1. i deployed and configured some servlets (JMXInvokerServlet, EJBInvokerServlet, HTTPServerILServlet) and the EJBContainer. there was a similar problem: i had to static declare the URLs for the servlet invokers.
        i then found a solution in not declaring static URLs, but using system properties for the InvokerURLs. i now can set the system properties in my client application to switch between external and internal address (i just try to connect to the external address and use the internal in case of an error).

        i understand that JBoss has to tell the clients where to connect to. but in some cases JBoss does not know this address, because there are at least two possibilities: one internal (LAN) and one external (redirected). so what is the solution in this situation?

        i could imagine to solve my issue if
        • it is possible to avoid the static declaration of clientConnectAddress of the EJB 3.0 Connector and to modify the declaration before the client uses the wrong address. but am i able to set the clientConnectAddress within the client by myself?
        • i could configure two invokers (EJB 3.0 Connector), one for transport="socket" and one for transport="servlet", using sockets for internal clients and servlets for external clients. but how can i tell the client which invoker to use if i neither do want to develop different EJBs nore do want to use different JNDI-names for different Invokers?
        • i would know about any another solutions for my problem...
          thanks in advance for your ideas, hints and information.
          robert


        • 1. Re: multiple clientConnectAddresses?
          robert.geisler

          hello again,

          maybe i found an answer to my first question: http://www.jboss.com/index.html?module=bb&op=viewtopic&t=65790

          "tom.elrod@jboss.com" wrote:
          Remoting allows for system property settings on the client already

          but i cannot found more information and details which client system properties are supported.
          i tried to configure InvokerLocator of the EJB 3.0 Remoting Connector

          <attribute name="InvokerLocator">jboss.protocol.http.ejb2</attribute>

          but on startup JBoss complains about an illegal URL.
          so how could clients change the value of the system property if JBoss resolves the InvokerLocator first...?

          • 2. Re: multiple clientConnectAddresses?
            jaikiran

             

            "robert.geisler" wrote:

            <attribute name="InvokerLocator">jboss.protocol.http.ejb2</attribute>



            Is jboss.protocol.http.ejb2 the system property that you are trying to pass? Then the xml should look like:

            <attribute name="InvokerLocator">${jboss.protocol.http.ejb2}</attribute>




            • 3. Re: multiple clientConnectAddresses?
              robert.geisler

              thanks for your reply, jaikiran.

              "jaikiran" wrote:

              Is jboss.protocol.http.ejb2 the system property that you are trying to pass? Then the xml should look like:
              <attribute name="InvokerLocator">${jboss.protocol.http.ejb2}</attribute>


              ok, this is a start.
              but your notation seems to be equal to ${jboss.bind.address}, hence it is about a system property of the server, i guess. well, i wonder if i can set a system property which will be resolved in the client only. my problem is that the server does not know where the clients have to connect to. that is why i want the client to set the actual value. is this possible (yet)?