Spring XD - 测试失败

时间:2014-10-29 18:37:25

标签: spring-xd

我从github上获取了XD源的最新副本并尝试构建本地。当我运行构建任务时,会出现以下错误。我在端口6379上运行Redis。不确定是否还有其他东西丢失。

我的/ etc / hosts似乎在Mac上看起来很好。我不得不做一个-x测试来跳过测试。任何可能的决议?我应该运行gemfire吗?

127.0.0.1 localhost 255.255.255.255 broadcasthost :: 1 localhost fe80 :: 1%lo0 localhost 127.0.0.1 imac

13:49:47.920 [DEBUG] [TestEventLogger] 
13:49:47.920 [DEBUG] [TestEventLogger] org.springframework.integration.x.gemfire.JsonStringToObjectTransformerTests > test FAILED
13:49:47.921 [DEBUG] [TestEventLogger]     java.lang.RuntimeException: java.net.UnknownHostException
13:49:47.921 [DEBUG] [TestEventLogger]         at com.gemstone.gemfire.distributed.internal.direct.DirectChannel.initAddress(DirectChannel.java:902)
13:49:47.921 [DEBUG] [TestEventLogger]         at com.gemstone.gemfire.distributed.internal.direct.DirectChannel.<init>(DirectChannel.java:126)
13:49:47.921 [DEBUG] [TestEventLogger]         at com.gemstone.gemfire.distributed.internal.membership.jgroup.JGroupMembershipManager.<init>(JGroupMembershipManager.java:1575)
13:49:47.921 [DEBUG] [TestEventLogger]         at com.gemstone.gemfire.distributed.internal.membership.jgroup.JGroupMemberFactory.newMembershipManager(JGroupMemberFactory.java:111)
13:49:47.921 [DEBUG] [TestEventLogger]         at com.gemstone.gemfire.distributed.internal.membership.MemberFactory.newMembershipManager(MemberFactory.java:95)
13:49:47.921 [DEBUG] [TestEventLogger]         at com.gemstone.gemfire.distributed.internal.DistributionManager.<init>(DistributionManager.java:1180)
13:49:47.921 [INFO] [system.out] 13:49:47.921 [DEBUG] [org.gradle.process.internal.child.ActionExecutionWorker] Stopping client connection.
13:49:47.921 [DEBUG] [TestEventLogger]         at com.gemstone.gemfire.distributed.internal.DistributionManager.<init>(DistributionManager.java:1238)
13:49:47.921 [DEBUG] [TestEventLogger]         at com.gemstone.gemfire.distributed.internal.DistributionManager.create(DistributionManager.java:613)
13:49:47.921 [DEBUG] [TestEventLogger]         at com.gemstone.gemfire.distributed.internal.InternalDistributedSystem.initialize(InternalDistributedSystem.java:515)
13:49:47.921 [DEBUG] [TestEventLogger]         at com.gemstone.gemfire.distributed.internal.InternalDistributedSystem.newInstance(InternalDistributedSystem.java:230)
13:49:47.922 [DEBUG] [TestEventLogger]         at com.gemstone.gemfire.distributed.DistributedSystem.connect(DistributedSystem.java:1105)
13:49:47.922 [DEBUG] [TestEventLogger]         at com.gemstone.gemfire.cache.CacheFactory.create(CacheFactory.java:227)
13:49:47.922 [DEBUG] [TestEventLogger]         at org.springframework.integration.x.gemfire.JsonStringToObjectTransformerTests.test(JsonStringToObjectTransformerTests.java:31)
13:49:47.922 [DEBUG] [TestEventLogger]         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
13:49:47.922 [DEBUG] [TestEventLogger]         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
13:49:47.922 [DEBUG] [TestEventLogger]         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
13:49:47.922 [DEBUG] [TestEventLogger]         at java.lang.reflect.Method.invoke(Method.java:606)
13:49:47.922 [DEBUG] [TestEventLogger]         at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
13:49:47.922 [DEBUG] [TestEventLogger]         at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
13:49:47.922 [DEBUG] [TestEventLogger]         at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
13:49:47.922 [DEBUG] [TestEventLogger]         at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
13:49:47.922 [DEBUG] [TestEventLogger]         at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
13:49:47.923 [DEBUG] [TestEventLogger]         at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
13:49:47.923 [DEBUG] [TestEventLogger]         at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
13:49:47.923 [DEBUG] [TestEventLogger]         at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
13:49:47.923 [DEBUG] [TestEventLogger]         at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
13:49:47.923 [DEBUG] [TestEventLogger]         at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
13:49:47.923 [DEBUG] [TestEventLogger]         at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
13:49:47.923 [DEBUG] [TestEventLogger]         at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
13:49:47.923 [DEBUG] [TestEventLogger]         at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
13:49:47.923 [DEBUG] [TestEventLogger]         at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.runTestClass(JUnitTestClassExecuter.java:86)
13:49:47.923 [DEBUG] [TestEventLogger]         at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.execute(JUnitTestClassExecuter.java:49)
13:49:47.924 [DEBUG] [TestEventLogger]         at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassProcessor.processTestClass(JUnitTestClassProcessor.java:69)
13:49:47.924 [DEBUG] [TestEventLogger]         at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:48)
13:49:47.924 [DEBUG] [TestEventLogger]         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
13:49:47.924 [DEBUG] [TestEventLogger]         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
13:49:47.924 [DEBUG] [TestEventLogger]         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
13:49:47.924 [DEBUG] [TestEventLogger]         at java.lang.reflect.Method.invoke(Method.java:606)
13:49:47.924 [DEBUG] [TestEventLogger]         at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
13:49:47.924 [DEBUG] [TestEventLogger]         at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
13:49:47.924 [DEBUG] [TestEventLogger]         at org.gradle.messaging.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:32)
13:49:47.924 [DEBUG] [TestEventLogger]         at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
13:49:47.925 [DEBUG] [TestEventLogger]         at com.sun.proxy.$Proxy2.processTestClass(Unknown Source)
13:49:47.925 [DEBUG] [TestEventLogger]         at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:105)
13:49:47.925 [DEBUG] [TestEventLogger]         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
13:49:47.925 [DEBUG] [TestEventLogger]         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
13:49:47.925 [DEBUG] [TestEventLogger]         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
13:49:47.925 [DEBUG] [TestEventLogger]         at java.lang.reflect.Method.invoke(Method.java:606)
13:49:47.925 [DEBUG] [TestEventLogger]         at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
13:49:47.925 [DEBUG] [TestEventLogger]         at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
13:49:47.925 [DEBUG] [TestEventLogger]         at org.gradle.messaging.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:355)
13:49:47.925 [DEBUG] [TestEventLogger]         at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:64)
13:49:47.925 [DEBUG] [TestEventLogger]         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
13:49:47.925 [DEBUG] [TestEventLogger]         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
13:49:47.926 [DEBUG] [TestEventLogger]         at java.lang.Thread.run(Thread.java:745)
13:49:47.926 [DEBUG] [TestEventLogger] 
13:49:47.926 [DEBUG] [TestEventLogger]         Caused by:
13:49:47.926 [DEBUG] [TestEventLogger]         java.net.UnknownHostException
13:49:47.926 [DEBUG] [TestEventLogger]             at com.gemstone.gemfire.internal.SocketCreator.getLocalHost(SocketCreator.java:312)
13:49:47.926 [DEBUG] [TestEventLogger]             at com.gemstone.gemfire.distributed.internal.direct.DirectChannel.initAddress(DirectChannel.java:898)
13:49:47.926 [DEBUG] [TestEventLogger]             ... 54 more
13:49:47.928 [DEBUG] [TestEventLogger] 
13:49:47.928 [DEBUG] [TestEventLogger] org.springframework.integration.x.gemfire.JsonStringToObjectTransformerTests FAILED
13:49:47.928 [DEBUG] [TestEventLogger] 
13:49:47.928 [DEBUG] [TestEventLogger] Gradle Test Executor 6 FAILED

