Saturday, February 21, 2015

Configuration of eclipselink cache coordination in Apache Tomcat

Following steps are need for configuration of eclipselink cache coordination in Apache Tomcat


a.       Put activemq-all-5.9.0.jar and commons-logging-1.1.1.jar at %APACHE_TOMCAT_HOME%\lib
a.       Need to add following details in persistence.xml for cache coordination
<property name="eclipselink.cache.coordination.naming-service" value="jndi"/>
<property name="eclipselink.cache.coordination.jms.host" value="tcp://localhost:61616/" />
<property name="eclipselink.cache.coordination.protocol" value="jms" />
<property name="eclipselink.cache.coordination.jms.topic" value="java:comp/env/jms/OssCacheTopic" />
<property name="eclipselink.cache.coordination.jms.factory" value="java:comp/env/jms/OssCacheTopicConnectionFactory" />
a.       Need to add following as global naming resources at %APACHE_TOMCAT_HOME%\conf\server.xml
<GlobalNamingResources>
                                <!-- configuration for eclipselink cache coordination on JMS-->   
                <Resource name="jms/OssCacheTopicConnectionFactory" auth="Container"
                                                                type="org.apache.activemq.ActiveMQConnectionFactory"
                                                                description="JMS Connection Factory for cache coordination"
                                                                factory="org.apache.activemq.jndi.JNDIReferenceFactory"
                                                                brokerURL="tcp://localhost:61616/" />
                <Resource name="jms/OssCacheTopic" auth="Container"
                                                                type="org.apache.activemq.command.ActiveMQTopic"
                                                                description="Cache coordination Topic"
                                                                factory="org.apache.activemq.jndi.JNDIReferenceFactory"
                                                                physicalName="OssCacheTopic"/>
  </GlobalNamingResources>
a.       Need to add following details at %APACHE_TOMCAT_HOME%\conf\context.xml
<!-- configuration for eclipselink cache coordination on JMS-->
<ResourceLink global="jms/OssCacheTopicConnectionFactory" name="jms/OssCacheTopicConnectionFactory" type="org.apache.activemq.ActiveMQConnectionFactory"/>
<ResourceLink global="jms/OssCacheTopic" name="jms/OssCacheTopic" type="org.apache.activemq.command.ActiveMQTopic"/>
a.       In case of system exception like  Internal Exception: java.lang.ClassCastException: org.apache.activemq.ActiveMQConnectionFactory cannot be cast to javax.jms.TopicConnectionFactory Check for to javax.jms .* classes in any other jar file like geronimo-jms_1.1_spec-1.1 and should be removed from %APACHE_TOMCAT_HOME%\webapps\OssWar\WEB-INF\lib and added to %APACHE_TOMCAT_HOME%\lib



No comments:

Post a Comment