无法使用ehcache连接到terracotta maven插件

时间:2013-08-01 12:03:47

标签: maven connect ehcache terracotta

我在pom中有以下内容的maven项目:

<build>
    <plugins>
        <plugin>
            <groupId>org.terracotta.maven.plugins</groupId>
            <artifactId>tc-maven-plugin</artifactId>
            <version>1.6.1</version>

            <dependencies>
                <dependency>
                    <groupId>org.terracotta</groupId>
                    <artifactId>terracotta-toolkit-1.3-runtime</artifactId>
                    <version>3.4.0</version>
                </dependency>
            </dependencies>
        </plugin>
        <plugin>
    </plugins>
</build>

当我尝试启动terracotta实例时似乎启动正常,我可以在开发人员控制台中看到群集。即使用:

mvn tc:start

然后我运行我的应用程序,它具有ehcache配置。设置了兵马俑URL(属性正在被正确替换):

<terracottaConfig url="${org.quartz.terracotta.tcConfigUrl}"/>

但是在控制台上我得到以下内容:

2013-08-01 12:47:40,781 INFO  net.sf.ehcache.terracotta.TerracottaClient        : Thread [main] [cacheManager: no name]: Creating new ClusteredInstanceFactory
2013-08-01 12:47:41,471 INFO - Terracotta 3.5.4, as of 20111212-111224 (Revision 19290 by cruise@rh5vmo100 from 3.5.4)
2013-08-01 12:47:42,043 INFO - Successfully loaded base configuration from server at 'localhost:9510'.
2013-08-01 12:47:42,135 INFO - Successfully loaded base configuration from file at '/var/folders/1k/kmzsymfj63b9jptfh4ywvplw6__lz7/T/tc-config3047796204629623347.xml'.
2013-08-01 12:47:42,164 INFO - Log file: '/Users/james.mchugh/terracotta/client-logs/terracotta-client.log'.
2013-08-01 12:47:42,184 WARN - Can't connect to server[10.194.194.133:9510:Tc-Group-0].Retrying... 

在日志中它只是坐在那里尝试重新连接并每次打印以下内容:

2013-08-01 12:47:44,189 [main] INFO com.terracottatech.dso - Trying to get Groupname ID Map from http://10.194.194.133:9510/groupidmap
2013-08-01 12:47:44,192 [main] WARN com.terracottatech.dso - Can't connect to [10.194.194.133:9510:Tc-Group-0].

有没有人知道为什么会这样,我可以ping / telnet到兵马俑服务器就好了,但我不知道为什么它不会连接。我也不太熟悉兵马俑,所以在回答时请记住这一点。

干杯。

1 个答案:

答案 0 :(得分:1)

“localhost”与您的LAN IP 10.194.194.133之间存在IP不一致问题(来自您的日志) 确保为客户端使用相同的IP(无论$ {org.quartz.terracotta.tcConfigUrl}解析为 - 您使用了什么?)和服务器(端口9510可能仅绑定到IP 10.194.194.133) 运行“netstat -na”并检查9510是否正在侦听该IP ...可能只在本地主机,或您的LAN IP上侦听,或者可能是另一个IP(如果您的开发/服务器盒上有2个NIC)

长篇小说:如果9510仅绑定到IP 10.194.194.133,请确保$ {org.quartz.terracotta.tcConfigUrl} = 10.194.194.133。

或者,您也可以构建自己的tc-config.xml,可以通过maven插件加载(检查http://forge.terracotta.org/releases/projects/tc-maven-plugin/configuration.html)...that方式,您可以精细设置兵马俑将在其上工作的网络接口。

希望有所帮助。