OHDSI Home | Forums | Wiki | Github

Problem Deploying WebAPI 2.7.0 on Tomcat

Hi There,

We are having issues deploying the webapi 2.7.0.war file on Tomcat manager and are hoping we could get some solutions for this.

What we did was as follows:

  1. download webapi 2.7.0 from Release WebAPI v2.7.0 · OHDSI/WebAPI · GitHub
  2. placed the settings.xml file in a WebAPIConfig folder in the webapi 2.7.0 folder that we downloaded
  3. from terminal, navigate to the webapi 2.7.0 folder and ran this command:

mvn clean package -DskipTests -s WebAPIConfig/settings.xml -P webapi-postgresql

After that we deployed the .war file that was built into Apache Tomcat webapps folder but it failed to start: Tomcat%20Screenshot

Have attached the error messages from the Tomcat log below and hope that someone can advise us on how to go about resolving this

java.lang.IllegalStateException: Error starting child
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:716)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:690)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:695)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:978)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1850)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:118)
at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:773)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:427)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1621)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:305)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1144)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1346)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1350)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1328)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/WebAPI]]
at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:441)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:198)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:713)
… 24 more
Caused by: org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration’: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration$$EnhancerBySpringCGLIB$$6db1a2ae]: Constructor threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘resourceConfigCustomizer’ defined in class path resource [org/springframework/boot/autoconfigure/jersey/JerseyAutoConfiguration

Thanks for the help!

@Chris_Knoll @ambuj

Looping you in for any ideas for the above issue, thanks :smiley:

Regards,
Hui Xing

@hui_xing_tan
Few questions:

have you made changes to Settings.xml as per your environment?
have you created the webapi schema for tables to be created automatically?

This must be caused by something else, earlier in your logs. Can you clear your logs and restart the process so that you can get a fresh log. Then attach the log here (please clean out any sensitive information).

Hi @ambuj

have you made changes to Settings.xml as per your environment? - yes
have you created the webapi schema for tables to be created automatically? - yes

Was Webapi.war build successful?
Did you try localhost:8080/WebAPI.source/sources in browser?
Have you configured source and source_daimon tables in webapi schema properly?

please share the results.

HI @ambuj @Chris_Knoll

Sorry for the late reply, we have the details.

Yes, Webapi.war build was successful. We tried to deploy it once, it worked and the tables were created in the webapi schema

Subsequently after inserting the configuration values into the source and source daimon tables, we stopped webapi and was not able to start it again.

Please find results below:

  1. tomcat logs after clearing and running again

:: Spring Boot :: (v1.5.2.RELEASE)

2019-03-31 05:22:37.117 INFO http-nio-8080-exec-3 org.ohdsi.webapi.WebApi - - Starting WebApi on .local with (******/WebAPI/WEB-INF/classes started by **************** in ********************)
2019-03-31 05:22:37.119 INFO http-nio-8080-exec-3 org.ohdsi.webapi.WebApi - - The following profiles are active: default
2019-03-31 05:22:37.166 INFO http-nio-8080-exec-3 org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext - - Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@ff478da: startup date [
******]; root of context hierarchy
2019-03-31 05:22:37.326 INFO background-preinit org.hibernate.validator.internal.util.Version - - HV000001: Hibernate Validator 5.3.4.Final
2019-03-31 05:22:41.287 INFO http-nio-8080-exec-3 org.springframework.beans.factory.support.DefaultListableBeanFactory - - Overriding bean definition for bean ‘jobBuilders’ with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.batch.core.configuration.annotation.SimpleBatchConfiguration; factoryMethodName=jobBuilders; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/batch/core/configuration/annotation/SimpleBatchConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=true; factoryBeanName=jobConfig; factoryMethodName=jobBuilders; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/ohdsi/webapi/JobConfig.class]]
2019-03-31 05:22:41.591 INFO http-nio-8080-exec-3 org.springframework.beans.factory.support.DefaultListableBeanFactory - - Overriding bean definition for bean ‘requestContextFilter’ with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration; factoryMethodName=requestContextFilter; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/jersey/JerseyAutoConfiguration.class]] with [Root bean: class [org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=requestContextFilter; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter.class]]
2019-03-31 05:22:42.065 INFO http-nio-8080-exec-3 org.springframework.integration.config.IntegrationRegistrar - - No bean named ‘integrationHeaderChannelRegistry’ has been explicitly defined. Therefore, a default DefaultHeaderChannelRegistry will be created.
2019-03-31 05:22:42.657 WARN http-nio-8080-exec-3 org.springframework.context.annotation.ConfigurationClassEnhancer - - @Bean method ScopeConfiguration.stepScope is non-static and returns an object assignable to Spring’s BeanFactoryPostProcessor interface. This will result in a failure to process annotations such as @Autowired, @Resource and @PostConstruct within the method’s declaring @Configuration class. Add the ‘static’ modifier to this method to avoid these container lifecycle issues; see @Bean javadoc for complete details.
2019-03-31 05:22:42.685 WARN http-nio-8080-exec-3 org.springframework.context.annotation.ConfigurationClassEnhancer - - @Bean method ScopeConfiguration.jobScope is non-static and returns an object assignable to Spring’s BeanFactoryPostProcessor interface. This will result in a failure to process annotations such as @Autowired, @Resource and @PostConstruct within the method’s declaring @Configuration class. Add the ‘static’ modifier to this method to avoid these container lifecycle issues; see @Bean javadoc for complete details.
2019-03-31 05:22:42.722 INFO http-nio-8080-exec-3 org.springframework.integration.config.DefaultConfiguringBeanFactoryPostProcessor - - No bean named ‘errorChannel’ has been explicitly defined. Therefore, a default PublishSubscribeChannel will be created.
2019-03-31 05:22:42.742 INFO http-nio-8080-exec-3 org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor - - JSR-330 ‘javax.inject.Inject’ annotation found and supported for autowiring
2019-03-31 05:22:42.827 INFO http-nio-8080-exec-3 org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker - - Bean ‘converterConfiguration’ of type [org.ohdsi.webapi.ConverterConfiguration$$EnhancerBySpringCGLIB$$ffd7e27a] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-03-31 05:22:42.838 INFO http-nio-8080-exec-3 org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker - - Bean ‘conversionService’ of type [org.springframework.core.convert.support.DefaultConversionService] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-03-31 05:22:43.260 INFO http-nio-8080-exec-3 org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker - - Bean ‘org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration’ of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$993cbb2e] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-03-31 05:22:43.361 INFO http-nio-8080-exec-3 org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker - - Bean ‘shiroConfiguration’ of type [org.ohdsi.webapi.ShiroConfiguration$$EnhancerBySpringCGLIB$$ddab2129] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-03-31 05:22:43.375 INFO http-nio-8080-exec-3 org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker - - Bean ‘flywayConfig’ of type [org.ohdsi.webapi.FlywayConfig$$EnhancerBySpringCGLIB$$9be06d82] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-03-31 05:22:44.765 INFO http-nio-8080-exec-3 org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker - - Bean ‘secondaryDataSource’ of type [org.apache.tomcat.jdbc.pool.DataSource] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-03-31 05:22:44.778 INFO http-nio-8080-exec-3 org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker - - Bean ‘org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration’ of type [org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration$$EnhancerBySpringCGLIB$$7b305e8e] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-03-31 05:22:44.983 INFO http-nio-8080-exec-3 org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker - - Bean ‘spring.datasource-org.springframework.boot.autoconfigure.jdbc.DataSourceProperties’ of type [org.springframework.boot.autoconfigure.jdbc.DataSourceProperties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-03-31 05:22:44.997 INFO http-nio-8080-exec-3 org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker - - Bean ‘dataSourceInitializer’ of type [org.springframework.boot.autoconfigure.jdbc.DataSourceInitializer] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-03-31 05:22:45.160 INFO http-nio-8080-exec-3 org.flywaydb.core.internal.util.VersionPrinter - - Flyway 4.2.0 by Boxfuse
2019-03-31 05:22:45.351 INFO http-nio-8080-exec-3 org.flywaydb.core.internal.dbsupport.DbSupportFactory - - Database: jdbc:postgresql://localhost:5432/OHDSI (PostgreSQL 11.2)
2019-03-31 05:22:45.580 INFO http-nio-8080-exec-3 org.flywaydb.core.internal.command.DbMigrate - - Current version of schema “webapi”: 2.7.0.20190314171003
2019-03-31 05:22:45.580 WARN http-nio-8080-exec-3 org.flywaydb.core.internal.command.DbMigrate - - outOfOrder mode is active. Migration of schema “webapi” may not be reproducible.
2019-03-31 05:22:45.581 INFO http-nio-8080-exec-3 org.flywaydb.core.internal.command.DbMigrate - - Schema “webapi” is up to date. No migration necessary.
2019-03-31 05:22:45.584 INFO http-nio-8080-exec-3 org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker - - Bean ‘flyway’ of type [org.flywaydb.core.Flyway] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-03-31 05:22:45.593 INFO http-nio-8080-exec-3 org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker - - Bean ‘disabledSecurity’ of type [org.ohdsi.webapi.shiro.management.DisabledSecurity] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-03-31 05:22:45.610 INFO http-nio-8080-exec-3 org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker - - Bean ‘noLockoutPolicy’ of type [org.ohdsi.webapi.shiro.lockout.NoLockoutPolicy] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-03-31 05:22:45.677 INFO http-nio-8080-exec-3 org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker - - Bean ‘securityManager’ of type [org.ohdsi.webapi.shiro.lockout.LockoutWebSecurityManager] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-03-31 05:22:45.738 INFO http-nio-8080-exec-3 org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker - - Bean ‘integrationGlobalProperties’ of type [org.springframework.beans.factory.config.PropertiesFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-03-31 05:22:45.739 INFO http-nio-8080-exec-3 org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker - - Bean ‘integrationGlobalProperties’ of type [java.util.Properties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-03-31 05:22:45.792 INFO http-nio-8080-exec-3 org.springframework.web.context.ContextLoader - - Root WebApplicationContext: initialization completed in 8626 ms
2019-03-31 05:22:46.332 WARN http-nio-8080-exec-3 org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext - - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration’: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration$$EnhancerBySpringCGLIB$$eab9a918]: Constructor threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘resourceConfigCustomizer’ defined in class path resource [org/springframework/boot/autoconfigure/jersey/JerseyAutoConfiguration$JacksonResourceConfigCustomizer.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.autoconfigure.jersey.ResourceConfigCustomizer]: Factory method ‘resourceConfigCustomizer’ threw exception; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlElement
2019-03-31 05:22:46.344 ERROR http-nio-8080-exec-3 org.springframework.boot.SpringApplication - - Application startup failed
org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration’: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration$$EnhancerBySpringCGLIB$$eab9a918]: Constructor threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘resourceConfigCustomizer’ defined in class path resource [org/springframework/boot/autoconfigure/jersey/JerseyAutoConfiguration$JacksonResourceConfigCustomizer.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.autoconfigure.jersey.ResourceConfigCustomizer]: Factory method ‘resourceConfigCustomizer’ threw exception; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlElement
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:137)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:536)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:737)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:370)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:314)
at org.springframework.boot.web.support.SpringBootServletInitializer.run(SpringBootServletInitializer.java:151)
at org.springframework.boot.web.support.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:131)
at org.springframework.boot.web.support.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:86)
at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:169)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5125)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.manager.ManagerServlet.start(ManagerServlet.java:1409)
at org.apache.catalina.manager.HTMLManagerServlet.start(HTMLManagerServlet.java:698)
at org.apache.catalina.manager.HTMLManagerServlet.doPost(HTMLManagerServlet.java:223)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:660)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.filters.CsrfPreventionFilter.doFilter(CsrfPreventionFilter.java:136)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:200)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:607)
at org.apache.catalina.valves.RequestFilterValve.process(RequestFilterValve.java:348)
at org.apache.catalina.valves.RemoteAddrValve.invoke(RemoteAddrValve.java:53)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:668)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:834)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1415)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration’: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration$$EnhancerBySpringCGLIB$$eab9a918]: Constructor threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘resourceConfigCustomizer’ defined in class path resource [org/springframework/boot/autoconfigure/jersey/JerseyAutoConfiguration$JacksonResourceConfigCustomizer.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.autoconfigure.jersey.ResourceConfigCustomizer]: Factory method ‘resourceConfigCustomizer’ threw exception; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlElement
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:279)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1193)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1095)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:372)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1173)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1067)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.boot.web.servlet.ServletContextInitializerBeans.getOrderedBeansOfType(ServletContextInitializerBeans.java:234)
at org.springframework.boot.web.servlet.ServletContextInitializerBeans.getOrderedBeansOfType(ServletContextInitializerBeans.java:215)
at org.springframework.boot.web.servlet.ServletContextInitializerBeans.addServletContextInitializerBeans(ServletContextInitializerBeans.java:91)
at org.springframework.boot.web.servlet.ServletContextInitializerBeans.(ServletContextInitializerBeans.java:79)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.getServletContextInitializerBeans(EmbeddedWebApplicationContext.java:241)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.selfInitialize(EmbeddedWebApplicationContext.java:228)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.access$000(EmbeddedWebApplicationContext.java:89)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext$1.onStartup(EmbeddedWebApplicationContext.java:213)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:168)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:134)
… 43 more
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration$$EnhancerBySpringCGLIB$$eab9a918]: Constructor threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘resourceConfigCustomizer’ defined in class path resource [org/springframework/boot/autoconfigure/jersey/JerseyAutoConfiguration$JacksonResourceConfigCustomizer.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.autoconfigure.jersey.ResourceConfigCustomizer]: Factory method ‘resourceConfigCustomizer’ threw exception; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlElement
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:154)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:122)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:271)
… 70 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘resourceConfigCustomizer’ defined in class path resource [org/springframework/boot/autoconfigure/jersey/JerseyAutoConfiguration$JacksonResourceConfigCustomizer.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.autoconfigure.jersey.ResourceConfigCustomizer]: Factory method ‘resourceConfigCustomizer’ threw exception; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlElement
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1173)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1067)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.addCandidateEntry(DefaultListableBeanFactory.java:1309)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1275)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveMultipleBeans(DefaultListableBeanFactory.java:1180)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1096)
at org.springframework.beans.factory.support.DefaultListableBeanFactory$DependencyObjectProvider.getIfAvailable(DefaultListableBeanFactory.java:1655)
at org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration.(JerseyAutoConfiguration.java:106)
at org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration$$EnhancerBySpringCGLIB$$eab9a918.()
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:142)
… 72 more
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.autoconfigure.jersey.ResourceConfigCustomizer]: Factory method ‘resourceConfigCustomizer’ threw exception; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlElement
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
… 93 more
Caused by: java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlElement
at com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector.(JaxbAnnotationIntrospector.java:139)
at com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector.(JaxbAnnotationIntrospector.java:126)
at org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration$JacksonResourceConfigCustomizer$ObjectMapperCustomizer.addJaxbAnnotationIntrospector(JerseyAutoConfiguration.java:266)
at org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration$JacksonResourceConfigCustomizer$ObjectMapperCustomizer.access$200(JerseyAutoConfiguration.java:262)
at org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration$JacksonResourceConfigCustomizer.addJaxbAnnotationIntrospectorIfPresent(JerseyAutoConfiguration.java:258)
at org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration$JacksonResourceConfigCustomizer.resourceConfigCustomizer(JerseyAutoConfiguration.java:244)
at org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration$JacksonResourceConfigCustomizer$$EnhancerBySpringCGLIB$$1e542a26.CGLIB$resourceConfigCustomizer$0()
at org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration$JacksonResourceConfigCustomizer$$EnhancerBySpringCGLIB$$1e542a26$$FastClassBySpringCGLIB$$731c85cc.invoke()
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:358)
at org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration$JacksonResourceConfigCustomizer$$EnhancerBySpringCGLIB$$1e542a26.resourceConfigCustomizer()
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
… 94 more
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlElement
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1363)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1186)
… 110 more

  1. settings.xml

  2. display localhost:8080/WebAPI.source/sources in browser

  3. source and source daimon tables


