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

Unable to use spring-boot with jetty profile for HAPI 7.3.7-SNAPSHOT #700

Open
dotasek opened this issue Jun 18, 2024 · 1 comment
Open
Assignees

Comments

@dotasek
Copy link
Contributor

dotasek commented Jun 18, 2024

When trying to execute the smoke tests in the HAPI release tracking branch (#684), the running spring-boot using the jetty profile results in an exception and is unable to start the server.

Replication Steps

Run jpaserver-starter using the following command:

mvn -P jetty spring-boot:run

The following exception is thrown, and the server is not available:

2024-06-18 13:06:50.034 [main] ERROR o.s.boot.SpringApplication [SpringApplication.java:859] Application run failed
org.springframework.context.ApplicationContextException: Unable to start web server
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:165)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:618)
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146)
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754)
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:456)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:335)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1363)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1352)
	at ca.uhn.fhir.jpa.starter.Application.main(Application.java:46)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jettyServletWebServerFactory' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/ServletWebServerFactoryConfiguration$EmbeddedJetty.class]: org/eclipse/jetty/util/ClassMatcher
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:607)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:522)
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:337)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:335)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:205)
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.getWebServerFactory(ServletWebServerApplicationContext.java:223)
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:186)
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:162)
	... 8 common frames omitted
Caused by: java.lang.NoClassDefFoundError: org/eclipse/jetty/util/ClassMatcher
	at org.eclipse.jetty.ee10.webapp.AbstractConfiguration$Builder.<init>(AbstractConfiguration.java:37)
	at org.springframework.boot.autoconfigure.websocket.servlet.JettyWebSocketServletWebServerCustomizer.customize(JettyWebSocketServletWebServerCustomizer.java:44)
	at org.springframework.boot.autoconfigure.websocket.servlet.JettyWebSocketServletWebServerCustomizer.customize(JettyWebSocketServletWebServerCustomizer.java:39)
	at org.springframework.boot.web.server.WebServerFactoryCustomizerBeanPostProcessor.lambda$postProcessBeforeInitialization$0(WebServerFactoryCustomizerBeanPostProcessor.java:72)
	at org.springframework.boot.util.LambdaSafe$Callbacks.lambda$invoke$0(LambdaSafe.java:287)
	at org.springframework.boot.util.LambdaSafe$LambdaSafeCallback.invoke(LambdaSafe.java:159)
	at org.springframework.boot.util.LambdaSafe$Callbacks.lambda$invoke$1(LambdaSafe.java:286)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
	at java.base/java.util.Collections$UnmodifiableCollection.forEach(Collections.java:1092)
	at org.springframework.boot.util.LambdaSafe$Callbacks.invoke(LambdaSafe.java:286)
	at org.springframework.boot.web.server.WebServerFactoryCustomizerBeanPostProcessor.postProcessBeforeInitialization(WebServerFactoryCustomizerBeanPostProcessor.java:72)
	at org.springframework.boot.web.server.WebServerFactoryCustomizerBeanPostProcessor.postProcessBeforeInitialization(WebServerFactoryCustomizerBeanPostProcessor.java:58)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:422)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1780)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:600)
	... 16 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.eclipse.jetty.util.ClassMatcher
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)
	... 31 common frames omitted
@dotasek dotasek self-assigned this Jun 18, 2024
@dotasek
Copy link
Contributor Author

dotasek commented Jun 18, 2024

There is already a potential solution here: hapifhir/hapi-fhir#6022

From what I can tell, spring-boot-starter-jetty is picky about the version of jetty, and the versions should align. To see the appropriate jetty version, you can quickly check the dependency listing here (it is jetty 12.0.9) https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-jetty/3.2.6

For comparison, the old version is here: https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-jetty/3.2.0

I'm documenting this issue here in case anyone else runs into an issue when HAPI bumps the version of spring-boot.

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