[jboss-user] [EJB 3.0] - multiple clientConnectAddresses?
do-not-reply at jboss.com
Tue Jun 24 10:12:27 EDT 2008
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 126.96.36.199.
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 188.8.131.52:28086 and would get redirected to the internal address of machine A (192.168.1.58:8080).
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 (184.108.40.206:28086) and threw some ConnectionException (org.jboss.remoting.transport.http.WebServerError, "Connection refused"). so my configuration is correct, i guess.
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.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4160241#4160241
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4160241
More information about the jboss-user