我在尝试访问让我疯狂的应用时遇到异常。我尝试了太多的变种,但没有一个有效。例外是:
[2014-06-27T09:57:07.058+0200] [glassfish 4.0] [INFO] [] [] [tid: _ThreadID=44 _ThreadName=Thread-3] [timeMillis: 1403855827058] [levelValue: 800] [[
ERROR 27/06/2014 09:57:07.055 [jk-connector(2)]
find failed: net.sf.ehcache.CacheException: Uncaught exception in setPinned() - Pinning is not supported when local cache is disabled]]
[2014-06-27T09:57:07.081+0200] [glassfish 4.0] [SEVERE] [] [] [tid: _ThreadID=44 _ThreadName=Thread-4] [timeMillis: 1403855827081] [levelValue: 1000] [[
org.hibernate.cache.CacheException: net.sf.ehcache.CacheException: Uncaught exception in setPinned() - Pinning is not supported when local cache is disabled
at net.sf.ehcache.hibernate.regions.EhcacheTransactionalDataRegion.put(EhcacheTransactionalDataRegion.java:151)
at net.sf.ehcache.hibernate.regions.EhcacheTransactionalDataRegion.put(EhcacheTransactionalDataRegion.java:126)
at net.sf.ehcache.hibernate.strategy.AbstractReadWriteEhcacheAccessStrategy.putFromLoad(AbstractReadWriteEhcacheAccessStrategy.java:93)
at net.sf.ehcache.hibernate.nonstop.NonstopAwareEntityRegionAccessStrategy.putFromLoad(NonstopAwareEntityRegionAccessStrategy.java:180)
at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:179)
at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:877)
at org.hibernate.loader.Loader.doQuery(Loader.java:752)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
at org.hibernate.loader.Loader.doList(Loader.java:2232)
at org.hibernate.loader.Loader.listUsingQueryCache(Loader.java:2161)
at org.hibernate.loader.Loader.list(Loader.java:2121)
at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:118)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1597)
at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:306)
at org.hibernate.impl.CriteriaImpl.uniqueResult(CriteriaImpl.java:328)
(...)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:193)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:189)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:54)
at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:562)
at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:873)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:739)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:575)
at org.apache.catalina.core.ApplicationDispatcher.doDispatch(ApplicationDispatcher.java:546)
at org.apache.catalina.core.ApplicationDispatcher.dispatch(ApplicationDispatcher.java:428)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:378)
at org.tuckey.web.filters.urlrewrite.NormalRewrittenUrl.doRewrite(NormalRewrittenUrl.java:213)
at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:171)
at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145)
at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92)
at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:381)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:316)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:357)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:260)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:188)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
at java.lang.Thread.run(Thread.java:744)
Caused by: net.sf.ehcache.CacheException: Uncaught exception in setPinned() - Pinning is not supported when local cache is disabled
at org.terracotta.modules.ehcache.store.ClusteredSafeStore.setPinned(ClusteredSafeStore.java:212)
at net.sf.ehcache.Cache.setPinned(Cache.java:4231)
at net.sf.ehcache.hibernate.regions.EhcacheTransactionalDataRegion.put(EhcacheTransactionalDataRegion.java:141)
... 70 more
该应用程序部署在主机“front”上的Glassfish 4服务器上,而Terracotta服务器则在主机上“返回”。
应用程序上的ehcache.xml文件是:
<?xml version="1.0" encoding="UTF-8"?>
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="ehcache-2.6.6.xsd"
updateCheck="false" monitoring="autodetect"
dynamicConfig="true" name="hibernate-cache">
<!-- Replicated caches between applications / ehcache servers -->
<cacheManagerPeerProviderFactory
class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
properties="peerDiscovery=manual,
rmiUrls=//127.0.0.1:40001/common_objects_region|//127.0.0.1:40001/org.hibernate.cache.UpdateTimestampsCache|//127.0.0.1:40001/org.hibernate.cache.StandardQueryCache"/>
<cacheManagerPeerListenerFactory
class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
properties="hostName=127.0.0.1, port=40001, socketTimeoutMillis=2000"/>
<terracottaConfig url="back:9510" />
<defaultCache
maxElementsInMemory="100"
maxElementsOnDisk="1000"
statistics="true"
eternal="false"
timeToIdleSeconds="43200"
timeToLiveSeconds="86400"
memoryStoreEvictionPolicy="LFU">
<cacheEventListenerFactory class="net.sf.ehcache.distribution.RMICacheReplicatorFactory" listenFor="all" />
<terracotta clustered="true" consistency="eventual" localCacheEnabled="true" />
<persistence strategy="distributed" />
</defaultCache>
<cache
name="org.hibernate.cache.StandardQueryCache"
statistics="true"
maxElementsInMemory="5000"
maxElementsOnDisk="10000"
eternal="false"
timeToIdleSeconds="43200"
timeToLiveSeconds="86400"
memoryStoreEvictionPolicy="LFU">
<cacheEventListenerFactory class="net.sf.ehcache.distribution.RMICacheReplicatorFactory" listenFor="all"/>
<terracotta clustered="true" consistency="eventual" localCacheEnabled="true" />
<persistence strategy="distributed" />
</cache>
<cache
name="org.hibernate.cache.UpdateTimestampsCache"
statistics="true"
maxElementsInMemory="5000"
maxElementsOnDisk="10000"
eternal="false"
timeToIdleSeconds="43200"
timeToLiveSeconds="86400"
memoryStoreEvictionPolicy="LFU">
<cacheEventListenerFactory class="net.sf.ehcache.distribution.RMICacheReplicatorFactory" listenFor="all"/>
<terracotta clustered="true" consistency="eventual" localCacheEnabled="true" />
<persistence strategy="distributed" />
</cache>
<cache name="common_objects_region"
statistics="true"
maxElementsInMemory="100000"
maxElementsOnDisk="250000"
eternal="false"
timeToIdleSeconds="43200"
timeToLiveSeconds="86400"
memoryStoreEvictionPolicy="LFU">
<cacheEventListenerFactory class="net.sf.ehcache.distribution.RMICacheReplicatorFactory" listenFor="all" />
<!-- <bootstrapCacheLoaderFactory class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory"
properties="bootstrapAsynchronously=true,
maximumChunkSizeBytes=5000000"/>-->
<terracotta clustered="true" consistency="eventual" localCacheEnabled="true" />
<persistence strategy="distributed" />
</cache>
</ehcache>
“back”上的tc-config.xml文件是:
<?xml version="1.0" encoding="UTF-8"?>
<!--
All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved.
-->
<tc:tc-config xmlns:tc="http://www.terracotta.org/config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.terracotta.org/schema/terracotta-6.xsd">
<!-- Configuracion de high-availability -->
<tc-properties>
<property name="l1.healthcheck.l2.ping.enabled" value="true" />
<property name="l1.healthcheck.l2.ping.idletime" value="10000" />
<property name="l1.healthcheck.l2.ping.interval" value="2000" />
<property name="l1.healthcheck.l2.ping.probes" value="5" />
<property name="l1.healthcheck.l2.socketConnect" value="true" />
<property name="l1.healthcheck.l2.socketConnectTimeout" value="20" />
<property name="l1.healthcheck.l2.socketConnectCount" value="10" />
<!-- Client reconnection properties -->
<property name="l2.l1reconnect.enabled" value="true" />
<property name="l2.l1reconnect.timeout.millis" value="2000" />
<property name="l2.healthcheck.l1.ping.enabled" value="true" />
<property name="l2.healthcheck.l1.ping.idletime" value="10000" />
<property name="l2.healthcheck.l1.ping.interval" value="2000" />
<property name="l2.healthcheck.l1.ping.probes" value="5" />
<property name="l2.healthcheck.l1.socketConnect" value="true" />
<property name="l2.healthcheck.l1.socketConnectTimeout" value="20" />
<property name="l2.healthcheck.l1.socketConnectCount" value="10" />
</tc-properties>
<!-- Tell DSO where the Terracotta server can be found;
See
- Terracotta Configuration Guide and Reference
- About Terracotta Configuration Files
for additional information. -->
<servers>
<server host="back" name="cache">
<dso-port>9510</dso-port>
<jmx-port>9520</jmx-port>
<data>/opt/terracotta/server-data</data>
<logs>/var/log/terracotta/server-logs</logs>
<statistics>/opt/terracotta/server-statistics</statistics>
<dso>
<client-reconnect-window>15</client-reconnect-window>
<persistence>
<mode>permanent-store</mode>
</persistence>
<garbage-collection>
<enabled>true</enabled>
<verbose>false</verbose>
<interval>7200</interval> <!-- está en segundos -->
</garbage-collection>
</dso>
<l2-group-port bind="0.0.0.0">9530</l2-group-port>
<data-backup>/opt/terracotta/data-backup</data-backup>
<index>/opt/terracotta/server-data/index</index>
</server>
</servers>
</tc:tc-config>
这些文件在localhost上完美运行,我在同一台机器上同时使用Glassfish和Terracotta Server。此外,这种配置在同一台机器上同时使用Glassfish和Terracotta Server的另一台主机上运行良好。 我试图通过主机的IP更改配置文件上的主机名,但异常仍然存在。
这么多问题: 这些配置文件有什么问题? 我是否需要在装有Glassfish的同一台机器上安装Terracotta服务器? 我是否缺少此配置的一些配置选项?
感谢。
编辑:我尝试使用我的开发人员Glassfish服务器和“后”Terracotta服务器,我得到了同样的例外。更新:如果我禁用二级缓存,应用程序工作正常并从Terracota Server检索信息,但我没有本地缓存,而且速度太慢。