net.sf.ehcache.distribution.RMIAsynchronousCacheReplicator: java.rmi.UnknownHostException

View: New views
2 Messages — Rating Filter:   Alert me  

net.sf.ehcache.distribution.RMIAsynchronousCacheReplicator: java.rmi.UnknownHostException

by Nathan Good :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


I am attempting to set up a distributed cache between two servers and am getting an java.rmi.UnknownHostException (see stack trace in this e-mail).  I have verified that using the short name the host is not resolvable from server2 to server1, since they are in different domains.  However, I am using the FQDN in the configuration files and have even used the IP addresses in the configuration files on both servers with the same results.  It's as if the FQDN or IP address is being ignored and it's pulling the short name from somewhere.

ehcache 1.5.0, manual peer discovery, running inside JBoss 5.0.0.GA

The servers are NOT in each other's /etc/hosts file.  The FQDNs of the servers are resolvable from each other, but only when given as a FQDN.

I would really appreciate any suggestions anyone might have.  Thank you!


server1.this.domain.example.com -> messages sent successfully to server2.that.domain.example.com
server2.that.domain.example.com -> says server1.this.domain.example.com is unknown

Here is the stack trace from server2.that.domain.example.com:

2009-03-10 09:35:03,643 WARN  [net.sf.ehcache.distribution.RMIAsynchronousCacheReplicator] (Replication Thread) Unable to send message to remote peer.  Message was: Unknown host: server1; nested exception is:
        java.net.UnknownHostException: server1
java.rmi.UnknownHostException: Unknown host: server1; nested exception is:
        java.net.UnknownHostException: server1
        at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:572)
        at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:185)
        at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:171)
        at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:94)
        at net.sf.ehcache.distribution.RMICachePeer_Stub.send(Unknown Source)
        at net.sf.ehcache.distribution.RMIAsynchronousCacheReplicator.flushReplicationQueue(RMIAsynchronousCacheReplicator.java:309)
        at net.sf.ehcache.distribution.RMIAsynchronousCacheReplicator.replicationThreadMain(RMIAsynchronousCacheReplicator.java:122)
        at net.sf.ehcache.distribution.RMIAsynchronousCacheReplicator.access$100(RMIAsynchronousCacheReplicator.java:55)
        at net.sf.ehcache.distribution.RMIAsynchronousCacheReplicator$ReplicationThread.run(RMIAsynchronousCacheReplicator.java:368)
Caused by: java.net.UnknownHostException: server1
        at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:177)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
        at java.net.Socket.connect(Socket.java:520)
        at java.net.Socket.connect(Socket.java:470)
        at java.net.Socket.<init>(Socket.java:367)
        at java.net.Socket.<init>(Socket.java:180)
        at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:22)
        at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:128)
        at net.sf.ehcache.distribution.ConfigurableRMIClientSocketFactory.createSocket(ConfigurableRMIClientSocketFactory.java:72)
        at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:569)
        ... 8 more

