hapifhir / hapi-fhir-jpaserver-starter

Apache License 2.0
383 stars 1.03k forks source link

(Auth)Interceptor #666

Closed michael-gvdw closed 3 months ago

michael-gvdw commented 6 months ago

Hello, I started using the fhir server a couple of days ago. At the moment I succesfully deployed the project with a postgres db using docker and the helm chart. I now face some uncertainty on how I can develope an Interceptor for the fhir server. Unfortunatelly the documentation on the official hapi fhir page is kinda unclear. Is anybody able to give a more comprehensive walkthrough of how it would be possible to develop an (auth)interceptor?

aakashkag commented 6 months ago

@michael-gvdw Here is details steps 1) Create file inside (HAPI_FHIR_SERVER/src/main/java/ca/uhn/fhir/jpa/starter): BasicSecurityInterceptor.java I am attaching BasicSecurityInterceptor.java file. dont forget to change ext to java BasicSecurityInterceptor.txt

2) In application.yml update interceptor put this in 186 line number and you are good to go. custom-interceptor-classes: ca.uhn.fhir.jpa.starter.BasicSecurityInterceptor,

For any request, it will check if jwt token is valid or not. You can pass jwt secret using environment variable or hard code. Make sure jwt secret have 128 char length at least.

michael-gvdw commented 5 months ago

@aakashkag Hey, I have been trying to apply the help you provided by (trying to) implementing the example interceptor code provided in the project docs in src/main/java/ca/uhn/fhir/jpa/starter/MyInterceptor.java. Unfortunately when in register the interceptor in file src/main/resources/application.yaml in line 180 custom-interceptor-classes: ca.uhn.fhir.jpa.starter.MyInterceptor, I try to run the project using docker compose up --build but it seems it is unable to find my new class. Here I provide the complete stack trace:

