tomcat7配置eclipselink JPA 缓存同步

 

由于tomcat不支持jms,所以用rmi方式配置eclipselink JPA 缓存同步

 

1 persistence.xml:

    <properties> 

      <!-- cache options -->

      <property name="eclipselink.cache.size.default" value="5000"/> <!-- cache 5000 objects -->

      <!-- cache coordination -->

      <property name="eclipselink.cache.coordination.protocol" value="rmi" />

      <property name="eclipselink.cache.coordination.naming-service" value="rmi" />   <!-- 少了这一行会报空指针-->

      <property name="eclipselink.cache.coordination.rmi.url" value="rmi://$HOST:6052" /> <!-- the rmi 端口 -->

      <property name="eclipselink.cache.coordination.rmi.announcement-delay" value="1000" />

      <property name="eclipselink.cache.coordination.rmi.multicast-group" value="239.192.0.0" />

      <property name="eclipselink.cache.coordination.rmi.multicast-group.port" value="3121" />

      <property name="eclipselink.cache.coordination.packet-time-to-live" value="2" />

    </properties> 

2 先启动rmiregistry service : #rmiregistry 6052&

3 然后启动tomcat服务: #service tomcat stop && service tomcat start.

 

你可能感兴趣的:(jpa,elicpselink)