This is the root of the exception.

What is extremely odd is that you say that you were able to start it once and get tables created, and then after inserting source records, you get this error. They can’t be connected, since at the point of your error, the server failed to even start. But, to be sure, you can always delete the records from your source table and restart it (I don’t think that will change anything).

The real question is: why isn’t the java runtime finding javax.xml.bind.annotation.XmlElement class? I’m not sure if that’s a core class of the JDK or some extension. But if you can think of anything that might have changed between running and breaking (such as new version of JDK, you changed class paths, etc), that might help us understand what went wrong.

I read that the JAXB (java api for xml) is no longer bundled with JDK9… Can you run this on JDK 8?

You can find information on resolving this here: https://www.concretepage.com/questions/556

Adding the option to the command line options:
–add-modules java.xml.bind

They also talk about adding it as a dependency, but I’m not sure what impact that will have on our JDK 8 clients.

I see, thanks for the advice and we will look into it:

Where do we add this option? is it in the terminal? do we have to navigate to a particular folder first?

I see, hmm one thing I can think of is that for the single instance we could deploy it we ran this command before building the .war file:

Open command prompt, go to the WebAPI folder , type

set JAVA_HOME=C:/Program Files/Java/jdk1.8.0_xxx

but I do not see why it will work in one instance and fail in another :thinking:

I believe this would be put in your ‘startup options’ for your Tomcat instance. I don’t know how to specify those options off the top of my head right now, it depends if you’re running on Windows vs. Linux.

Odd, from the last comment about the JAVA_HOME, looks like you are on JDK 8. But can you confirm that? I don’t know if you were just citing documentation with the JDK 8 reference or if that is your actual run-time environment.

I will experiment about changing our core maven dependencies to include the JAXB library, which should resolve your issue, but otherwise, I’m not sure what specifically is going on in your environment. If you do find something, please let us know so we can help people with this same issue in the future.

Thanks @Chris_Knoll

We are using a mac.

We try to confirm the runtime environment by typing into the terminal
ls -l /Library/Java/JavaVirtualMachines

and get the following output:

total 0
drwxr-xr-x 3 root wheel 96 Mar 14 09:45 jdk-11.0.2.jdk
drwxr-xr-x 3 root wheel 96 Mar 14 16:47 jdk1.8.0_202.jdk

so it seems like there are 2 versions of jdk in /Library/Java/JavaVirtualMachines

but when we write:

echo %JAVA_HOME%

result is blank

and when we type

java -version

it shows the JDK 8 version

Not sure if the error is because JDK version 11 is used, althouh it seem like it (sorry, only know the few commands as above to check… :().

Anyway should we follow the instructions on How to remove Java 10? Or revert to the previous version? - Ask Different

and delete the jdk 11 using

sudo rm -rf jdk-11.0.2.jdk

Will that help?
Thanks :slight_smile:

Give it a try and report back if it works, I’m sure there are other people in the same position that would like to know what the resolution is.

Hi, @Chris_Knoll

Apologies for the late reply, but yes, now the error is not showing anymore after we removed the jdk 11. Instead there is another error message:

SEVERE [main] org.apache.catalina.startup.HostConfig.deployWAR Error deploying web application archive [/Library/Tomcat/webapps/WebAPI.war]

 java.lang.IllegalStateException: Error starting child

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jobInvalidator': Invocation of init method failed; nested exception is org.springframework.transaction.CannotCreateTransactionException: Could not open JPA EntityManager for transaction; nested exception is org.hibernate.exception.GenericJDBCException: Unable to acquire JDBC Connection

I believe it is unrelated to the earlier error. We’ll figure it out in time to come but hope the update on the jdk helps other users for now.

Cheers!

This points to either a JDBC url problem. Check your settings and look in the log earlier, it may have a more detailed reason for ‘Unable to acquire JDBC Connection’.

Thank you

t