Here are the configuration files (I've changed the names of the server for security reasons):

server1.this.domain.example.com config:

<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="ehcache.xsd">
    <cacheManagerPeerProviderFactory class=
                          "net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
                          properties="peerDiscovery=manual, rmiUrls=//server2.that.domain.com:40000/cache1|//server2.that.domain.com:40000/cache2 |//server2.that.domain.com:40000/cache3|//server2.that.domain.com:40000/cache4"
                          propertySeparator="," />

    <cacheManagerPeerListenerFactory
            class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
            properties="hostName=, port=40000, socketTimeoutMillis=2000"/>

    <defaultCache
            maxElementsInMemory="10000"
            eternal="false"
            timeToIdleSeconds="120"
            timeToLiveSeconds="120"
            overflowToDisk="true"
            diskSpoolBufferSizeMB="30"
            maxElementsOnDisk="10000000"
            diskPersistent="false"
            diskExpiryThreadIntervalSeconds="120"
            memoryStoreEvictionPolicy="LRU"
            />
    <cache name="cache1"
           maxElementsInMemory="10000"
           maxElementsOnDisk="10000"
           eternal="true"
           overflowToDisk="true"
           memoryStoreEvictionPolicy="LRU"
           diskPersistent="true">
        <cacheEventListenerFactory class="com.ml.art.util.cache.ConfigurationEventListenerFactory"/>
        <cacheEventListenerFactory
            class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
            properties="replicateAsynchronously=true, replicatePuts=true, replicateUpdates=true,
            replicateUpdatesViaCopy=true, replicateRemovals=true "/>
    </cache>
                <!-- ... rest of caches ... -->
</ehcache>

File from server2.that.domain.example.com:

<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="ehcache.xsd">
    <cacheManagerPeerProviderFactory class=
                          "net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
                          properties="peerDiscovery=manual, rmiUrls=//server1.this.domain.com:40000/cache1|//server1.this.domain.com:40000/cache2 |//server1.this.domain.com:40000/cache3|//server1.this.domain.com:40000/cache4"
                          propertySeparator="," />

    <cacheManagerPeerListenerFactory
            class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
            properties="hostName=, port=40000, socketTimeoutMillis=2000"/>

    <defaultCache
            maxElementsInMemory="10000"
            eternal="false"
            timeToIdleSeconds="120"
            timeToLiveSeconds="120"
            overflowToDisk="true"
            diskSpoolBufferSizeMB="30"
            maxElementsOnDisk="10000000"
            diskPersistent="false"
            diskExpiryThreadIntervalSeconds="120"
            memoryStoreEvictionPolicy="LRU"
            />
    <cache name="cache1"
           maxElementsInMemory="10000"
           maxElementsOnDisk="10000"
           eternal="true"
           overflowToDisk="true"
           memoryStoreEvictionPolicy="LRU"
           diskPersistent="true">
        <cacheEventListenerFactory class="com.ml.art.util.cache.ConfigurationEventListenerFactory"/>
        <cacheEventListenerFactory
            class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
            properties="replicateAsynchronously=true, replicatePuts=true, replicateUpdates=true,
            replicateUpdatesViaCopy=true, replicateRemovals=true "/>
    </cache>
                <!-- ... rest of caches ... -->
</ehcache>



     

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
ehcache-list mailing list
ehcache-list@...
https://lists.sourceforge.net/lists/listinfo/ehcache-list

Parent Message unknown Re: net.sf.ehcache.distribution.RMIAsynchronousCacheReplicator: java.rmi.UnknownHostException

by Nathan Good :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


I was able to resolve this issue.  For posterity, it was an RMI issue.  The host on which RMI was running was not using its FQDN in the RMI messages.

Here is a FAQ the describes the issue and resolution in more detail:

http://java.sun.com/j2se/1.5.0/docs/guide/rmi/faq.html#netunknownhost

Since I'm using JBoss, I simply defined an additional JAVA_OPT of "-Djava.rmi.server.hostname=server1.this.domain.example.com".  It worked great after that.

--Nathan

> --- On Tue, 3/10/09, Nathan Good
> <nathanagood@...> wrote:
> From: Nathan Good <nathanagood@...>
> Subject: [ehcache-list]
> net.sf.ehcache.distribution.RMIAsynchronousCacheReplicator:
> java.rmi.UnknownHostException
> To: ehcache-list@...
> Date: Tuesday, March 10, 2009, 7:09 AM
>
> I am attempting to set up a distributed cache between two
> servers and am
> getting an java.rmi.UnknownHostException (see stack trace
> in this e-mail).  I
> have verified that using the short name the host is not
> resolvable from server2
> to server1, since they are in different domains.  However,
> I am using the FQDN
> in the configuration files and have even used the IP
> addresses in the
> configuration files on both servers with the same results.
> It's as if the
> FQDN or IP address is being ignored and it's pulling
> the short name from
> somewhere.
>
> ehcache 1.5.0, manual peer discovery, running inside JBoss
> 5.0.0.GA
>
> The servers are NOT in each other's /etc/hosts file.
> The FQDNs of the
> servers are resolvable from each other, but only when given
> as a FQDN.
>
> I would really appreciate any suggestions anyone might
> have.  Thank you!
>
>
> server1.this.domain.example.com -> messages sent
> successfully to
> server2.that.domain.example.com
> server2.that.domain.example.com -> says
> server1.this.domain.example.com is
> unknown
>
> Here is the stack trace from
> server2.that.domain.example.com:
>
> 2009-03-10 09:35:03,643 WARN
> [net.sf.ehcache.distribution.RMIAsynchronousCacheReplicator]
> (Replication
> Thread) Unable to send message to remote peer.  Message
> was: Unknown host:
> server1; nested exception is:
>         java.net.UnknownHostException: server1
> java.rmi.UnknownHostException: Unknown host: server1;
> nested exception is:
>         java.net.UnknownHostException: server1
>         at
> sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:572)
>         at
> sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:185)
>         at
> sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:171)
>         at
> sun.rmi.server.UnicastRef.invoke(UnicastRef.java:94)
>         at
> net.sf.ehcache.distribution.RMICachePeer_Stub.send(Unknown
> Source)
>         at
> net.sf.ehcache.distribution.RMIAsynchronousCacheReplicator.flushReplicationQueue(RMIAsynchronousCacheReplicator.java:309)
>         at
> net.sf.ehcache.distribution.RMIAsynchronousCacheReplicator.replicationThreadMain(RMIAsynchronousCacheReplicator.java:122)
>         at
> net.sf.ehcache.distribution.RMIAsynchronousCacheReplicator.access$100(RMIAsynchronousCacheReplicator.java:55)
>         at
> net.sf.ehcache.distribution.RMIAsynchronousCacheReplicator$ReplicationThread.run(RMIAsynchronousCacheReplicator.java:368)
> Caused by: java.net.UnknownHostException: server1
>         at
> java.net.PlainSocketImpl.connect(PlainSocketImpl.java:177)
>         at
> java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
>         at java.net.Socket.connect(Socket.java:520)
>         at java.net.Socket.connect(Socket.java:470)
>         at java.net.Socket.<init>(Socket.java:367)
>         at java.net.Socket.<init>(Socket.java:180)
>         at
> sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:22)
>         at
> sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:128)
>         at
> net.sf.ehcache.distribution.ConfigurableRMIClientSocketFactory.createSocket(ConfigurableRMIClientSocketFactory.java:72)
>         at
> sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:569)
>         ... 8 more
>
> Here are the configuration files (I've changed the
> names of the server for
> security reasons):
>
> server1.this.domain.example.com config:
>
> <ehcache
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>        
> xsi:noNamespaceSchemaLocation="ehcache.xsd">
>     <cacheManagerPeerProviderFactory class=
>                          
> "net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
>                          
> properties="peerDiscovery=manual,
> rmiUrls=//server2.that.domain.com:40000/cache1|//server2.that.domain.com:40000/cache2
> |//server2.that.domain.com:40000/cache3|//server2.that.domain.com:40000/cache4"
>                           propertySeparator=","
> />
>
>     <cacheManagerPeerListenerFactory
>            
> class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
>             properties="hostName=, port=40000,
> socketTimeoutMillis=2000"/>
>
>     <defaultCache
>             maxElementsInMemory="10000"
>             eternal="false"
>             timeToIdleSeconds="120"
>             timeToLiveSeconds="120"
>             overflowToDisk="true"
>             diskSpoolBufferSizeMB="30"
>             maxElementsOnDisk="10000000"
>             diskPersistent="false"
>             diskExpiryThreadIntervalSeconds="120"
>             memoryStoreEvictionPolicy="LRU"
>             />
>     <cache name="cache1"
>            maxElementsInMemory="10000"
>            maxElementsOnDisk="10000"
>            eternal="true"
>            overflowToDisk="true"
>            memoryStoreEvictionPolicy="LRU"
>            diskPersistent="true">
>         <cacheEventListenerFactory
> class="com.ml.art.util.cache.ConfigurationEventListenerFactory"/>
>         <cacheEventListenerFactory
>            
> class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
>             properties="replicateAsynchronously=true,
> replicatePuts=true,
> replicateUpdates=true,
>             replicateUpdatesViaCopy=true,
> replicateRemovals=true "/>
>     </cache>
> <!-- ... rest of caches ... -->
> </ehcache>
>
> File from server2.that.domain.example.com:
>
> <ehcache
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>        
> xsi:noNamespaceSchemaLocation="ehcache.xsd">
>     <cacheManagerPeerProviderFactory class=
>                          
> "net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
>                          
> properties="peerDiscovery=manual,
> rmiUrls=//server1.this.domain.com:40000/cache1|//server1.this.domain.com:40000/cache2
> |//server1.this.domain.com:40000/cache3|//server1.this.domain.com:40000/cache4"
>                           propertySeparator=","
> />
>
>     <cacheManagerPeerListenerFactory
>            
> class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
>             properties="hostName=, port=40000,
> socketTimeoutMillis=2000"/>
>
>     <defaultCache
>             maxElementsInMemory="10000"
>             eternal="false"
>             timeToIdleSeconds="120"
>             timeToLiveSeconds="120"
>             overflowToDisk="true"
>             diskSpoolBufferSizeMB="30"
>             maxElementsOnDisk="10000000"
>             diskPersistent="false"
>             diskExpiryThreadIntervalSeconds="120"
>             memoryStoreEvictionPolicy="LRU"
>             />
>     <cache name="cache1"
>            maxElementsInMemory="10000"
>            maxElementsOnDisk="10000"
>            eternal="true"
>            overflowToDisk="true"
>            memoryStoreEvictionPolicy="LRU"
>            diskPersistent="true">
>         <cacheEventListenerFactory
> class="com.ml.art.util.cache.ConfigurationEventListenerFactory"/>
>         <cacheEventListenerFactory
>            
> class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
>             properties="replicateAsynchronously=true,
> replicatePuts=true,
> replicateUpdates=true,
>             replicateUpdatesViaCopy=true,
> replicateRemovals=true "/>
>     </cache>
> <!-- ... rest of caches ... -->
> </ehcache>
>
>
>
>      
>
> ------------------------------------------------------------------------------
> Apps built with the Adobe(R) Flex(R) framework and Flex
> Builder(TM) are
> powering Web 2.0 with engaging, cross-platform
> capabilities. Quickly and
> easily build your RIAs with Flex Builder, the
> Eclipse(TM)based development
> software that enables intelligent coding and step-through
> debugging.
> Download the free 60 day trial.
> http://p.sf.net/sfu/www-adobe-com
> _______________________________________________
> ehcache-list mailing list
> ehcache-list@...
> https://lists.sourceforge.net/lists/listinfo/ehcache-list


     

------------------------------------------------------------------------------
_______________________________________________
ehcache-list mailing list
ehcache-list@...
https://lists.sourceforge.net/lists/listinfo/ehcache-list