首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >陶土和shiro

陶土和shiro
EN

Stack Overflow用户
提问于 2013-08-22 18:43:22
回答 3查看 1.3K关注 0票数 0

我想使用terracotta + Shiro来实现SSO。当我尝试测试它时,我遇到了这样的错误:

代码语言:javascript
复制
    The configuration data in the base configuration from server at 'localhost:9510' does not obey the Terracotta schema:
    [0]: Line 4, column 5: Expected elements 'tc-properties servers clients' instead of 'system' here in element tc-config@http://www.terracotta.org/config
    [1]: Line 16, column 13: Expected elements 'offheap authentication http-authentication data-backup tsa-port jmx-port tsa-group-port security' instead of 'statistics' here in element server
    [2]: Line 19, column 13: Expected elements 'offheap authentication http-authentication data-backup tsa-port jmx-port tsa-group-port security' instead of 'dso-port' here in element server
    [3]: Line 21, column 13: Expected elements 'offheap authentication http-authentication data-backup tsa-port tsa-group-port security' instead of 'l2-group-port' here in element server
    [4]: Line 32, column 13: Expected elements 'offheap http-authentication data-backup tsa-port tsa-group-port security' instead of 'dso' here in element server
    [5]: Line 50, column 9: Expected elements 'server mirror-group update-check garbage-collection restartable client-reconnect-window' instead of 'mirror-groups' here in element servers
    [6]: Line 63, column 9: Expected elements 'server mirror-group update-check garbage-collection restartable client-reconnect-window' instead of 'ha' here in element servers
    [7]: Line 86, column 5: Element not allowed: application in element tc-config@http://www.terracotta.org/config

有人能帮我找出哪里出了问题吗?

下面是我的配置:

tc客户端上的ehcache.xml:

代码语言:javascript
复制
<ehcache  name="Plugin_Ehcache"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:noNamespaceSchemaLocation="ehcache.xsd"
     updateCheck="false" monitoring="autodetect"
     dynamicConfig="false">

<diskStore path="java.io.tmpdir/shiro-ehcache"/>

<defaultCache
        maxElementsInMemory="10000"
        eternal="false"
        timeToIdleSeconds="120"
        timeToLiveSeconds="120"
        overflowToDisk="false"
        diskPersistent="false"
        diskExpiryThreadIntervalSeconds="120">
    <terracotta/>
</defaultCache>
<cache name="shiro-activeSessionCache"
       maxElementsInMemory="10000"
       eternal="true"
       timeToLiveSeconds="0"
       timeToIdleSeconds="0"
       diskPersistent="false"
       overflowToDisk="false"
       diskExpiryThreadIntervalSeconds="600">
    <terracotta/>
</cache>    

<terracottaConfig url="localhost:9510"/>     
</ehcache> 

tc服务器上的tc-config.xml

代码语言:javascript
复制
<tc:tc-config xsi:schemaLocation="http://www.terracotta.org/schema/terracotta-8.xsd" 
          xmlns:tc="http://www.terracotta.org/config" 
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<tc-properties>
<property name="l2.l1reconnect.enabled" value="true"/>
<property name="l2.l1reconnect.timeout.millis" value="5000"/>
<property name="sigar.enabled" value="false"/>
<property name="search.use.commit.thread" value="false"/>
<property name="search.lucene.use.ram.directory" value="true"/>
<property name="search.query.wait.for.txns" value="false"/>
<property name="logging.maxLogFileSize" value="100"/>
<property name="logging.maxBackups" value="10"/>
</tc-properties>

<system>
 <configuration-model>development</configuration-model>
</system> 

  <servers>
    <server host="localhost" name="Terracotta Server1">
      <!-- Specify the path where the server should store its data. -->
            <data>C:\Program Files\Terracotta\terracotta-3.7.5\server\server-data</data>
            <logs>C:\Program Files\Terracotta\terracotta-3.7.5\server\server-logs</logs>
            <index>C:\Program Files\Terracotta\terracotta-3.7.5\server\server-index</index>
            <statistics>C:\Program Files\Terracotta\terracotta-3.7.5\server\server-statistics</statistics>

       <!-- Specify the port where the server should listen for client 
       traffic. -->
         <dso-port bind="127.0.0.1">9510</dso-port>
         <jmx-port  bind="127.0.0.1">9520</jmx-port>
          <l2-group-port bind="localhost">9530</l2-group-port>
          <!--jmx-port bind="xxx.xxx.xxx.xxx">9520</jmx-port>
       <tsa-port>9510</tsa-port>

       <tsa-group-port>9530</tsa-group-port-->
       <!-- Enable BigMemory on the server. -->
       <!--offheap>
         <enabled>true</enabled>
         <maxDataSize>4g</maxDataSize>
       </offheap-->

     <authentication/> 

       <dso>
    <client-reconnect-window>120</client-reconnect-window>
    <persistence>
      <mode>permanent-store</mode>
           <!--mode>temporary-swap-only</mode-->
            <!--<offheap>
        <enabled>false</enabled>
        <maxDataSize>450m</maxDataSize>
      </offheap>-->
    </persistence>
    <garbage-collection>
      <enabled>true</enabled>
      <verbose>false</verbose>
      <interval>300</interval>
    </garbage-collection>
  </dso>

     </server>

      <mirror-groups>
   <mirror-group group-name="group1">
     <members>
       <member>Terracotta Server1</member>
     </members>
     <ha>
       <mode>networked-active-passive</mode>
       <networked-active-passive>
         <election-time>5</election-time>
       </networked-active-passive>
     </ha>
    </mirror-group>
 </mirror-groups>     
 <ha>
   <mode>networked-active-passive</mode>
   <networked-active-passive>
     <election-time>5</election-time>
   </networked-active-passive>
 </ha>

      <update-check>
  <enabled>false</enabled>
</update-check>

    <!-- Add the restartable element for Fast Restartability (optional). -->
    <!--restartable enabled="true"/-->
  </servers>
  <clients>
    <logs>logs-%i</logs>
  </clients>
</tc:tc-config>
EN

回答 3

Stack Overflow用户

发布于 2013-10-01 12:53:27

您使用的是哪个版本的Terracotta库?tc-config.xml在4.x以后的版本中有一些更新的标记。请确保tc-config和ehcache xml符合架构。

干杯,Ridhav

票数 0
EN

Stack Overflow用户

发布于 2014-01-04 02:46:43

我看到你试图在你的tc配置中使用镜像组标签,但是看起来你把它放错了地方。

例如,此配置应起作用:

代码语言:javascript
复制
<?xml version="1.0" encoding="UTF-8" ?>
<tc:tc-config xsi:schemaLocation="http://www.terracotta.org/schema/terracotta-8.xsd"
              xmlns:tc="http://www.terracotta.org/config"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

  <tc-properties>
    <property name="l2.l1reconnect.enabled" value="true"/>
    <property name="l2.l1reconnect.timeout.millis" value="5000"/>
    <property name="sigar.enabled" value="false"/>
    <property name="search.use.commit.thread" value="false"/>
    <property name="search.lucene.use.ram.directory" value="true"/>
    <property name="search.query.wait.for.txns" value="false"/>
    <property name="logging.maxLogFileSize" value="100"/>
    <property name="logging.maxBackups" value="10"/>
  </tc-properties>

  <servers>
    <mirror-group group-name="group1">
      <server host="localhost" name="Terracotta Server1">
        <!-- Specify the path where the server should store its data. -->
        <data>C:\Program Files\Terracotta\terracotta-3.7.5\server\server-data</data>
        <logs>C:\Program Files\Terracotta\terracotta-3.7.5\server\server-logs</logs>
        <index>C:\Program Files\Terracotta\terracotta-3.7.5\server\server-index</index>
        <!--<statistics>C:\Program Files\Terracotta\terracotta-3.7.5\server\server-statistics</statistics>-->

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

        <authentication/>

      </server>
    </mirror-group>

    <update-check>
      <enabled>false</enabled>
    </update-check>

    <!-- Add the restartable element for Fast Restartability (optional). -->
    <!--restartable enabled="true"/-->
  </servers>
  <clients>
    <logs>logs-%i</logs>
  </clients>
</tc:tc-config>
票数 0
EN

Stack Overflow用户

发布于 2014-10-17 23:13:28

看一下这一行,它定义了用于构造xml配置文件的模式:

代码语言:javascript
复制
<tc:tc-config xsi:schemaLocation="http://www.terracotta.org/schema/terracotta-8.xsd

输入提供的地址,看看如何使用嵌套的xml元素和属性。

例如,在terracotta-6.xsd和terracotta-7.xsd中允许使用元素dso-port,但在您声明的terracotta-8.xsd中不允许。

顺便说一句,根据您使用的terracotta服务器的版本,由于元素不兼容,应该声明适当的xml模式。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/18378259

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档