-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Hibernate ehcache RMI distributed problem
PostPosted: Fri Apr 08, 2011 4:08 am 
Newbie

Joined: Fri Apr 08, 2011 4:04 am
Posts: 1
I have the problem with distributed ehcache and hibernate in the standalone applications. I have created two nodes which work on the different JVM for

testing destributed cache. I use RMI replication but it doesn't work.

The first application has following configuration:

Java class:

@Entity
@Table(name="SEX")
@Cache(region = "Cache1", usage= CacheConcurrencyStrategy.READ_WRITE)

public class Sex implements Serializable{

@Id
@Column(name="sex_id")
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int sexId;

@Column(name="sex_name")
private String sexName;

public int getSexId() {
return sexId;
}

public void setSexId(int sexId) {
this.sexId = sexId;
}

public String getSexName() {
return sexName;
}

public void setSexName(String sexName) {
this.sexName = sexName;
}

}

ehcache.xml:

<ehcache>

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

<defaultCache
maxElementsInMemory="0"
eternal="false"
timeToIdleSeconds="1200"
timeToLiveSeconds="1200">
</defaultCache>

<!-- For RMI replication (Setting the peer provider factory) -->
<cacheManagerPeerProviderFactory
class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
properties="peerDiscovery=manual, rmiUrls=//127.0.0.1:40002/Cache1"
propertySeparator=","/>

<!-- For RMI replication (Setting the peer listener factory) -->
<cacheManagerPeerListenerFactory
class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
properties="hostName=localhost, port=40001, socketTimeoutMillis=120000"
propertySeparator=","/>


<cache name="Cache1" maxElementsInMemory="1000"
eternal="true"
overflowToDisk="true"
diskSpoolBufferSizeMB="20"
timeToLiveSeconds="3000"
timeToIdleSeconds="3000"
memoryStoreEvictionPolicy="LFU">

<cacheEventListenerFactory class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
properties="replicateAsynchronously=true,
replicatePuts=true,
replicatePutsViaCopy=true,
replicateUpdates=true,
replicateUpdatesViaCopy=true,
replicateRemovals=true"/>

<!-- RMI Cache bootstrap -->
<bootstrapCacheLoaderFactory
class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory"
properties="bootstrapAsynchronously=true, maximumChunkSizeBytes=5000000"
propertySeparator=","/>
</cache>

</ehcache>


The second application has following configuration:

Java class:

@Entity
@Table(name="SEX")
@Cache(region = "Cache2", usage= CacheConcurrencyStrategy.READ_WRITE)

public class Sex implements Serializable {

@Id
@Column(name="sex_id")
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int sexId;

@Column(name="sex_name")
private String sexName;

public int getSexId() {
return sexId;
}

public void setSexId(int sexId) {
this.sexId = sexId;
}

public String getSexName() {
return sexName;
}

public void setSexName(String sexName) {
this.sexName = sexName;
}

}

ehcache.xml:

<ehcache>

<diskStore path="java.io.tmpdir"/>
<defaultCache
maxElementsInMemory="0"
eternal="false"
timeToIdleSeconds="1200"
timeToLiveSeconds="1200">
</defaultCache>

<!-- For RMI replication (Setting the peer provider factory) -->
<cacheManagerPeerProviderFactory
class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
properties="peerDiscovery=manual, rmiUrls=//127.0.0.1:40001/Cache2"
propertySeparator="," />

<!-- For RMI replication (Setting the peer listener factory) -->
<cacheManagerPeerListenerFactory
class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
properties="hostName=localhost, port=40002, socketTimeoutMillis=120000"
propertySeparator=","/>


<cache name="Cache2" maxElementsInMemory="1000"
eternal="true"
overflowToDisk="true"
diskSpoolBufferSizeMB="20"
timeToLiveSeconds="3000"
timeToIdleSeconds="3000"
memoryStoreEvictionPolicy="LFU">

<cacheEventListenerFactory class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
properties="replicateAsynchronously=true,
replicatePuts=true,
replicatePutsViaCopy=true,
replicateUpdates=true,
replicateUpdatesViaCopy=true,
replicateRemovals=true"/>

<bootstrapCacheLoaderFactory
class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory"
properties="bootstrapAsynchronously=true, maximumChunkSizeBytes=5000000"
propertySeparator=","/>

</cache>

</ehcache>

Could you please find the problem


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.