Wildfly Swarm JGroups YAML

问题描述:

我已经下载了Wildfly swarm示例,现在我正尝试将Main类中的配置移到YAML文件中。Wildfly Swarm JGroups YAML

到目前为止,除了功能区示例外,一切正常。我从示例项目中获取配置并尝试将其转换为YAML文件。

项目来源:https://github.com/wildfly-swarm/wildfly-swarm-examples/blob/master/ribbon/events/src/main/java/org/wildfly/swarm/examples/netflix/ribbon/events/Main.java

我YAML文件(因为我认为它应该像)

--- 
swarm: 
    context: 
    path: proxy 
    http: 
    port: 8080 
    jgroups: 
    default-channel: swarm-jgroups 
    stacks: 
     udp: 
     protocols: 
      FD_SOCK: 
      socket-binding: jgroups-udp-fd 
      TCP: 
      properties: 
       bind_port: 
       value: 9090 
      TCPPING: 
      properties: 
       initial_hosts: 
       value: "localhost[9090],localhost[9091],localhost[9092],localhost[9093]" 
       num_initial_members: 
       value: 4 
       port_range: 
       value: 4 
       timeout: 
       value: 3000 
      FD_ALL: null 
      VERIFY_SUSPECT: null 
      pbcast.NAKACK2: null 
      UNICAST3: null 
      pbcast.STABLE: null 
      pbcast.GMS: null 
      UFC: null 
      MFC: null 
      FRAG2: null 
      RSVP: null 
     transports: 
      UDP: 
      socket-binding: jgroups-udp 

但我得到两个例外:在第一线在启动时:

Error getting subresources for Stack java.lang.RuntimeException: Failed to adopt value java.util.Map 
     at org.wildfly.swarm.config.runtime.invocation.EntityAdapter.fromEntity(EntityAdapter.java:347) 
     at org.wildfly.swarm.config.runtime.invocation.Marshaller.appendNode(Marshaller.java:33) 
     at org.wildfly.swarm.config.runtime.invocation.Marshaller.marshalSubresources(Marshaller.java:129) 
     at org.wildfly.swarm.config.runtime.invocation.Marshaller.appendNode(Marshaller.java:38) 
     at org.wildfly.swarm.config.runtime.invocation.Marshaller.marshalSubresources(Marshaller.java:129) 
     at org.wildfly.swarm.config.runtime.invocation.Marshaller.appendNode(Marshaller.java:38) 
     at org.wildfly.swarm.config.runtime.invocation.Marshaller.marshal(Marshaller.java:23) 
     at org.wildfly.swarm.container.runtime.marshal.SubsystemMarshaller.marshal(SubsystemMarshaller.java:59) 
     at org.wildfly.swarm.container.runtime.marshal.SubsystemMarshaller$Proxy$_$$_WeldClientProxy.marshal(Unknown Source) 
     at org.wildfly.swarm.container.runtime.marshal.DMRMarshaller.marshal(DMRMarshaller.java:70) 
     at org.wildfly.swarm.container.runtime.marshal.DMRMarshaller$Proxy$_$$_WeldClientProxy.marshal(Unknown Source) 
     at org.wildfly.swarm.container.runtime.RuntimeServer.start(RuntimeServer.java:182) 
     at org.wildfly.swarm.container.runtime.RuntimeServer$Proxy$_$$_WeldClientProxy.start(Unknown Source) 
     at org.wildfly.swarm.container.runtime.ServerBootstrapImpl.lambda$bootstrap$1(ServerBootstrapImpl.java:158) 
     at org.wildfly.swarm.spi.api.ClassLoading.withTCCL(ClassLoading.java:43) 
     at org.wildfly.swarm.container.runtime.ServerBootstrapImpl.bootstrap(ServerBootstrapImpl.java:113) 
     at org.wildfly.swarm.Swarm.start(Swarm.java:369) 
     at org.wildfly.swarm.Swarm.main(Swarm.java:623) 
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
     at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 
     at java.lang.reflect.Method.invoke(Unknown Source) 
     at org.wildfly.swarm.bootstrap.MainInvoker.invoke(MainInvoker.java:39) 
     at org.wildfly.swarm.bootstrap.Main.run(Main.java:46) 
     at org.wildfly.swarm.bootstrap.Main.main(Main.java:37) Caused by: java.lang.ClassCastException: java.util.HashMap cannot be cast to java.lang.String 
     at org.wildfly.swarm.config.runtime.invocation.MapTypeAdapter.toDmr(MapTypeAdapter.java:22) 
     at org.wildfly.swarm.config.runtime.invocation.EntityAdapter.fromEntity(EntityAdapter.java:341) 
     ... 24 more 

然后jgroup sepcific例外:

("subsystem" => "jgroups"), 
    ("stack" => "udp") 
]) - failure description: "WFLYCLJG0010: Transport for stack udp is not defined. Please specify both a transport and protocol list, either as optional parameters to add() or via batching." 

我不知道什么是错的。

也许你们可以给我一个提示?

+0

当我们进行完全相同的更改时,发现了一些问题。我没有及时了解该示例是否已被修正为使用YML。如果没有,应该很快 – Ken

+0

我刚才看到Main类被移到了project-defaults.yaml。我从git仓库复制它,但我仍然收到异常,说TCP,TCPPING和GMS的属性是未定义的。也许是因为我使用的是2017.6.1版本而不是2017.7.0-SNAPSHOT? –

+0

这是可能的,我们应该在未来几天发布2017.7.0 – Ken

我可以确认发布2017.7.0解决了问题,现在一切都正常启动。

谢谢您,Ken,感谢您的快速响应和支持。