I'm trying to upload test data to the local JPA fhir server using hapi-fhir-cli. But while uploading the resources, I'm getting the following error.
2020-09-03 17:33:26.486 [main] INFO c.u.f.c.ExampleDataUploader 1 good references
2020-09-03 17:33:26.511 [main] INFO c.u.f.c.ExampleDataUploader Final bundle: 18 entries
2020-09-03 17:33:26.527 [main] INFO c.u.f.c.ExampleDataUploader About to upload 11 examples in a transaction, 2 remaining
2020-09-03 17:33:26.637 [main] INFO c.u.f.c.ExampleDataUploader Final bundle: 62 KB
2020-09-03 17:33:26.641 [main] INFO c.u.f.c.ExampleDataUploader Uploading bundle to server: http://127.0.0.1:8080/hapi-fhir-jpaserver/fhir
2020-09-03 17:33:26.960 [main] ERROR c.u.f.c.ExampleDataUploader Failed to upload bundle:HTTP 0: Failed to retrieve the server metadata statement during client initialization. URL used was http://127.0.0.1:8080/hapi-fhir-jpaserver/fhir/metadata
Even if I replace http://127.0.0.1:8080/hapi-fhir-jpaserver/fhir/metadata by public hapi fhir test server, i.e. http://hapi.fhir.org/baseR4, I'm getting the same error. I'm getting the above error after running the following hapi-fhir-cli command.
hapi-fhir-5.1.0-cli>hapi-fhir-cli upload-examples -t http://127.0.0.1:8080/hapi-fhir-jpaserver/fhir -v dstu2 -l 40
If I change the version to dstu3 or r4, I get the validation error, i.e. bundle type=transaction not found in valueset defined at hl7 website, even if it's defined.
Does anyone have any idea about both of these errors? Any help would be appreciated. Thanks.
Can you show where you are creating your client code (please).
But the two suggestions I have:
Are you setting the FhirContext to the right version? Do you need a bearer token?
//import ca.uhn.fhir.context.FhirContext;
Note, creating the context (the call to "forR4" is expensive, so you want to minimize the number of times you call that).
and my "args" holder class: