对称DS无法使用Spring Boot注册到服务器。

huangapple go评论89阅读模式
英文:

SymmetricDS can not register to server with Spring boot

问题

抱歉,你的请求无法满足。这个问题涉及到具体的技术和错误信息,需要更多上下文和分析才能提供有用的解决方案。如果你需要关于这个问题的帮助,请提供更多信息以便我能够更好地理解并提供支持。

英文:

Hi I have Spring boot app with an embedded client and server. When the server is running and the client starts I see the following error.

    INFO  [client-001-job-3] o.j.s.s.impl.DataLoaderService - Using registration URL of http://localhost:8080/sync/server/registration?nodeGroupId=client&externalId=001&syncURL=http%3A%2F%2Flocalhost%3A8081%2Fsync%2Fclient-001&schemaVersion=%3F&databaseType=H2&databaseVersion=1.4&symmetricVersion=3.11.9&deploymentType=client&hostName=.....

ERROR [client-001-job-3] o.j.s.s.impl.RegistrationService - Unexpected error during registration: Received an unexpected response code of 404 from the server
org.jumpmind.exception.HttpException: Received an unexpected response code of 404 from the server

My server.properties:

external.id=server
engine.name=server
sync.url=http://localhost:8080/sync/server
group.id=server
registration.url=
auto.registration=true
initial.load.create.first=true
auto.config.database=true
auto_reload=true

My client properties:

external.id=001
engine.name=client-001
sync.url=http://localhost:8081/sync/client-001
group.id=client
registration.url=http://localhost:8080/sync/server
initial.load.create.first=true
auto.config.database=true
auto.registration=true
auto_reload=true

The sql what I run on the server:

-- Node Groups

insert into sym_node_group (node_group_id) values ('client');


-- server sends changes to client when client pulls from server
insert into sym_node_group_link (source_node_group_id, target_node_group_id, data_event_action) values ('server', 'client', 'W');

-- client sends changes to server when client pushes to server
insert into sym_node_group_link (source_node_group_id, target_node_group_id, data_event_action) values ('client', 'server', 'P');


-- Routers

insert into sym_router
(router_id,source_node_group_id,target_node_group_id,router_type,create_time,last_update_time)
values('server_2_client', 'server', 'client', 'default',current_timestamp, current_timestamp);

-- Default router sends all data from client to server
insert into sym_router
(router_id,source_node_group_id,target_node_group_id,router_type,create_time,last_update_time)
values('client_2_server', 'client', 'server', 'default',current_timestamp, current_timestamp);

Why can't the client register?
The server is running in http://localhost:8080
and the client has http://localhost:8080/sync/server for the registration.url

答案1

得分: 0

我还需要将端点注册到客户端。

@Bean
public ServletRegistrationBean<SymmetricServlet> symServlet() {
  ServletRegistrationBean<SymmetricServlet> bean = new ServletRegistrationBean<>(new SymmetricServlet(), "/sync/*");
  bean.setLoadOnStartup(1);
  return bean;
}
英文:

I needed to register the endpoint to the Client as well.

  @Bean
  public ServletRegistrationBean&lt;SymmetricServlet&gt; symServlet() {
    ServletRegistrationBean&lt;SymmetricServlet&gt; bean = new ServletRegistrationBean&lt;&gt;(new SymmetricServlet(), &quot;/sync/*&quot;);
    bean.setLoadOnStartup(1);
    return bean;
  }

huangapple
  • 本文由 发表于 2020年5月31日 03:18:42
  • 转载请务必保留本文链接:https://go.coder-hub.com/62107583.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定