Note: This is a WAR based demo.
1. Create a weblogic.xml file in the WEB-INF directory of your web based project which references the C*web library
<?xml version = '1.0' encoding = 'windows-1252'?>
<weblogic-web-app
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.bea.com/ns/weblogic/weblogic-web-app http://www.bea.com/ns/weblogic/weblogic-web-app/1.0/weblogic-web-app.xsd"
xmlns="http://www.bea.com/ns/weblogic/weblogic-web-app">
<library-ref>
<library-name>coherence-web-spi</library-name>
<specification-version>1.0.0.0</specification-version>
<implementation-version>1.0.0.0</implementation-version>
<exact-match>false</exact-match>
</library-ref>
</weblogic-web-app>
2. Edit the web.xml of your web based project to switch to Monolithic model.
<context-param>
<param-name>coherence-sessioncollection-class</param-name>
<param-value>com.tangosol.coherence.servlet.MonolithicHttpSessionCollection</param-value>
</context-param>
3. Finally ensure you place coherence.jar into your WEB-INF/lib directory
The following show what your project would look like in JDeveloper 11.1.1.3
4. Once deployed we will see that we have swicthed to the new Session Model which is shown in the managed server log file at startup of the container or at the point when the application is started.
2010-05-13 07:11:37.680/37.754 Oracle Coherence 3.5.3/465
2010-05-13 07:11:37.687/37.761 Oracle Coherence 3.5.3/465
2010-05-13 07:11:37.689/37.763 Oracle Coherence 3.5.3/465
2010-05-13 07:11:37.695/37.769 Oracle Coherence 3.5.3/465
Oracle Coherence Version 3.5.3/465
Grid Edition: Development mode
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
2010-05-13 07:11:37.853/37.927 Oracle Coherence GE 3.5.3/465
2010-05-13 07:11:38.607/38.681 Oracle Coherence GE 3.5.3/465
2010-05-13 07:11:38.925/38.999 Oracle Coherence GE 3.5.3/465
2010-05-13 07:11:42.158/42.232 Oracle Coherence GE 3.5.3/465
2010-05-13 07:11:42.204/42.278 Oracle Coherence GE 3.5.3/465
2010-05-13 07:11:43.622/43.696 Oracle Coherence GE 3.5.3/465
2010-05-13 07:11:43.683/43.757 Oracle Coherence GE 3.5.3/465
2010-05-13 07:11:43.709/43.783 Oracle Coherence GE 3.5.3/465
Clustered Session Cache Name=session-storage
Local Session Cache Name=local-session-storage
Local Session Attribute Cache Name=local-attribute-storage
Death Certificate Cache Name=session-death-certificates
SessionDistributionController Class Name=
AttributeScopeController Class Name=com.tangosol.coherence.servlet.AbstractHttpSessionCollection$ApplicationScopeController
Maximum Session Inactive Seconds=3600
Session ID Character Length=52
Member Session Locking Enforced=true
Application Session Locking Enforced=true
Thread Session Locking Enforced=false
Assume Session Locality for Reaping=false
Strict "Servlet Specification" Exception Handling=true
Sticky Session Ownership=true
Sticky Session Ownership Service Name=SessionOwnership
2010-05-13 07:11:43.725/43.799 Oracle Coherence GE 3.5.3/465
SessionHelper!=null
MajorVersion=2
MinorVersion=5
Clustered=false
ServletContext (wrapped)=weblogic.servlet.internal.session.CoherenceWebServletContextWrapper@1f4d4bd
AttributeMap=null
Oracle Coherence 3.5.3/465) using object name "type=HttpSessionManager,nodeId=1,appId=cohwebmonolithicmodel!cohwebmonolithicmodel.war"
export JAVA_HOME=/home/oracle/product/11gR3/jdk160_18
export COHERENCE_HOME=/home/oracle/product/coherence/353/coherence
export COH_OPTS="-server -classpath $COHERENCE_HOME/lib/coherence.jar:$COHERENCE_HOME/lib/coherence-web-spi.war"
export COH_OPTS="$COH_OPTS -Dtangosol.coherence.cacheconfig=/WEB-INF/classes/session-cache-config.xml
-Dtangosol.coherence.distributed.localstorage=true -Dtangosol.coherence.management.remote=true
-Dtangosol.coherence.session.localstorage=true"
java $COH_OPTS -Xms512m -Xmx512m com.tangosol.net.DefaultCacheServer
No comments:
Post a Comment