BigMemory 4.0.5 Terrocatta Distributed + hibernate second level cache not able to configure

579 views Asked by At

I am using Bigmemory Max 4.0.5 As terracotta distributes cache for my application as hibernate second level caching but I am getting the below exception on server startup.

Caused by: com.tc.config.schema.setup.ConfigurationSetupException:


The configuration data in the base configuration from server at 'localhost:9510' does not obey the Terracotta schema: [0]: Line 7, column 5: Attribute not allowed (no wildcards allowed): secure in element servers [1]: Line 9, column 9: Expected element 'server' instead of 'mirror-group' here in element servers [2]: Line 28, column 9: Expected element 'server' instead of 'update-check' here in element servers [3]: Line 32, column 9: Expected element 'server' instead of 'garbage-collection' here in element servers [4]: Line 37, column 9: Expected element 'server' instead of 'restartable' here in element servers [5]: Line 38, column 9: Expected element 'server' instead of 'client-reconnect-window' here in element servers

My tc-config.xml is below :-

<?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>

Below is the 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>

And below are the dependencies I am using

 <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> 

I tried various combination of dependency version, but none helped. Please let me know what's going wrong with this.

Thanks in advance.

2

There are 2 answers

1
Anthony Dahanne On

Did you try to use the mirror-group tag ? A valid configuration would look like :

<?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
Sami Andoni On

hibernate-ehcache depends on ehcache-core with a version older than you are specifying. Try to disable this dependency as follows:

    <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>