hapi-fhir-jpaserver-start | hapi-fhir-jpaserver-start | . ____ _ __ _ _ hapi-fhir-jpaserver-start | /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ hapi-fhir-jpaserver-start | ( ( )\___ | '_ | '_| | '_ \/ _ | \ \ \ \ hapi-fhir-jpaserver-start | \/ _)| |)| | | | | || (| | ) ) ) ) hapi-fhir-jpaserver-start | ' |__| ._|| ||| |_, | / / / / hapi-fhir-jpaserver-start | =========|_|==============|__/=//// hapi-fhir-jpaserver-start | :: Spring Boot :: (v3.2.0) hapi-fhir-jpaserver-start | hapi-fhir-jpaserver-start | 2024-04-06 11:32:31.080 [background-preinit] INFO o.h.validator.internal.util.Version [Version.java:21] HV000001: Hibernate Validator 8.0.0.Final hapi-fhir-jpaserver-start | 2024-04-06 11:32:31.240 [main] INFO ca.uhn.fhir.jpa.starter.Application [StartupInfoLogger.java:50] Starting Application using Java 17.0.10 with PID 1 (/app/main.war started by nonroot in /app) hapi-fhir-jpaserver-start | 2024-04-06 11:32:31.241 [main] INFO ca.uhn.fhir.jpa.starter.Application [SpringApplication.java:653] No active profile set, falling back to 1 default profile: "default" hapi-fhir-jpaserver-start | 2024-04-06 11:32:32.855 [main] INFO o.s.d.r.c.RepositoryConfigurationDelegate [RepositoryConfigurationDelegate.java:139] Bootstrapping Spring Data JPA repositories in DEFAULT mode. hapi-fhir-jpaserver-start | 2024-04-06 11:32:33.153 [main] INFO o.s.d.r.c.RepositoryConfigurationDelegate [RepositoryConfigurationDelegate.java:208] Finished Spring Data repository scanning in 286 ms. Found 53 JPA repository interfaces. hapi-fhir-jpaserver-start | 2024-04-06 11:32:35.701 [main] WARN o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker [PostProcessorRegistrationDelegate.java:429] Bean 'ca.uhn.fhir.jpa.config.BeanPostProcessorConfig' of type [ca.uhn.fhir.jpa.config.BeanPostProcessorConfig$$SpringCGLIB$$0] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). The currently created BeanPostProcessor [persistenceExceptionTranslationPostProcessor] is declared through a non-static factory method on that class; consider declaring it as static instead. hapi-fhir-jpaserver-start | 2024-04-06 11:32:36.154 [main] INFO o.s.b.w.e.tomcat.TomcatWebServer [TomcatWebServer.java:108] Tomcat initialized with port 8080 (http) hapi-fhir-jpaserver-start | 2024-04-06 11:32:36.163 [main] INFO o.a.coyote.http11.Http11NioProtocol [DirectJDKLog.java:173] Initializing ProtocolHandler ["http-nio-8080"] hapi-fhir-jpaserver-start | 2024-04-06 11:32:36.166 [main] INFO o.a.catalina.core.StandardService [DirectJDKLog.java:173] Starting service [Tomcat] hapi-fhir-jpaserver-start | 2024-04-06 11:32:36.166 [main] INFO o.a.catalina.core.StandardEngine [DirectJDKLog.java:173] Starting Servlet engine: [Apache Tomcat/10.1.16] hapi-fhir-jpaserver-start | 2024-04-06 11:32:36.276 [main] INFO o.a.c.c.C.[Tomcat].[localhost].[/] [DirectJDKLog.java:173] Initializing Spring embedded WebApplicationContext hapi-fhir-jpaserver-start | 2024-04-06 11:32:36.276 [main] INFO o.s.b.w.s.c.ServletWebServerApplicationContext [ServletWebServerApplicationContext.java:296] Root WebApplicationContext: initialization completed in 4966 ms hapi-fhir-jpaserver-start | 2024-04-06 11:32:36.361 [main] INFO ca.uhn.fhir.util.VersionUtil [VersionUtil.java:84] HAPI FHIR version 7.0.2 - Rev 95beaec894 hapi-fhir-jpaserver-start | 2024-04-06 11:32:36.367 [main] INFO ca.uhn.fhir.context.FhirContext [FhirContext.java:226] Creating new FHIR context for FHIR version [R4] hapi-fhir-jpaserver-start | 2024-04-06 11:32:36.394 [main] INFO c.u.f.j.s.c.FhirServerConfigCommon [FhirServerConfigCommon.java:39] Server configured to allow contains searches hapi-fhir-jpaserver-start | 2024-04-06 11:32:36.394 [main] INFO c.u.f.j.s.c.FhirServerConfigCommon [FhirServerConfigCommon.java:41] Server configured to deny multiple deletes hapi-fhir-jpaserver-start | 2024-04-06 11:32:36.395 [main] INFO c.u.f.j.s.c.FhirServerConfigCommon [FhirServerConfigCommon.java:43] Server configured to deny external references hapi-fhir-jpaserver-start | 2024-04-06 11:32:36.395 [main] INFO c.u.f.j.s.c.FhirServerConfigCommon [FhirServerConfigCommon.java:45] Server configured to enable DAO scheduling hapi-fhir-jpaserver-start | 2024-04-06 11:32:36.395 [main] INFO c.u.f.j.s.c.FhirServerConfigCommon [FhirServerConfigCommon.java:47] Server configured to disable delete expunges hapi-fhir-jpaserver-start | 2024-04-06 11:32:36.395 [main] INFO c.u.f.j.s.c.FhirServerConfigCommon [FhirServerConfigCommon.java:49] Server configured to enable expunges hapi-fhir-jpaserver-start | 2024-04-06 11:32:36.395 [main] INFO c.u.f.j.s.c.FhirServerConfigCommon [FhirServerConfigCommon.java:51] Server configured to allow overriding default search params hapi-fhir-jpaserver-start | 2024-04-06 11:32:36.396 [main] INFO c.u.f.j.s.c.FhirServerConfigCommon [FhirServerConfigCommon.java:54] Server configured to disable auto-creating placeholder references hapi-fhir-jpaserver-start | 2024-04-06 11:32:36.396 [main] INFO c.u.f.j.s.c.FhirServerConfigCommon [FhirServerConfigCommon.java:57] Server configured to auto-version references at paths [] hapi-fhir-jpaserver-start | 2024-04-06 11:32:36.436 [main] INFO c.u.f.j.s.c.FhirServerConfigCommon [FhirServerConfigCommon.java:122] Server configured to have a maximum fetch size of 'unlimited' hapi-fhir-jpaserver-start | 2024-04-06 11:32:36.436 [main] INFO c.u.f.j.s.c.FhirServerConfigCommon [FhirServerConfigCommon.java:127] Server configured to cache search results for 60000 milliseconds hapi-fhir-jpaserver-start | 2024-04-06 11:32:36.437 [main] INFO c.u.f.j.s.c.FhirServerConfigCommon [FhirServerConfigCommon.java:178] Server configured to use 'ALPHANUMERIC' Client ID Strategy hapi-fhir-jpaserver-start | 2024-04-06 11:32:36.567 [main] INFO o.h.jpa.internal.util.LogHelper [LogHelper.java:31] HHH000204: Processing PersistenceUnitInfo [name: HAPI_PU] hapi-fhir-jpaserver-start | 2024-04-06 11:32:36.706 [main] INFO org.hibernate.Version [Version.java:44] HHH000412: Hibernate ORM core version 6.4.1.Final ^[[1;2A^[[1;2Ahapi-fhir-jpaserver-start | 2024-04-06 11:32:42.528 [main] INFO o.h.c.i.RegionFactoryInitiator [RegionFactoryInitiator.java:50] HHH000026: Second-level cache disabled hapi-fhir-jpaserver-start | 2024-04-06 11:32:42.705 [main] INFO o.h.e.b.internal.EnversServiceImpl [EnversServiceImpl.java:76] Envers integration enabled? : true hapi-fhir-jpaserver-start | 2024-04-06 11:32:42.967 [main] INFO o.s.o.j.p.SpringPersistenceUnitInfo [SpringPersistenceUnitInfo.java:87] No LoadTimeWeaver setup: ignoring JPA class transformer hapi-fhir-jpaserver-start | 2024-04-06 11:32:43.019 [main] INFO com.zaxxer.hikari.HikariDataSource [HikariDataSource.java:110] HikariPool-1 - Starting... hapi-fhir-jpaserver-start | 2024-04-06 11:32:43.373 [main] INFO com.zaxxer.hikari.pool.HikariPool [HikariPool.java:565] HikariPool-1 - Added connection conn0: url=jdbc:h2:mem:test_mem user=SA hapi-fhir-jpaserver-start | 2024-04-06 11:32:43.375 [main] INFO com.zaxxer.hikari.HikariDataSource [HikariDataSource.java:123] HikariPool-1 - Start completed. hapi-fhir-jpaserver-start | 2024-04-06 11:32:44.245 [main] INFO o.h.s.m.o.b.i.HibernateSearchPreIntegrationService [HibernateSearchPreIntegrationService.java:101] HSEARCH000034: Hibernate Search version 7.0.0.Final hapi-fhir-jpaserver-start | 2024-04-06 11:32:44.417 [main] INFO o.h.e.c.i.m.AuditMetadataGenerator [AuditMetadataGenerator.java:322] Adding properties for entity: ca.uhn.fhir.jpa.entity.MdmLink hapi-fhir-jpaserver-start | 2024-04-06 11:32:46.276 [main] INFO o.h.e.t.j.p.i.JtaPlatformInitiator [JtaPlatformInitiator.java:58] HHH000489: No JTA platform available (set 'hibernate.transaction.jta.platform' to enable JTA platform integration) hapi-fhir-jpaserver-start | 2024-04-06 11:32:47.677 [main] INFO c.u.f.j.c.HapiFhirLocalContainerEntityManagerFactoryBean [AbstractEntityManagerFactoryBean.java:437] Initialized JPA EntityManagerFactory for persistence unit 'HAPIPU' hapi-fhir-jpaserver-start | 2024-04-06 11:32:48.390 [main] INFO c.u.f.c.s.DefaultProfileValidationSupport [DefaultProfileValidationSupportBundleStrategy.java:368] Loading structure definitions from classpath: /org/hl7/fhir/r4/model/profile/profiles-resources.xml hapi-fhir-jpaserver-start | Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally. hapi-fhir-jpaserver-start | NOT STARTED. hapi-fhir-jpaserver-start | Currently in standby mode. hapi-fhir-jpaserver-start | Number of jobs executed: 0 hapi-fhir-jpaserver-start | Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 4 threads. hapi-fhir-jpaserver-start | Using job-store 'org.quartz.simpl.RAMJobStore' - which does not support persistence. and is not clustered. hapi-fhir-jpaserver-start | hapi-fhir-jpaserver-start | 2024-04-06 11:32:52.391 [main] INFO org.quartz.impl.StdSchedulerFactory [StdSchedulerFactory.java:1374] Quartz scheduler 'hapi-fhir-jpa-scheduler' initialized from an externally provided properties instance. hapi-fhir-jpaserver-start | 2024-04-06 11:32:52.391 [main] INFO org.quartz.impl.StdSchedulerFactory [StdSchedulerFactory.java:1378] Quartz scheduler version: 2.3.2 hapi-fhir-jpaserver-start | 2024-04-06 11:32:52.391 [main] INFO org.quartz.core.QuartzScheduler [QuartzScheduler.java:2293] JobFactory set to: ca.uhn.fhir.jpa.sched.AutowiringSpringBeanJobFactory@4bf6ce64 hapi-fhir-jpaserver-start | 2024-04-06 11:32:52.392 [main] INFO org.quartz.core.QuartzScheduler [QuartzScheduler.java:585] Scheduler hapi-fhir-jpa-scheduler$_NONCLUSTERED paused. hapi-fhir-jpaserver-start | 2024-04-06 11:32:52.812 [main] INFO ca.uhn.fhir.context.FhirContext [FhirContext.java:226] Creating new FHIR context for FHIR version [R4] hapi-fhir-jpaserver-start | 2024-04-06 11:32:53.040 [main] INFO c.u.f.j.s.common.StarterJpaConfig [StarterJpaConfig.java:222] CORS is enabled on this server hapi-fhir-jpaserver-start | 2024-04-06 11:32:53.042 [main] INFO c.u.f.j.s.common.StarterJpaConfig [StarterJpaConfig.java:235] CORS allows the following origins: * hapi-fhir-jpaserver-start | 2024-04-06 11:32:58.304 [main] INFO ca.uhn.fhir.context.FhirContext [FhirContext.java:226] Creating new FHIR context for FHIR version [R4] hapi-fhir-jpaserver-start | 2024-04-06 11:32:58.424 [main] ERROR o.s.b.w.e.tomcat.TomcatStarter [TomcatStarter.java:60] Error starting Tomcat context. Exception: org.springframework.beans.factory.UnsatisfiedDependencyException. Message: Error creating bean with name 'hapiServletRegistration' defined in ca.uhn.fhir.jpa.starter.Application: Unsatisfied dependency expressed through method 'hapiServletRegistration' parameter 0: Error creating bean with name 'restfulServer' defined in class path resource [ca/uhn/fhir/jpa/starter/common/StarterJpaConfig.class]: Failed to instantiate [ca.uhn.fhir.rest.server.RestfulServer]: Factory method 'restfulServer' threw exception with message: Interceptor class was not found on classpath: hapi-fhir-jpaserver-start | 2024-04-06 11:32:58.467 [main] INFO o.a.catalina.core.StandardService [DirectJDKLog.java:173] Stopping service [Tomcat] hapi-fhir-jpaserver-start | 2024-04-06 11:32:58.471 [main] WARN o.a.c.loader.WebappClassLoaderBase [DirectJDKLog.java:173] The web application [ROOT] appears to have started a thread named [HikariPool-1 housekeeper] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread: hapi-fhir-jpaserver-start | java.base@17.0.10/jdk.internal.misc.Unsafe.park(Native Method) hapi-fhir-jpaserver-start | java.base@17.0.10/java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:252) hapi-fhir-jpaserver-start | java.base@17.0.10/java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:1672) hapi-fhir-jpaserver-start | java.base@17.0.10/java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1182) hapi-fhir-jpaserver-start | java.base@17.0.10/java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:899) hapi-fhir-jpaserver-start | java.base@17.0.10/java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1062) hapi-fhir-jpaserver-start | java.base@17.0.10/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1122) hapi-fhir-jpaserver-start | java.base@17.0.10/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) hapi-fhir-jpaserver-start | java.base@17.0.10/java.lang.Thread.run(Thread.java:840) hapi-fhir-jpaserver-start | 2024-04-06 11:32:58.479 [main] WARN o.a.c.loader.WebappClassLoaderBase [DirectJDKLog.java:173] The web application [ROOT] appears to have started a thread named [Hibernate Search - Engine - Timing thread - 0] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread: hapi-fhir-jpaserver-start | java.base@17.0.10/jdk.internal.misc.Unsafe.park(Native Method) hapi-fhir-jpaserver-start | java.base@17.0.10/java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:252) hapi-fhir-jpaserver-start | java.base@17.0.10/java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:1672) hapi-fhir-jpaserver-start | java.base@17.0.10/java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1182) hapi-fhir-jpaserver-start | java.base@17.0.10/java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:899) hapi-fhir-jpaserver-start | java.base@17.0.10/java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1062) hapi-fhir-jpaserver-start | java.base@17.0.10/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1122) hapi-fhir-jpaserver-start | java.base@17.0.10/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) hapi-fhir-jpaserver-start | Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally. hapi-fhir-jpaserver-start | NOT STARTED. hapi-fhir-jpaserver-start | Currently in standby mode. hapi-fhir-jpaserver-start | Number of jobs executed: 0 hapi-fhir-jpaserver-start | Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 4 threads. hapi-fhir-jpaserver-start | Using job-store 'org.quartz.simpl.RAMJobStore' - which does not support persistence. and is not clustered. hapi-fhir-jpaserver-start | hapi-fhir-jpaserver-start | 2024-04-06 11:32:52.391 [main] INFO org.quartz.impl.StdSchedulerFactory [StdSchedulerFactory.java:1374] Quartz scheduler 'hapi-fhir-jpa-scheduler' initialized from an externally provided properties instance. hapi-fhir-jpaserver-start | 2024-04-06 11:32:52.391 [main] INFO org.quartz.impl.StdSchedulerFactory [StdSchedulerFactory.java:1378] Quartz scheduler version: 2.3.2 hapi-fhir-jpaserver-start | 2024-04-06 11:32:52.391 [main] INFO org.quartz.core.QuartzScheduler [QuartzScheduler.java:2293] JobFactory set to: ca.uhn.fhir.jpa.sched.AutowiringSpringBeanJobFactory@4bf6ce64 hapi-fhir-jpaserver-start | 2024-04-06 11:32:52.392 [main] INFO org.quartz.core.QuartzScheduler [QuartzScheduler.java:585] Scheduler hapi-fhir-jpa-scheduler$_NON_CLUSTERED paused. hapi-fhir-jpaserver-start | 2024-04-06 11:32:52.812 [main] INFO ca.uhn.fhir.context.FhirContext [FhirContext.java:226] Creating new FHIR context for FHIR version [R4] hapi-fhir-jpaserver-start | 2024-04-06 11:32:53.040 [main] INFO c.u.f.j.s.common.StarterJpaConfig [StarterJpaConfig.java:222] CORS is enabled on this server hapi-fhir-jpaserver-start | 2024-04-06 11:32:53.042 [main] INFO c.u.f.j.s.common.StarterJpaConfig [StarterJpaConfig.java:235] CORS allows the following origins: * hapi-fhir-jpaserver-start | 2024-04-06 11:32:58.304 [main] INFO ca.uhn.fhir.context.FhirContext [FhirContext.java:226] Creating new FHIR context for FHIR version [R4] hapi-fhir-jpaserver-start | 2024-04-06 11:32:58.424 [main] ERROR o.s.b.w.e.tomcat.TomcatStarter [TomcatStarter.java:60] Error starting Tomcat context. Exception: org.springframework.beans.factory.UnsatisfiedDependencyException. Message: Error creating bean with name 'hapiServletRegistration' defined in ca.uhn.fhir.jpa.starter.Application: Unsatisfied dependency expressed through method 'hapiServletRegistration' parameter 0: Error creating bean with name 'restfulServer' defined in class path resource [ca/uhn/fhir/jpa/starter/common/StarterJpaConfig.class]: Failed to instantiate [ca.uhn.fhir.rest.server.RestfulServer]: Factory method 'restfulServer' threw exception with message: Interceptor class was not found on classpath: hapi-fhir-jpaserver-start | 2024-04-06 11:32:58.467 [main] INFO o.a.catalina.core.StandardService [DirectJDKLog.java:173] Stopping service [Tomcat] hapi-fhir-jpaserver-start | 2024-04-06 11:32:58.471 [main] WARN o.a.c.loader.WebappClassLoaderBase [DirectJDKLog.java:173] The web application [ROOT] appears to have started a thread named [HikariPool-1 housekeeper] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread: hapi-fhir-jpaserver-start | java.base@17.0.10/jdk.internal.misc.Unsafe.park(Native Method) hapi-fhir-jpaserver-start | java.base@17.0.10/java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:252) hapi-fhir-jpaserver-start | java.base@17.0.10/java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:1672) hapi-fhir-jpaserver-start | java.base@17.0.10/java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1182) hapi-fhir-jpaserver-start | java.base@17.0.10/java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:899) hapi-fhir-jpaserver-start | java.base@17.0.10/java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1062) hapi-fhir-jpaserver-start | java.base@17.0.10/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1122) hapi-fhir-jpaserver-start | java.base@17.0.10/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) hapi-fhir-jpaserver-start | java.base@17.0.10/java.lang.Thread.run(Thread.java:840) hapi-fhir-jpaserver-start | 2024-04-06 11:32:58.479 [main] WARN o.a.c.loader.WebappClassLoaderBase [DirectJDKLog.java:173] The web application [ROOT] appears to have started a thread named [Hibernate Search - Engine - Timing thread - 0] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread: hapi-fhir-jpaserver-start | java.base@17.0.10/jdk.internal.misc.Unsafe.park(Native Method) hapi-fhir-jpaserver-start | java.base@17.0.10/java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:252) hapi-fhir-jpaserver-start | java.base@17.0.10/java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:1672) hapi-fhir-jpaserver-start | java.base@17.0.10/java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1182) hapi-fhir-jpaserver-start | java.base@17.0.10/java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:899) hapi-fhir-jpaserver-start | java.base@17.0.10/java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1062) hapi-fhir-jpaserver-start | java.base@17.0.10/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1122) hapi-fhir-jpaserver-start | java.base@17.0.10/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) hapi-fhir-jpaserver-start | 2024-04-06 11:32:58.505 [main] WARN o.a.c.loader.WebappClassLoaderBase [DirectJDKLog.java:173] The web application [ROOT] appears to have started a thread named [hapi-fhir-jpa-scheduler-local-3] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread: hapi-fhir-jpaserver-start | java.base@17.0.10/java.lang.Object.wait(Native Method) hapi-fhir-jpaserver-start | org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:568) hapi-fhir-jpaserver-start | 2024-04-06 11:32:58.505 [main] WARN o.a.c.loader.WebappClassLoaderBase [DirectJDKLog.java:173] The web application [ROOT] appears to have started a thread named [hapi-fhir-jpa-scheduler-local-4] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread: hapi-fhir-jpaserver-start | java.base@17.0.10/java.lang.Object.wait(Native Method) hapi-fhir-jpaserver-start | org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:568) hapi-fhir-jpaserver-start | 2024-04-06 11:32:58.505 [main] WARN o.a.c.loader.WebappClassLoaderBase [DirectJDKLog.java:173] The web application [ROOT] appears to have started a thread named [hapi-fhir-jpa-scheduler-clustered-1] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread: hapi-fhir-jpaserver-start | java.base@17.0.10/java.lang.Object.wait(Native Method) hapi-fhir-jpaserver-start | org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:568) hapi-fhir-jpaserver-start | 2024-04-06 11:32:58.505 [main] WARN o.a.c.loader.WebappClassLoaderBase [DirectJDKLog.java:173] The web application [ROOT] appears to have started a thread named [hapi-fhir-jpa-scheduler-clustered-2] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread: hapi-fhir-jpaserver-start | java.base@17.0.10/java.lang.Object.wait(Native Method) hapi-fhir-jpaserver-start | org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:568) hapi-fhir-jpaserver-start | 2024-04-06 11:32:58.506 [main] WARN o.a.c.loader.WebappClassLoaderBase [DirectJDKLog.java:173] The web application [ROOT] appears to have started a thread named [hapi-fhir-jpa-scheduler-clustered-3] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread: hapi-fhir-jpaserver-start | java.base@17.0.10/java.lang.Object.wait(Native Method) hapi-fhir-jpaserver-start | org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:568) hapi-fhir-jpaserver-start | 2024-04-06 11:32:58.506 [main] WARN o.a.c.loader.WebappClassLoaderBase [DirectJDKLog.java:173] The web application [ROOT] appears to have started a thread named [hapi-fhir-jpa-scheduler-clustered-4] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread: hapi-fhir-jpaserver-start | java.base@17.0.10/java.lang.Object.wait(Native Method) hapi-fhir-jpaserver-start | org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:568) hapi-fhir-jpaserver-start | 2024-04-06 11:32:58.506 [main] WARN o.a.c.loader.WebappClassLoaderBase [DirectJDKLog.java:173] The web application [ROOT] appears to have started a thread named [hapi-fhir-jpa-scheduler_QuartzSchedulerThread] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread: hapi-fhir-jpaserver-start | java.base@17.0.10/java.lang.Object.wait(Native Method) hapi-fhir-jpaserver-start | org.quartz.core.QuartzSchedulerThread.run(QuartzSchedulerThread.java:254) hapi-fhir-jpaserver-start | 2024-04-06 11:32:58.506 [main] WARN o.a.c.loader.WebappClassLoaderBase [DirectJDKLog.java:173] The web application [ROOT] appears to have started a thread named [hapi-fhir-jpa-schedulerQuartzSchedulerThread] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread: hapi-fhir-jpaserver-start | java.base@17.0.10/java.lang.Object.wait(Native Method) hapi-fhir-jpaserver-start | org.quartz.core.QuartzSchedulerThread.run(QuartzSchedulerThread.java:254) hapi-fhir-jpaserver-start | 2024-04-06 11:32:58.508 [main] WARN o.s.b.w.s.c.AnnotationConfigServletWebServerApplicationContext [AbstractApplicationContext.java:632] Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server hapi-fhir-jpaserver-start | 2024-04-06 11:32:58.533 [main] INFO c.u.f.j.s.BaseSchedulerServiceImpl [BaseSchedulerServiceImpl.java:182] Shutting down task scheduler... hapi-fhir-jpaserver-start | 2024-04-06 11:32:58.534 [main] INFO org.quartz.core.QuartzScheduler [QuartzScheduler.java:666] Scheduler hapi-fhir-jpa-scheduler$_NONCLUSTERED shutting down. hapi-fhir-jpaserver-start | 2024-04-06 11:32:58.534 [main] INFO org.quartz.core.QuartzScheduler [QuartzScheduler.java:585] Scheduler hapi-fhir-jpa-scheduler$_NONCLUSTERED paused. hapi-fhir-jpaserver-start | 2024-04-06 11:32:58.874 [main] INFO org.quartz.core.QuartzScheduler [QuartzScheduler.java:740] Scheduler hapi-fhir-jpa-scheduler$_NONCLUSTERED shutdown complete. hapi-fhir-jpaserver-start | 2024-04-06 11:32:58.874 [main] INFO org.quartz.core.QuartzScheduler [QuartzScheduler.java:666] Scheduler hapi-fhir-jpa-scheduler$_NONCLUSTERED shutting down. hapi-fhir-jpaserver-start | 2024-04-06 11:32:58.874 [main] INFO org.quartz.core.QuartzScheduler [QuartzScheduler.java:585] Scheduler hapi-fhir-jpa-scheduler$_NONCLUSTERED paused. hapi-fhir-jpaserver-start | 2024-04-06 11:32:58.893 [main] INFO org.quartz.core.QuartzScheduler [QuartzScheduler.java:740] Scheduler hapi-fhir-jpa-scheduler$_NON_CLUSTERED shutdown complete. hapi-fhir-jpaserver-start | 2024-04-06 11:32:58.904 [main] INFO c.u.f.j.c.HapiFhirLocalContainerEntityManagerFactoryBean [AbstractEntityManagerFactoryBean.java:650] Closing JPA EntityManagerFactory for persistence unit 'HAPI_PU hapi-fhir-jpaserver-start | 2024-04-06 11:32:58.505 [main] WARN o.a.c.loader.WebappClassLoaderBase [DirectJDKLog.java:173] The web application [ROOT] appears to have started a thread named [hapi-fhir-jpa-scheduler-local-3] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread: hapi-fhir-jpaserver-start | java.base@17.0.10/java.lang.Object.wait(Native Method) hapi-fhir-jpaserver-start | org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:568) hapi-fhir-jpaserver-start | 2024-04-06 11:32:58.505 [main] WARN o.a.c.loader.WebappClassLoaderBase [DirectJDKLog.java:173] The web application [ROOT] appears to have started a thread named [hapi-fhir-jpa-scheduler-local-4] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread: hapi-fhir-jpaserver-start | java.base@17.0.10/java.lang.Object.wait(Native Method) hapi-fhir-jpaserver-start | org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:568) hapi-fhir-jpaserver-start | 2024-04-06 11:32:58.505 [main] WARN o.a.c.loader.WebappClassLoaderBase [DirectJDKLog.java:173] The web application [ROOT] appears to have started a thread named [hapi-fhir-jpa-scheduler-clustered-1] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread: hapi-fhir-jpaserver-start | java.base@17.0.10/java.lang.Object.wait(Native Method) hapi-fhir-jpaserver-start | org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:568) hapi-fhir-jpaserver-start | 2024-04-06 11:32:58.505 [main] WARN o.a.c.loader.WebappClassLoaderBase [DirectJDKLog.java:173] The web application [ROOT] appears to have started a thread named [hapi-fhir-jpa-scheduler-clustered-2] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread: hapi-fhir-jpaserver-start | java.base@17.0.10/java.lang.Object.wait(Native Method) hapi-fhir-jpaserver-start | org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:568) hapi-fhir-jpaserver-start | 2024-04-06 11:32:58.506 [main] WARN o.a.c.loader.WebappClassLoaderBase [DirectJDKLog.java:173] The web application [ROOT] appears to have started a thread named [hapi-fhir-jpa-scheduler-clustered-3] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread: hapi-fhir-jpaserver-start | java.base@17.0.10/java.lang.Object.wait(Native Method) hapi-fhir-jpaserver-start | org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:568) hapi-fhir-jpaserver-start | 2024-04-06 11:32:58.506 [main] WARN o.a.c.loader.WebappClassLoaderBase [DirectJDKLog.java:173] The web application [ROOT] appears to have started a thread named [hapi-fhir-jpa-scheduler-clustered-4] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread: hapi-fhir-jpaserver-start | java.base@17.0.10/java.lang.Object.wait(Native Method) hapi-fhir-jpaserver-start | org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:568) hapi-fhir-jpaserver-start | 2024-04-06 11:32:58.506 [main] WARN o.a.c.loader.WebappClassLoaderBase [DirectJDKLog.java:173] The web application [ROOT] appears to have started a thread named [hapi-fhir-jpa-scheduler_QuartzSchedulerThread] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread: hapi-fhir-jpaserver-start | java.base@17.0.10/java.lang.Object.wait(Native Method) hapi-fhir-jpaserver-start | org.quartz.core.QuartzSchedulerThread.run(QuartzSchedulerThread.java:254) hapi-fhir-jpaserver-start | 2024-04-06 11:32:58.506 [main] WARN o.a.c.loader.WebappClassLoaderBase [DirectJDKLog.java:173] The web application [ROOT] appears to have started a thread named [hapi-fhir-jpa-schedulerQuartzSchedulerThread] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread: hapi-fhir-jpaserver-start | java.base@17.0.10/java.lang.Object.wait(Native Method) hapi-fhir-jpaserver-start | org.quartz.core.QuartzSchedulerThread.run(QuartzSchedulerThread.java:254) hapi-fhir-jpaserver-start | 2024-04-06 11:32:58.508 [main] WARN o.s.b.w.s.c.AnnotationConfigServletWebServerApplicationContext [AbstractApplicationContext.java:632] Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server hapi-fhir-jpaserver-start | 2024-04-06 11:32:58.533 [main] INFO c.u.f.j.s.BaseSchedulerServiceImpl [BaseSchedulerServiceImpl.java:182] Shutting down task scheduler... hapi-fhir-jpaserver-start | 2024-04-06 11:32:58.534 [main] INFO org.quartz.core.QuartzScheduler [QuartzScheduler.java:666] Scheduler hapi-fhir-jpa-scheduler$_NONCLUSTERED shutting down. hapi-fhir-jpaserver-start | 2024-04-06 11:32:58.534 [main] INFO org.quartz.core.QuartzScheduler [QuartzScheduler.java:585] Scheduler hapi-fhir-jpa-scheduler$_NONCLUSTERED paused. hapi-fhir-jpaserver-start | 2024-04-06 11:32:58.874 [main] INFO org.quartz.core.QuartzScheduler [QuartzScheduler.java:740] Scheduler hapi-fhir-jpa-scheduler$_NONCLUSTERED shutdown complete. hapi-fhir-jpaserver-start | 2024-04-06 11:32:58.874 [main] INFO org.quartz.core.QuartzScheduler [QuartzScheduler.java:666] Scheduler hapi-fhir-jpa-scheduler$_NONCLUSTERED shutting down. hapi-fhir-jpaserver-start | 2024-04-06 11:32:58.874 [main] INFO org.quartz.core.QuartzScheduler [QuartzScheduler.java:585] Scheduler hapi-fhir-jpa-scheduler$_NONCLUSTERED paused. hapi-fhir-jpaserver-start | 2024-04-06 11:32:58.893 [main] INFO org.quartz.core.QuartzScheduler [QuartzScheduler.java:740] Scheduler hapi-fhir-jpa-scheduler$_NON_CLUSTERED shutdown complete. hapi-fhir-jpaserver-start | 2024-04-06 11:32:58.904 [main] INFO c.u.f.j.c.HapiFhirLocalContainerEntityManagerFactoryBean [AbstractEntityManagerFactoryBean.java:650] Closing JPA EntityManagerFactory for persistence unit 'HAPI_PU' hapi-fhir-jpaserver-start | 2024-04-06 11:32:58.916 [main] INFO com.zaxxer.hikari.HikariDataSource [HikariDataSource.java:350] HikariPool-1 - Shutdown initiated... hapi-fhir-jpaserver-start | 2024-04-06 11:32:58.918 [main] INFO com.zaxxer.hikari.HikariDataSource [HikariDataSource.java:352] HikariPool-1 - Shutdown completed. hapi-fhir-jpaserver-start | 2024-04-06 11:32:58.937 [main] INFO o.s.b.a.l.ConditionEvaluationReportLogger [ConditionEvaluationReportLogger.java:82] hapi-fhir-jpaserver-start | hapi-fhir-jpaserver-start | Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled. hapi-fhir-jpaserver-start | 2024-04-06 11:32:58.966 [main] ERROR o.s.boot.SpringApplication [SpringApplication.java:839] Application run failed hapi-fhir-jpaserver-start | org.springframework.context.ApplicationContextException: Unable to start web server hapi-fhir-jpaserver-start | at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:165) hapi-fhir-jpaserver-start | at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:618) hapi-fhir-jpaserver-start | at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) hapi-fhir-jpaserver-start | at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:753) hapi-fhir-jpaserver-start | at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:455) hapi-fhir-jpaserver-start | at org.springframework.boot.SpringApplication.run(SpringApplication.java:323) hapi-fhir-jpaserver-start | at org.springframework.boot.SpringApplication.run(SpringApplication.java:1342) hapi-fhir-jpaserver-start | at org.springframework.boot.SpringApplication.run(SpringApplication.java:1331) hapi-fhir-jpaserver-start | at ca.uhn.fhir.jpa.starter.Application.main(Application.java:46) hapi-fhir-jpaserver-start | at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) hapi-fhir-jpaserver-start | at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) hapi-fhir-jpaserver-start | at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) hapi-fhir-jpaserver-start | at java.base/java.lang.reflect.Method.invoke(Method.java:568) hapi-fhir-jpaserver-start | at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49) hapi-fhir-jpaserver-start | at org.springframework.boot.loader.Launcher.launch(Launcher.java:95) hapi-fhir-jpaserver-start | at org.springframework.boot.loader.Launcher.launch(Launcher.java:58) hapi-fhir-jpaserver-start | at org.springframework.boot.loader.PropertiesLauncher.main(PropertiesLauncher.java:466) hapi-fhir-jpaserver-start | Caused by: org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat hapi-fhir-jpaserver-start | at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:142) hapi-fhir-jpaserver-start | at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.(TomcatWebServer.java:104) hapi-fhir-jpaserver-start | at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getTomcatWebServer(TomcatServletWebServerFactory.java:501) hapi-fhir-jpaserver-start | at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:218) hapi-fhir-jpaserver-start | at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:188) hapi-fhir-jpaserver-start | at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:162) hapi-fhir-jpaserver-start | ... 16 common frames omitted hapi-fhir-jpaserver-start | Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'hapiServletRegistration' defined in ca.uhn.fhir.jpa.starter.Application: Unsatisfied dependency expressed through method 'hapiServletRegistration' parameter 0: Error creating bean with name 'restfulServer' defined in class path resource [ca/uhn/fhir/jpa/starter/common/StarterJpaConfig.class]: Failed to instantiate [ca.uhn.fhir.rest.server.RestfulServer]: Factory method 'restfulServer' threw exception with message: Interceptor class was not found on classpath: hapi-fhir-jpaserver-start | at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:798) hapi-fhir-jpaserver-start | at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:542) hapi-fhir-jpaserver-start | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1334) hapi-fhir-jpaserver-start | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1164) hapi-fhir-jpaserver-start | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:561) hapi-fhir-jpaserver-start | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521) hapi-fhir-jpaserver-start | at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:325) hapi-fhir-jpaserver-start | at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) hapi-fhir-jpaserver-start | at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:323) hapi-fhir-jpaserver-start | at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:204) hapi-fhir-jpaserver-start | at org.springframework.boot.web.servlet.ServletContextInitializerBeans.getOrderedBeansOfType(ServletContextInitializerBeans.java:210) hapi-fhir-jpaserver-start | at org.springframework.boot.web.servlet.ServletContextInitializerBeans.getOrderedBeansOfType(ServletContextInitializerBeans.java:201) hapi-fhir-jpaserver-start | at org.springframework.boot.web.servlet.ServletContextInitializerBeans.addServletContextInitializerBeans(ServletContextInitializerBeans.java:96) hapi-fhir-jpaserver-start | at org.springframework.boot.web.servlet.ServletContextInitializerBeans.(ServletContextInitializerBeans.java:85) hapi-fhir-jpaserver-start | at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.getServletContextInitializerBeans(ServletWebServerApplicationContext.java:266) hapi-fhir-jpaserver-start | at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.selfInitialize(ServletWebServerApplicationContext.java:240) hapi-fhir-jpaserver-start | at org.springframework.boot.web.embedded.tomcat.TomcatStarter.onStartup(TomcatStarter.java:52) hapi-fhir-jpaserver-start | at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4850) hapi-fhir-jpaserver-start | at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:171) hapi-fhir-jpaserver-start | at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1332) hapi-fhir-jpaserver-start | at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1322) hapi-fhir-jpaserver-start | at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) hapi-fhir-jpaserver-start | at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) hapi-fhir-jpaserver-start | at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:145) hapi-fhir-jpaserver-start | at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:866) hapi-fhir-jpaserver-start | at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:845) hapi-fhir-jpaserver-start | at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:171) hapi-fhir-jpaserver-start | at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1332) hapi-fhir-jpaserver-start | at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1322) hapi-fhir-jpaserver-start | at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) hapi-fhir-jpaserver-start | at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) hapi-fhir-jpaserver-start | at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:145) hapi-fhir-jpaserver-start | at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:866) hapi-fhir-jpaserver-start | at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:240) hapi-fhir-jpaserver-start | at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:171) hapi-fhir-jpaserver-start | at org.apache.catalina.core.StandardService.startInternal(StandardService.java:433) hapi-fhir-jpaserver-start | at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:171) hapi-fhir-jpaserver-start | at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:917) hapi-fhir-jpaserver-start | at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:171) hapi-fhir-jpaserver-start | at org.apache.catalina.startup.Tomcat.start(Tomcat.java:488) hapi-fhir-jpaserver-start | at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:123) hapi-fhir-jpaserver-start | ... 21 common frames omitted hapi-fhir-jpaserver-start | Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'restfulServer' defined in class path resource [ca/uhn/fhir/jpa/starter/common/StarterJpaConfig.class]: Failed to instantiate [ca.uhn.fhir.rest.server.RestfulServer]: Factory method 'restfulServer' threw exception with message: Interceptor class was not found on classpath: hapi-fhir-jpaserver-start | at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:651) hapi-fhir-jpaserver-start | at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:639) hapi-fhir-jpaserver-start | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1334) hapi-fhir-jpaserver-start | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1164) hapi-fhir-jpaserver-start | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:561) hapi-fhir-jpaserver-start | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521) hapi-fhir-jpaserver-start | at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:325) hapi-fhir-jpaserver-start | at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) hapi-fhir-jpaserver-start | at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:323) hapi-fhir-jpaserver-start | at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) hapi-fhir-jpaserver-start | at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:254) hapi-fhir-jpaserver-start | at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1443) hapi-fhir-jpaserver-start | at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1353) hapi-fhir-jpaserver-start | at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:907) hapi-fhir-jpaserver-start | at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:785) hapi-fhir-jpaserver-start | ... 61 common frames omitted hapi-fhir-jpaserver-start | Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [ca.uhn.fhir.rest.server.RestfulServer]: Factory method 'restfulServer' threw exception with message: Interceptor class was not found on classpath: hapi-fhir-jpaserver-start | at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:177) hapi-fhir-jpaserver-start | at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:647) hapi-fhir-jpaserver-start | ... 75 common frames omitted hapi-fhir-jpaserver-start | Caused by: ca.uhn.fhir.context.ConfigurationException: Interceptor class was not found on classpath: hapi-fhir-jpaserver-start | at ca.uhn.fhir.jpa.starter.common.StarterJpaConfig.registerCustomInterceptors(StarterJpaConfig.java:480) hapi-fhir-jpaserver-start | at ca.uhn.fhir.jpa.starter.common.StarterJpaConfig.restfulServer(StarterJpaConfig.java:451) hapi-fhir-jpaserver-start | at ca.uhn.fhir.jpa.starter.common.StarterJpaConfig$$SpringCGLIB$$0.CGLIB$restfulServer$0() hapi-fhir-jpaserver-start | at ca.uhn.fhir.jpa.starter.common.StarterJpaConfig$$SpringCGLIB$$FastClass$$1.invoke() hapi-fhir-jpaserver-start | at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:258) hapi-fhir-jpaserver-start | at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331) hapi-fhir-jpaserver-start | at ca.uhn.fhir.jpa.starter.common.StarterJpaConfig$$SpringCGLIB$$0.restfulServer() hapi-fhir-jpaserver-start | at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) hapi-fhir-jpaserver-start | at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) hapi-fhir-jpaserver-start | at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) hapi-fhir-jpaserver-start | at java.base/java.lang.reflect.Method.invoke(Method.java:568) hapi-fhir-jpaserver-start | at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:140) hapi-fhir-jpaserver-start | ... 76 common frames omitted hapi-fhir-jpaserver-start | Caused by: java.lang.ClassNotFoundException: hapi-fhir-jpaserver-start | at java.base/java.lang.Class.forName0(Native Method) hapi-fhir-jpaserver-start | at java.base/java.lang.Class.forName(Class.java:375) hapi-fhir-jpaserver-start | at ca.uhn.fhir.jpa.starter.common.StarterJpaConfig.registerCustomInterceptors(StarterJpaConfig.java:478) hapi-fhir-jpaserver-start | ... 87 common frames omitted hapi-fhir-jpaserver-start exited with code 0`

XcrigX commented 5 months ago

It's not finding your interceptor class on the classpath: [ca/uhn/fhir/jpa/starter/common/StarterJpaConfig.class]: Failed to instantiate [ca.uhn.fhir.rest.server.RestfulServer]: Factory method 'restfulServer' threw exception with message: Interceptor class was not found on classpath:

There are two common ways to make your interceptor available:

1) clone the project, add your interceptor to it, and re-build it with your custom interceptor included. This would assume you are going to package/deploy your modified server yourself and not use the published docker image from dockerhub.

2) compile your interceptor and add it to the stock HAPI Docker container using the hapi-extra-classes config, as per: https://github.com/hapifhir/hapi-fhir-jpaserver-starter?tab=readme-ov-file#example-running-custom-interceptor-using-docker-compose

aakashkag commented 5 months ago

@michael-gvdw I am attaching a code for you That includes "BasicSecurityInterceptor.java" HAPI_FHIR_SERVER.zip

singhpreet89 commented 5 months ago

It's not finding your interceptor class on the classpath: [ca/uhn/fhir/jpa/starter/common/StarterJpaConfig.class]: Failed to instantiate [ca.uhn.fhir.rest.server.RestfulServer]: Factory method 'restfulServer' threw exception with message: Interceptor class was not found on classpath:

There are two common ways to make your interceptor available:

  1. clone the project, add your interceptor to it, and re-build it with your custom interceptor included. This would assume you are going to package/deploy your modified server yourself and not use the published docker image from dockerhub.
  2. compile your interceptor and add it to the stock HAPI Docker container using the hapi-extra-classes config, as per: https://github.com/hapifhir/hapi-fhir-jpaserver-starter?tab=readme-ov-file#example-running-custom-interceptor-using-docker-compose

How do I manually compile the Interceptor? Since hapi-fhir-jpa-started is running under docker environment

XcrigX commented 5 months ago

How do I manually compile the Interceptor? Since hapi-fhir-jpa-started is running under docker environment

I've never tried to use the hapi-extra-classes config, so I won't be of too much help.. but I assume you'd need to set up a Java project to compile your interceptor, then take the compiled artifact and inject it into the container. I don't know the precise steps though. I'd personally rather do (1) and have my own clone of the project with my interceptor added so that when there are updates to HAPI I'd know if anything breaks with my interceptor when I compile the new versions. You can still use the Dockerfile in the project to build the image - you'd just be compiling HAPI yourself, and running the docker build yourself.

michael-gvdw commented 3 months ago

@michael-gvdw I am attaching a code for you That includes "BasicSecurityInterceptor.java" HAPI_FHIR_SERVER.zip

@aakashkag I have downloaded the code and I tried to start the project by running the docker compose up --build command but it seems that is not able to find the new class. Have you run the provided code your self? if so what were the steps to run the project?

michael-gvdw commented 3 months ago

It's not finding your interceptor class on the classpath: [ca/uhn/fhir/jpa/starter/common/StarterJpaConfig.class]: Failed to instantiate [ca.uhn.fhir.rest.server.RestfulServer]: Factory method 'restfulServer' threw exception with message: Interceptor class was not found on classpath:

