简体   繁体   中英

RMI connection issue while using ehcache

Hi I have 2 web applications and I am using Apache Shiro and ehcache for enabling the SSO. My ehcache.xml file is like

<?xml version="1.0" encoding="UTF-8"?>
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="ehcache.xsd" updateCheck="true"
         monitoring="autodetect" dynamicConfig="true" name="cache1">

    <diskStore path="java.io.tmpdir/cache2" />

    <cacheManagerPeerProviderFactory
            class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
            properties="peerDiscovery=automatic,
                        multicastGroupAddress=230.0.0.1,
                        multicastGroupPort=4446, timeToLive=1"
            propertySeparator="," />

    <cacheManagerPeerListenerFactory
            class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory" />

    <cache name="shiro-activeSessionCache" maxElementsInMemory="600"
           eternal="true" overflowToDisk="true" memoryStoreEvictionPolicy="LFU">
        <cacheEventListenerFactory
                class="net.sf.ehcache.distribution.RMICacheReplicatorFactory" />
    </cache>

    <defaultCache maxElementsInMemory="100" eternal="true"
                  overflowToDisk="true" memoryStoreEvictionPolicy="LFU">
    </defaultCache>
</ehcache>

This configurations works fine if my rmi.server.hostname=0.0.0.0, but due to some reasons I have to configure it to my ip like below

-Djava.rmi.server.hostname=10.131.210.201

In that case its throwing an error like below

**java.rmi.ConnectException: Connection refused to host: 10.131.210.201;** 

This configurations works fine if my rmi.server.hostname=0.0.0.0

Impossible. More likely you didn't set it at all.

but due to some reasons I have to configure it to my ip like below

-Djava.rmi.server.hostname=10.131.210.201

You have to set it to the most public IP address of the server host. A 10.* address only works within the LAN it is part of.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM