[jboss-user] [JNDI/Naming/Network] - Re: How to Access EJB over HTTP in remote machine?

robert.geisler do-not-reply at jboss.com
Wed Jun 25 02:46:19 EDT 2008


"ritesh163" wrote : * which container-name or section to change to what in conf/standardjboss.xml.
it depends on your EJBs. for Stateless SessionBeans for example JBoss defaults to "Standard Stateless SessionBean" if not another container-configuration is declared in the deployment descriptor of your EJBs. every container-configuration uses a invoker-proxy-binding-name to refer to its invoker, "stateless-unified-invoker" is the default for the "Standard Stateless SessionBean" configuration.
we added a new invoker called "stateless-http-invoker" (see below) and a new container-configuration "Custom Stateless SessionBean" referring to the new invoker. in the deployment descriptors of our EJBs we configured the new container-configuration.

standardjboss.xml:
  | <jboss>
  |   <container-configurations>
  |     ...
  |     <!-- extend default container-configuration, use different invoker -->    <container-configuration extends="Standard Stateless SessionBean">      <container-name>Custom Stateless SessionBean</container-name>      <invoker-proxy-binding-name>stateless-http-invoker</invoker-proxy-binding-name>    </container-configuration>
  |   </container-configurations>
  |   ...
  |   <invoker-proxy-bindings>
  |     <!-- copy standard-unified-invoker, change type to http -->
  |     <invoker-proxy-binding>      <name>stateful-http-invoker</name>
  |       <invoker-mbean>jboss:service=invoker,type=http</invoker-mbean>      ...
  |     </invoker-proxy-binding>
  |   </invoker-proxy-bindings>
  |   ...
  | </jboss>
jboss.xml (deployment deskriptor):
  | <jboss>
  |   <enterprise-beans>
  |     <session>
  |       <ejb-name>MyStatelessSessionBean</ejb-name>
  |       ...      <configuration-name>Custom Stateless SessionBean</configuration-name>      ...
  |     </session>
  |     ...
  |   </enterprise-beans>
  |   ...
  | </jboss>



"ritesh163" wrote : * if external addresses are set as the InvokerURLs for the servlets then will I have to set external IP at start of server. I am using below command to start the server: run.sh -c default -b [internal ip] for Jboss. If I replace [internal ip] with [external ip] then the server won't start.
start option "-b" tells JBoss to which address to bind to, so your internal ip should be the correct parameter. just for the InvokerURLs of the servlets you have to set the external ip, because JBoss sends the InvokerURL back to the clients to let them know where to connect to. nonetheless you have to know the external ip on start of JBoss, because you cannot change the InvokerURL on runtime. if you do not know the external ip, then there is a little trick: instead of an address you can set a simple String for the InvokerURL, "jboss.ejb2.invoker.http" for example. JBoss will interpret this String as a key for a system property (on the client machine). the value of the system property can be set by your client application to set the InvokerURL on runtime.
we use this trick and set the InvokerURL in the client, because JBoss does not know the address where clients have to connect to. in our client application we just try to connect to the external ip. if the external ip is available we set it as the value of the system property; if it is not available we set the internal ip. doing it this way our client is able to connect to JBoss from LAN (internal address) and over the internet (external address).



"ritesh163" wrote : * Also can I use domain name in place of IPs?
because you can set system property names as InvokerURLs i would guess domain names are supported, too. but i did not test this. just give it a try.


kind regards
robert

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4160435#4160435

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4160435



More information about the jboss-user mailing list