2 个答案:

答案 0 :(得分:1)

奇怪的一个。我同意,你的/ etc / hosts看起来不错。我在Linux机器上看到过这种情况,有时使用127.0.1.1而不是127.0.0.1。测试只是启动缓存 new CacheFactory().create();如果您是GemFire用户,您可能需要检查主目录,当前目录或类路径中是否有任何gemfire.properties或cache.xml文件。 GemFire因发现这些而臭名昭着。

答案 1 :(得分:0)

同意,您的/ etc / hosts文件似乎没问题(但是,我会将其格式化,以便每个主机条目都在一行上)。

好像你可能正在运行GemFire 7?

此外,您在Mac上运行的Java供应商/版本(Apple或Oracle JDK / JRE和版本)?

您的Mac OS X版本可能是一个因素(???),特别是如果您已禁用网络(即没有“活动”NIC,连接有效IP,由ifconfig确定),尽管如此不太清楚。

简而言之,当环回地址仅指定IP时(如在/ etc / hosts文件中)或返回时,GemFire会尝试解析/查找本地系统的实际IP地址(使用GemFire的内部SocketCreator类)通过InetAddress.getLocalHost()。

这个解决过程非常复杂,不幸的是,在加载类时,它包含在SocketCreator类中的“静态初始化程序”块中。

InetAddress.getLocalHost()似乎不可能返回null,但在这种情况下,抛出GemFire中的UnknownHostException的原因是因为SocketCreator.localHost类成员变量为null ...

310:  public static InetAddress getLocalHost() throws UnknownHostException {
311:    if (localHost == null) {
312:      throw new UnknownHostException();
313:    }
314:    return localHost;
315:  }

“SocketCreator.localHost”静态成员变量在静态初始化程序块中初始化。

那么,是不是调用了静态初始化程序,还是没有调用InetAddress.getLocalHost()(可能是因为网络已被禁用?)返回null,虽然通过GemFire的代码查看会导致NullPointerException(我不确定是否可能已经获得)吞噬了某个地方),所以看起来更像是前者,但这两种答案似乎都不可能,真的。

一种可能的解决方法(因为它避免了启动GemFire成员资格时的IP解析步骤,如堆栈跟踪中所示)将修改第31行的Spring XD测试类JsonStringToObjectTransformerTests为... < / p>

31:    new CacheFactory().set("mcast-port", "0").set("log-level", "warning").create();

这避免了来自DirectChannel.initAddress(DirectChannel.java:898)的SocketCreator.getLocalHost()调用。

此外,将日志级别设置为警告会降低GemFire噪音并显着加快测试速度。

希望这有帮助。