There are two common ways to make your interceptor available:

  1. clone the project, add your interceptor to it, and re-build it with your custom interceptor included. This would assume you are going to package/deploy your modified server yourself and not use the published docker image from dockerhub.
  2. compile your interceptor and add it to the stock HAPI Docker container using the hapi-extra-classes config, as per: https://github.com/hapifhir/hapi-fhir-jpaserver-starter?tab=readme-ov-file#example-running-custom-interceptor-using-docker-compose

when you say i have to re-build the project you mean build a new docker image?

aakashkag commented 3 months ago

@michael-gvdw Yes, You need to rebuild docker image to reflect changes.

michael-gvdw commented 3 months ago

@aakashkag maybe I am missing something. Once I downloaded the .zip file provided by you I ran the project by executing docker compose up --build, this would (as far as I know rebuild the docker image) run the project. Unfortunatelly I get the following error.

Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [ca.uhn.fhir.rest.server.RestfulServer]: Factory method 'restfulServer' threw exception with message: Interceptor class was not found on classpath: hapi-fhir-jpaserver-start | at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:177) hapi-fhir-jpaserver-start | at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:647) hapi-fhir-jpaserver-start | ... 75 common frames omitted hapi-fhir-jpaserver-start | Caused by: ca.uhn.fhir.context.ConfigurationException: Interceptor class was not found on classpath: hapi-fhir-jpaserver-start | at ca.uhn.fhir.jpa.starter.common.StarterJpaConfig.registerCustomInterceptors(StarterJpaConfig.java:480) hapi-fhir-jpaserver-start | at ca.uhn.fhir.jpa.starter.common.StarterJpaConfig.restfulServer(StarterJpaConfig.java:451) hapi-fhir-jpaserver-start | at ca.uhn.fhir.jpa.starter.common.StarterJpaConfig$$SpringCGLIB$$0.CGLIB$restfulServer$0() hapi-fhir-jpaserver-start | at ca.uhn.fhir.jpa.starter.common.StarterJpaConfig$$SpringCGLIB$$FastClass$$1.invoke() hapi-fhir-jpaserver-start | at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:258) hapi-fhir-jpaserver-start | at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331) hapi-fhir-jpaserver-start | at ca.uhn.fhir.jpa.starter.common.StarterJpaConfig$$SpringCGLIB$$0.restfulServer() hapi-fhir-jpaserver-start | at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) hapi-fhir-jpaserver-start | at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) hapi-fhir-jpaserver-start | at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) hapi-fhir-jpaserver-start | at java.base/java.lang.reflect.Method.invoke(Method.java:568) hapi-fhir-jpaserver-start | at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:140) hapi-fhir-jpaserver-start | ... 76 common frames omitted hapi-fhir-jpaserver-start | Caused by: java.lang.ClassNotFoundException: hapi-fhir-jpaserver-start | at java.base/java.lang.Class.forName0(Native Method) hapi-fhir-jpaserver-start | at java.base/java.lang.Class.forName(Class.java:375) hapi-fhir-jpaserver-start | at ca.uhn.fhir.jpa.starter.common.StarterJpaConfig.registerCustomInterceptors(StarterJpaConfig.java:478) hapi-fhir-jpaserver-start | ... 87 common frames omitted

now I understand it is not able to find the interceptor but it is present in the code base and definded in the application.yaml file. So I am really confused why it does not start up with the custom interceptor. Any insight?

XcrigX commented 3 months ago

There error shows: "Interceptor class was not found on classpath: hapi-fhir-jpaserver-start"

That is printed here: Interceptor class was not found on classpath

What does your configuration look like for the property :

hapi:
  fhir:
    custom-interceptor-classes: the.package.containing.your.interceptor.YourInterceptor

If I'm reading things correctly, it's looking for a class called "hapi-fhir-jpaserver-start". If that's your custom interceptor classname, you probably need to fully qualify it with the package.

michael-gvdw commented 3 months ago

@XcrigX "hapi-fhir-jpaserver-start" is the name of the docker container. Interceptor class was not found on classpath I think classname is empty in the logs. the code i am using the the files provided by @aakashkag.

XcrigX commented 3 months ago

What value do you have in your application.yml file for custom-interceptor-classes ?

michael-gvdw commented 3 months ago

I managed to get it working. The issue was related to the application.yaml file when specifying the interceptors i had added a ',' at the end which caused the issue as the code tried to read one more interceptor which was just blank and that caused the error.