前不久根据lima的博客学习用Terracott3.1.1 + Tomcat6共享session,配置好后用JSP页面测试,session确实共享了,用Apache +Tomcat6做了负载均分,用JSP页面测试页没有问题。
但是该用JSF后,一直遇到TCNonPortableObjectError,按照错误提示往tc-config.xml的<dso>中不断的加东西,打开页面的速度越来越慢,最后问题还是没有解决
com.tc.exception.TCNonPortableObjectError:
*******************************************************************************
Attempt to share an instance of a non-portable class referenced by a portable class. This
unshareable class is a JVM- or host machine-specific resource. Please ensure that instances
of this class don't enter the shared object graph.
Referring class : java.util.ArrayList
Thread : http-8088-1
JVM ID : VM(0)
Unshareable class: java.lang.ref.WeakReference
Action to take:
1) Change your application code
* Ensure that no instances of java.lang.ref.WeakReference
are added to any shared object graph
- OR -
2) Mark the offending field as transient (and thus not shared)
* edit your tc-config.xml file
* locate the <dso> element
* add this snippet inside the <dso> element, above the <locks> element
* if there is already a <transient-fields> element present, simply add
the new field inside it
我的tc-config.xml文件如下:
<?xml version="1.0" encoding="UTF-8"?>
<tc:tc-config xsi:schemaLocation="http://www.terracotta.org/schema/terracotta-5.xsd" xmlns:tc="http://www.terracotta.org/config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">