2013-12-23 34 views
0

我正在使用Bigmemory Max 4.0.5由於兵馬俑爲我的應用程序分配緩存作爲hibernate二級緩存,但我在服務器啓動時收到以下異常。BigMemory 4.0.5 Terrocatta分佈式+休眠二級緩存無法配置

所致:com.tc.config.schema.setup.ConfigurationSetupException:


在「本地主機:9510」在從服務器的基本配置的配置數據不服從陶土架構: [ 0]:第7行,第5列:屬性不允許(不允許使用通配符):元素服務器中的安全性 [1]:第9行,第9列:元素服務器中的期望元素'server'而不是'mirror-group' [2]:第28行,第9列:在元素服務器 [3]中的預期元素'server'而不是'update-check':第32行,第9列:預期元素'server'元素服務器 [4]:第37行,第9列:元素服務器中的預期元素「服務器」而不是「可重新啓動」 [5]:第38行,第9列:預期元素服務器'而不是 '在單元服務器客戶端重新連接窗口' 在這裏

TC-config.xml中低於: -

<?xml version="1.0" encoding="UTF-8" ?> 
<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-8.xsd"> 

    <servers> 
    <server host="localhost" name="MyServerName"> 
     <!-- Specify the path where the server should store its data. --> 
     <data>E:\Bratton\Pocs\bigmemory-max-4.0.5\data-test</data> 
     <!-- Specify the port where the server should listen for client 
     traffic. --> 
     <tsa-port>9510</tsa-port> 
     <jmx-port>9520</jmx-port> 
     <tsa-group-port>9530</tsa-group-port> 
     <!-- Enable BigMemory on the server. --> 
     <offheap> 
     <enabled>true</enabled> 
     <maxDataSize>512m</maxDataSize> 
     </offheap> 
    </server> 
    <!-- Add the restartable element for Fast Restartability (optional). --> 
    <restartable enabled="true"/> 
    </servers> 
    <clients> 
    <logs>logs-%i</logs> 
    </clients> 
</tc:tc-config> 

下面是ehcache.xml中: -

<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:noNamespaceSchemaLocation="http://ehcache.org/ehcache.xsd" updateCheck="false"> 
    <terracottaConfig url="localhost:9510"/> 
    <defaultCache 
      eternal="false" 
      timeToIdleSeconds="120" 
      timeToLiveSeconds="120"> 
     <terracotta/>  

    </defaultCache>   

</ehcache> 

及以下的依賴我使用

<dependency> 
       <groupId>net.sf.ehcache</groupId> 
       <artifactId>ehcache-core</artifactId> 
       <version>2.6.0</version> 
      </dependency> 

      <dependency> 
       <groupId>org.hibernate</groupId> 
       <artifactId>hibernate-ehcache</artifactId> 
       <version>4.2.4.Final</version> 
      </dependency> 

      <dependency> 
       <groupId>net.sf.ehcache</groupId> 
       <artifactId>ehcache-terracotta</artifactId> 
       <version>2.6.0</version> 
      </dependency> 

      <dependency> 
       <groupId>org.terracotta</groupId> 
       <artifactId>terracotta-toolkit-runtime-ee</artifactId> 
       <version>4.0.5</version> 
      </dependency> 

我試過的依賴版本不同的組合,但沒有幫助。請讓我知道這有什麼問題。

在此先感謝。

回答

0

您是否嘗試使用鏡像組標籤? 有效的配置看起來像:

<?xml version="1.0" encoding="UTF-8" ?> 
<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-8.xsd"> 

    <servers> 
    <mirror-group group-name="tsa01"> 
     <server host="localhost" name="MyServerName"> 
     <!-- Specify the path where the server should store its data. --> 
     <data>E:\Bratton\Pocs\bigmemory-max-4.0.5\data-test</data> 
     <!-- Specify the port where the server should listen for client 
       traffic. --> 
     <tsa-port>9510</tsa-port> 
     <jmx-port>9520</jmx-port> 
     <tsa-group-port>9530</tsa-group-port> 
     <!-- Enable BigMemory on the server. --> 
     <offheap> 
      <enabled>true</enabled> 
      <maxDataSize>512m</maxDataSize> 
     </offheap> 
     </server> 
    </mirror-group> 
    <!-- Add the restartable element for Fast Restartability (optional). --> 
    <restartable enabled="true"/> 
    </servers> 
    <clients> 
    <logs>logs-%i</logs> 
    </clients> 
</tc:tc-config> 
+0

嗨安東尼,我試過鏡像組標籤。但沒有成功。 –

+0

反正謝謝你的回覆 –

+0

奇怪,它沒有爲你工作:你仍然有一個ConfigurationSetupException?如果是這樣,你的配置還有其他錯誤;您可以使用IDE根據模式驗證xml以找到您的錯誤。您還可以閱讀發行說明,名爲「Simplified Configuration File」一章http://www.terracotta.org/confluence/display/release/BigMemory+Max+4.0.0+Release+Notes –

0

hibernate-ehcache取決於ehcache-core與年紀比你指定一個版本。嘗試禁用這種依賴關係如下:

<dependency> 
     <groupId>org.hibernate</groupId>    
     <artifactId>hibernate-ehcache</artifactId> 
     <version>4.2.4.Final</version> 
     <exclusions> 
      <exclusion> 
       <artifactId>ehcache-core</artifactId> 
       <groupId>net.sf.ehcache</groupId> 
      </exclusion> 
     </exclusions> 
    </dependency>