cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Getting 400 Bad Request when trying to send data to data hub

Former Member
0 Kudos
1,363

ERROR [TaskExecutor-master-2660-Task [8796161180598]] [DataHubRequestTaskRunner] 400 Bad Request org.springframework.web.client.HttpClientErrorException: 400 Bad Request at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:63) ~[spring-web-4.3.11.RELEASE.jar:4.3.11.RELEASE] at org.springframework.web.client.RestTemplate.handleResponse(RestTemplate.java:700) ~[spring-web-4.3.11.RELEASE.jar:4.3.11.RELEASE] at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:653) ~[spring-web-4.3.11.RELEASE.jar:4.3.11.RELEASE]

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Marcin,

Thanks for you reply. However I have done that change already and I am still getting a similar error:

INFO [TaskExecutor-master-4481-Task [8796165112758]] [DataHubRequestCreator] Sending request to datahub @ http://localhost:8080/datahub-webapp/v1/y2ysync/v60?Content-Type=application/json with sync execution id: 000002GC ERROR [TaskExecutor-master-4481-Task [8796165112758]] [DataHubRequestTaskRunner] 400 Bad Request org.springframework.web.client.HttpClientErrorException: 400 Bad Request at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:63) ~[spring-web-4.3.11.RELEASE.jar:4.3.11.RELEASE] at org.springframework.web.client.RestTemplate.handleResponse(RestTemplate.java:700) ~[spring-web-4.3.11.RELEASE.jar:4.3.11.RELEASE] at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:653) ~[spring-web-4.3.11.RELEASE.jar:4.3.11.RELEASE] at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:613) ~[spring-web-4.3.11.RELEASE.jar:4.3.11.RELEASE] at org.springframework.web.client.RestTemplate.postForEntity(RestTemplate.java:407) ~[spring-web-4.3.11.RELEASE.jar:4.3.11.RELEASE] at de.hybris.y2ysync.task.runner.internal.DataHubRequestCreator.sendRequest(DataHubRequestCreator.java:64) ~[y2ysyncserver.jar:?] at de.hybris.y2ysync.task.runner.DataHubRequestTaskRunner.sendRequestToDataHub(DataHubRequestTaskRunner.java:89) ~[y2ysyncserver.jar:?] at de.hybris.y2ysync.task.runner.DataHubRequestTaskRunner.run(DataHubRequestTaskRunner.java:51) [y2ysyncserver.jar:?] at de.hybris.platform.task.impl.DefaultTaskExecutionStrategy$1.execute(DefaultTaskExecutionStrategy.java:103) [processingserver.jar:?]

Also, I observed that data hub is now receiving my request as I can see in the logs:

2018-02-22 16:16:14,020 [DEBUG] [c.h.d.p.i.NamedPoolStrategy] Searching for pool by name y2ySyncDemoElectronicsToDataHub_pool for feed 18 - y2ySyncDemoElectronicsToDataHub_feed 2018-02-22 16:16:14,173 [DEBUG] [c.h.d.p.i.NamedPoolStrategy] Searching for pool by name y2ySyncDemoElectronicsToDataHub_pool for feed 18 - y2ySyncDemoElectronicsToDataHub_feed 2018-02-22 16:16:14,202 [DEBUG] [c.h.d.p.i.NamedPoolStrategy] Searching for pool by name y2ySyncDemoElectronicsToDataHub_pool for feed 18 - y2ySyncDemoElectronicsToDataHub_feed 2018-02-22 16:16:14,202 [DEBUG] [c.h.d.p.i.NamedPoolStrategy] Searching for pool by name y2ySyncDemoElectronicsToDataHub_pool for feed 18 - y2ySyncDemoElectronicsToDataHub_feed 2018-02-22 16:16:14,202 [DEBUG] [c.h.d.p.i.DefaultProcessMonitor] Registered DataLoad #39: 39 processes running 2018-02-22 16:16:14,202 [DEBUG] [c.h.d.p.i.DefaultProcessMonitor] Registered DataLoad #40: 40 processes running 2018-02-22 16:16:14,202 [DEBUG] [c.h.d.s.i.AsynchronousEventPublicationService] Firing data hub event : DataLoadingStartedEvent{actionId=39, feedId=18, poolId=33, itemCount=6} 2018-02-22 16:16:14,234 [ERROR] [d.h.d.y.r.r.Y2YSyncImportResource$ChunkProcessingTask] Error processing chunk: http://localhost:9001/y2ysync/medias/Category-81349985-f975-4f0d-9f90-bfa98e370d14?context=bWFzdGVyf... com.hybris.datahub.validation.ValidationException: [ValidationFailure{EXCEPTION, csvHeader: "RawType 'CategoryRaw' cannot be found in DataHub Configuration. Have you uploaded Y2YStreamConfigurationContainer configuration?"}] at de.hybris.datahub.y2ysync.service.impl.CsvDataLoadingValidator.validateCsv(CsvDataLoadingValidator.java:52) ~[y2ysync-datahub-ext-6.5.0.0-RC18.jar:na] at de.hybris.datahub.y2ysync.service.impl.CsvDataLoadingValidator$$FastClassBySpringCGLIB$$bed7b9dd.invoke() ~[y2ysync-datahub-ext-6.5.0.0-RC18.jar:na] at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) ~[spring-core-4.3.3.RELEASE.jar:4.3.3.RELEASE] at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:651) ~[spring-aop-4.3.3.RELEASE.jar:4.3.3.RELEASE] at de.hybris.datahub.y2ysync.service.impl.CsvDataLoadingValidator$$EnhancerBySpringCGLIB$$bd937a98.validateCsv() ~[y2ysync-datahub-ext-6.5.0.0-RC18.jar:na]

I am using this jar y2ysync-datahub-ext-6.5.0.0-RC18 in data hub web app lib and sending request using Hybris 6.6

cieslo
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

Can you double check your endpoint config: http://localhost:8080/datahub-webapp/v1/y2ysync/v60?Content-Type=application/json or http://localhost:8080/datahub-webapp/v1/y2ysync/v60 ? I don't have 6.6 environment but for 6.3 I can see in the logs:

[TaskExecutor-master-910-Task [8796125889462]] [DataHubRequestCreator] Sending request to datahub @ http://localhost:8080/datahub-webapp/v1/y2ysync/v60 with sync execution id: 000000RT

If you have commerce 6.6 you should have DataHub 6.6 and not 6.5. You can have lower version of Commerce and use Hybrid Adpater in DataHub but not the other way.

cieslo
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

DataHubRequestCreator comes from y2ysync extension. You are trying to send data to http://localhost:8080/datahub-webapp/v1/idoc/receiver endpoint which only accepts IDocs. y2ysync sends csv files to DataHub. You should change configuration to send the data to http://localhost:8080/datahub-webapp/v1/y2ysync/v60 (for version 6.0 and higher) or http://localhost:8080/datahub-webapp/v1/y2ysync (for version 5.7) which is the correct endpoint when using y2ysync. Either change the endpoint on Y2YSyncJob or in case if it is empty - change property y2ysync.datahub.url in local.properties.