Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rest server skeleton overlay app is getting all 404 from the FHIR server #50

Open
ppazos opened this issue May 14, 2024 · 3 comments
Open

Comments

@ppazos
Copy link

ppazos commented May 14, 2024

I have built hapi-fhirstarters-rest-server-skeleton and deployed the war on Tomcat 11.

The overlay app is working on http://localhost:8080/fhir/

First I see there are no resources on the menu, while in the ExampleRestfulServet class there are two resource providers configured on the server.

Screenshot_2024-05-14_14-42-44
Screenshot_2024-05-14_14-43-44

Then if I go to Server Home Actions and click on Conformance, in the Tomcat logs I see:

14:45:01.114 WARN  o.s.web.servlet.PageNotFound No mapping for GET /fhir/metadata
14:45:01.114 WARN  o.s.web.servlet.PageNotFound No endpoint GET /fhir/metadata.
14:45:01.117 WARN  ca.uhn.fhir.to.BaseController Failed to load conformance statement, error was: ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException: HTTP 404 

On the web I see the 404 alert.

Screenshot_2024-05-14_14-46-56

It seems the server is not being initialized correctly (ExampleRestulfServlet.initialize() not being invoked?)

I'm blocked here, not sure what to do.

@ppazos
Copy link
Author

ppazos commented May 14, 2024

Full exception

14:53:58.462 WARN  ca.uhn.fhir.to.BaseController Failed to invoke server
ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException: HTTP 404 
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
	at ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException.newInstance(BaseServerResponseException.java:317)
	at ca.uhn.fhir.rest.client.impl.BaseClient.invokeClient(BaseClient.java:415)
	at ca.uhn.fhir.rest.client.impl.GenericClient$BaseClientExecutable.invoke(GenericClient.java:585)
	at ca.uhn.fhir.rest.client.impl.GenericClient$FetchConformanceInternal.execute(GenericClient.java:896)
	at ca.uhn.fhir.to.Controller.actionConformance(Controller.java:117)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:261)
	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:189)
	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:118)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:917)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:829)
	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1089)
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:979)
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1014)
	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:903)
	at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:619)
	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:885)
	at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:716)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:130)
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:109)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:167)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:90)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:482)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:115)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:93)
	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:663)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:387)
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:63)
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:896)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1746)
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52)
	at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1148)
	at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:63)
	at java.base/java.lang.Thread.run(Thread.java:840)

@ppazos ppazos changed the title Rest server skeleton overlay app is getting all 404 frmo the FHIR server Rest server skeleton overlay app is getting all 404 from the FHIR server May 14, 2024
@ppazos
Copy link
Author

ppazos commented May 14, 2024

I did another try and the initialize() method is being called (added a print)

tomcat

Then I tried to deploy the restful-server-example.war as the ROOT.war and it worked.

It seems the overlay app (https://github.com/hapifhir/hapi-fhir/tree/master/hapi-fhir-testpage-overlay) might have some configuration that doesn't allow to deploy it in a different context than root.

Does anybody knows where can I change that so it allows to reploy on any context/path?

@ppazos
Copy link
Author

ppazos commented May 14, 2024

Aha!

It seems the hepi-fhir-testpage-overlay has a hardcoded servlet mapping to the root in the web.xml:

	<servlet-mapping>
		<servlet-name>spring</servlet-name>
		<url-pattern>/</url-pattern>
	</servlet-mapping>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant