0

how can I fix this "cannot find symbol" compilation error?

[ERROR] ../hapi-fhirstarters-simple-server/src/main/../SimpleRestfulServer.java:[30,43] cannot find symbol
[ERROR]   symbol:   class StaticCapabilityStatementInterceptor
[ERROR]   location: package ca.uhn.fhir.rest.server.interceptor

I have this interceptor package imported (among many others):


// added to try to customize the capability statement
import ca.uhn.fhir.rest.server.interceptor.StaticCapabilityStatementInterceptor;
import ca.uhn.fhir.rest.server.interceptor.*;

and here are the docs for that package: https://hapifhir.io/hapi-fhir//apidocs/hapi-fhir-server/ca/uhn/fhir/rest/server/interceptor/StaticCapabilityStatementInterceptor.html

What am I doing wrong here?

This is my full list of imports:

package ca.uhn.fhir.example;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;

import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.rest.server.RestfulServer;
import ca.uhn.fhir.rest.server.interceptor.ResponseHighlighterInterceptor;

import com.google.auth.oauth2.GoogleCredentials;
import com.google.cloud.firestore.Firestore;
import com.google.firebase.FirebaseApp;
import com.google.firebase.FirebaseOptions;
import com.google.firebase.cloud.FirestoreClient;
import com.google.cloud.firestore.QueryDocumentSnapshot;
import com.google.cloud.firestore.QuerySnapshot;
import com.google.cloud.firestore.WriteResult;
import com.google.common.collect.ImmutableMap;
import com.google.api.core.ApiFuture;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutionException;
import java.io.*;
import java.util.Arrays;

// added to try to customize the capability statement
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
import ca.uhn.fhir.rest.server.interceptor.StaticCapabilityStatementInterceptor;
import ca.uhn.fhir.rest.server.interceptor.*;
import ca.uhn.fhir.validation.ResultSeverityEnum;
//import org.hl7.fhir.common.hapi.validation.validator.FhirInstanceValidator;
import org.hl7.fhir.r4.model.CapabilityStatement;
import org.hl7.fhir.r4.model.Enumerations;
//import org.springframework.web.cors.CorsConfiguration;

1 Answers1

0

Per my comment above, I think seeing the maven configuration would be useful to evaluate the missing dependency.

That said, I took a look for maven libraries based on the class you provided and found it was located in this dependency. Insert your project version as appropriate:

<dependency>
    <groupId>ca.uhn.hapi.fhir</groupId>
    <artifactId>hapi-fhir-server</artifactId>
    <version>${project.version}</version>
</dependency>

Be sure you've added this in your Maven configuration. Maybe check to see that you have these too: https://hapifhir.io/hapi-fhir/docs/getting_started/downloading_and_importing.html

Atmas
  • 2,389
  • 5
  • 13