Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can use placeholders in your Spring configuration and move the specific values to a properties file. To do that, you first need a bean that will resolve properties from file:</p> <pre><code>&lt;!-- Read file that contains properties --&gt; &lt;bean id="properties" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"&gt; &lt;property name="location" value="classpath:app.properties" /&gt; &lt;/bean&gt; </code></pre> <p>Next you can modify your <code>entityRmiServiceExporter</code> bean to use the values from that file:</p> <pre><code>&lt;bean id="entityRmiServiceExporter" class="org.springframework.remoting.rmi.RmiServiceExporter"&gt; &lt;property name="serviceName" value="entityService"/&gt; &lt;property name="service" ref="entityServiceImpl"/&gt; &lt;property name="serviceInterface" value="IEntityService"/&gt; &lt;property name="registryPort" value="1099"/&gt; &lt;property name="registryHost" value="${rmi.endpoint}"/&gt; &lt;/bean&gt; </code></pre> <p>And you need an app.properties file with a line like this:</p> <pre><code>rmi.endpoint=10.0.2.15 </code></pre> <h2>Alternative approach</h2> <p>According to the <a href="http://static.springsource.org/spring/docs/3.2.3.RELEASE/javadoc-api/org/springframework/remoting/rmi/RmiServiceExporter.html" rel="nofollow">RmiServiceExporter Javadoc</a>, there might be an alternative approach. This Javadoc says:</p> <blockquote> <p>Note: RMI makes a best-effort attempt to obtain the fully qualified host name. If one cannot be determined, it will fall back and use the IP address. Depending on your network configuration, in some cases it will resolve the IP to the loopback address.</p> </blockquote> <p>You can tell RMI what the machines hostname is by passing <code>-Djava.rmi.server.hostname=server.mycompany.com</code> to your JVM when its launched.</p> <p>This means you don't have to configure your Spring bean - instead, you configure your JVM to expose the RMI interfaces on a different interface. If your machine is directly exposed to the internet (i.e., no firewall or something in between), I would not do that. If the machine is inside a company network, it might be acceptable or even preferable to solve it this way.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload