Failed to call Access Method when searching on my Fhir Server

789 views
Skip to first unread message

Thorm

unread,
Jan 16, 2018, 8:39:43 AM1/16/18
to HAPI FHIR

Hello there, 
I've set up a Fhir server an so far everything went relatively smooth. 
I can create Questionnaires, Responses and MessageHeaders, I can search for all resources of a type.
Capability Statement works aswell.

Now I wanted to implement searching by criteria and wrote my method as follows (Questionnaire in this example):

@Search
public List<Questionnaire> searchByName(@RequiredParam(name = Questionnaire.SP_TITLE) StringParam name) {
   
ArrayList<Questionnaire> retVal = new ArrayList<>();

   
for (int i = 0; i < db.size(); i++) {
       
if (db.get(i).getName().equals(name.toString()) || db.get(i).getTitle().equals(name.toString())) {
            retVal
.add(db.get(i));
       
}
   
}
   
return retVal;
}

Calling the search:

Bundle response = client.search()
       
.forResource(Questionnaire.class)
       
.where(Questionnaire.TITLE.matchesExactly().value("LifelinesQuestionnaire1part1"))
       
.returnBundle(Bundle.class)
       
.execute();

System.out.println(response.toString());


Produces the following error, be it for Questionnaires, Responses or MessageHeaders:

Exception in thread "main" ca.uhn.fhir.rest.server.exceptions.InternalErrorException: HTTP 500 Internal Server Error: Failed to call access method
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException.newInstance(BaseServerResponseException.java:301)
at ca.uhn.fhir.rest.client.impl.BaseClient.invokeClient(BaseClient.java:323)
at ca.uhn.fhir.rest.client.impl.GenericClient$BaseClientExecutable.invoke(GenericClient.java:448)
at ca.uhn.fhir.rest.client.impl.GenericClient$SearchInternal.execute(GenericClient.java:1776)
at com.phellowseven.sparrot.client.dev_testSearcher.main(dev_testSearcher.java:53)


Can anyone help me with this?

James Agnew

unread,
Jan 17, 2018, 2:13:02 AM1/17/18
to Thorm, HAPI FHIR
Hi Thorm,

This means that something went wrong on the server (a NullPointerException for example). You'll need to check the server log to find out exactly what that thing was.

Cheers,
James

--
You received this message because you are subscribed to the Google Groups "HAPI FHIR" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hapi-fhir+unsubscribe@googlegroups.com.
To post to this group, send email to hapi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hapi-fhir/bca682eb-23a3-4b00-be59-d806c5440b54%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Thorm

unread,
Jan 17, 2018, 4:06:44 AM1/17/18
to HAPI FHIR
hm is there a standard log that is produced? And if so, where could I find that?
Since it didnt output anything on console. 
In any case, are there any examples for provider classes out there which are viable for real use? The examples in the Fhir Hapi guide sadly give no real clue on how a provider could look in reality.  

Thanks in advance.
To unsubscribe from this group and stop receiving emails from it, send an email to hapi-fhir+...@googlegroups.com.

James Agnew

unread,
Jan 17, 2018, 4:32:15 AM1/17/18
to Thorm, HAPI FHIR
HAPI uses SLF4j logging (described here) so where the logs go depend on how you have configured things, which framework you are using and possibly which container you are deployed to.

As one example, if you are using one of HAPI's examples without changing anything at all and you're deploying to Tomcat the logs will end up in a file called "catalina.out".

Cheers,
James

To unsubscribe from this group and stop receiving emails from it, send an email to hapi-fhir+unsubscribe@googlegroups.com.

To post to this group, send email to hapi...@googlegroups.com.

kevins...@gmail.com

unread,
Jan 17, 2018, 4:52:49 AM1/17/18
to HAPI FHIR
Okay thanks, I'll look into that. 
I'm not using Tomcat, but thanks anyway =)

kevins...@gmail.com

unread,
Jan 17, 2018, 6:15:30 AM1/17/18
to HAPI FHIR
Maybe this will help narrow down the Issue.  
The Response Outcome I get is the following:

<OperationOutcome xmlns="http://hl7.org/fhir"><issue><severity value="error"></severity><code value="processing"></code><diagnostics value="Invalid request: The FHIR endpoint on this server does not know how to handle GET operation[Questionnaire] with parameters [[name]]"></diagnostics></issue></OperationOutcome>

But as you can see in the QuestionnaireProvider posted above, there is in fact a Search Method with the parameter mentioned here. And as far as I can see and when comparing to whats written in the Hapi Fhir Guide, seems to be fine.

Is there something I'm missing?
Thanks in advance

Thormgrim

unread,
Jan 17, 2018, 10:47:35 AM1/17/18
to HAPI FHIR
I was able to solve it. 
The Resource I tried to pull didnt have a name, but had a title. And I pulled both without checking first. 
Reply all
Reply to author
Forward
0 new messages