We were following the installation guide laid down at http://www.ohdsi.org/web/wiki/doku.php?id=documentation:software:webapi:webapi_installation_guide
However, we faced an issue while deploying the webapi in tomcat. [Tomcat V 8.5]. We built the code using Maven 3.2.2
Error Log from TomCat -
Caused by: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name ‘CDMResultsService’: Injection of
autowired dependencies failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Could not
autowire field: private org.ohdsi.webapi.source.SourceRepository
org.ohdsi.webapi.service.AbstractDaoService.sourceRepository; nested
exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name ‘sourceRepository’: Cannot create inner
bean ‘(inner bean)#229f3d21’ of type
[org.springframework.orm.jpa.SharedEntityManagerCreator] while setting
bean property ‘entityManager’; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name ‘(inner bean)#229f3d21’: Cannot resolve reference to bean
‘entityManagerFactory’ while setting constructor argument; nested
exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name ‘entityManagerFactory’ defined in class
path resource [org/ohdsi/webapi/DataAccessConfig.class]: Bean
instantiation via factory method failed; nested exception is
org.springframework.beans.BeanInstantiationException: Failed to
instantiate [javax.persistence.EntityManagerFactory]: Factory method
‘entityManagerFactory’ threw exception; nested exception is
org.hibernate.HibernateException: Access to DialectResolutionInfo cannot
be null when ‘hibernate.dialect’ not set
at
org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1202)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:762)
at
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757)
at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)
at
org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
at
org.springframework.boot.SpringApplication.refresh(SpringApplication.java:691)
at
org.springframework.boot.SpringApplication.run(SpringApplication.java:321)
at
org.springframework.boot.context.web.SpringBootServletInitializer.run(SpringBootServletInitializer.java:117)
at
org.springframework.boot.context.web.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:108)
at
org.springframework.boot.context.web.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:68)
at
org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:175)
at
org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5178)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
… 10 more
Caused by: org.springframework.beans.factory.BeanCreationException:
Could not autowire field: private
org.ohdsi.webapi.source.SourceRepository
org.ohdsi.webapi.service.AbstractDaoService.sourceRepository; nested
exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name ‘sourceRepository’: Cannot create inner
bean ‘(inner bean)#229f3d21’ of type
[org.springframework.orm.jpa.SharedEntityManagerCreator] while setting
bean property ‘entityManager’; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name ‘(inner bean)#229f3d21’: Cannot resolve reference to bean
‘entityManagerFactory’ while setting constructor argument; nested
exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name ‘entityManagerFactory’ defined in class
path resource [org/ohdsi/webapi/DataAccessConfig.class]: Bean
instantiation via factory method failed; nested exception is
org.springframework.beans.BeanInstantiationException: Failed to
instantiate [javax.persistence.EntityManagerFactory]: Factory method
‘entityManagerFactory’ threw exception; nested exception is
org.hibernate.HibernateException: Access to DialectResolutionInfo cannot
be null when ‘hibernate.dialect’ not set
at
org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:561)
at
org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
at
org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331)
… 29 more
Caused by: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name ‘sourceRepository’: Cannot create inner
bean ‘(inner bean)#229f3d21’ of type
[org.springframework.orm.jpa.SharedEntityManagerCreator] while setting
bean property ‘entityManager’; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name ‘(inner bean)#229f3d21’: Cannot resolve reference to bean
‘entityManagerFactory’ while setting constructor argument; nested
exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name ‘entityManagerFactory’ defined in class
path resource [org/ohdsi/webapi/DataAccessConfig.class]: Bean
instantiation via factory method failed; nested exception is
org.springframework.beans.BeanInstantiationException: Failed to
instantiate [javax.persistence.EntityManagerFactory]: Factory method
‘entityManagerFactory’ threw exception; nested exception is
org.hibernate.HibernateException: Access to DialectResolutionInfo cannot
be null when ‘hibernate.dialect’ not set
at
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:313)
at
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:129)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1469)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1127)
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1051)
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:949)
at
org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:533)
… 31 more
Caused by: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name ‘(inner bean)#229f3d21’: Cannot resolve
reference to bean ‘entityManagerFactory’ while setting constructor
argument; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating
bean with name ‘entityManagerFactory’ defined in class path resource
[org/ohdsi/webapi/DataAccessConfig.class]: Bean instantiation via
factory method failed; nested exception is
org.springframework.beans.BeanInstantiationException: Failed to
instantiate [javax.persistence.EntityManagerFactory]: Factory method
‘entityManagerFactory’ threw exception; nested exception is
org.hibernate.HibernateException: Access to DialectResolutionInfo cannot
be null when ‘hibernate.dialect’ not set
at
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:359)
at
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108)
at
org.springframework.beans.factory.support.ConstructorResolver.resolveConstructorArguments(ConstructorResolver.java:634)
at
org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:444)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1111)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1006)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
at
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:299)
… 44 more
Caused by: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name ‘entityManagerFactory’ defined in class
path resource [org/ohdsi/webapi/DataAccessConfig.class]: Bean
instantiation via factory method failed; nested exception is
org.springframework.beans.BeanInstantiationException: Failed to
instantiate [javax.persistence.EntityManagerFactory]: Factory method
‘entityManagerFactory’ threw exception; nested exception is
org.hibernate.HibernateException: Access to DialectResolutionInfo cannot
be null when ‘hibernate.dialect’ not set
at
org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1111)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1006)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:351)
… 52 more
Caused by: org.springframework.beans.BeanInstantiationException: Failed
to instantiate [javax.persistence.EntityManagerFactory]: Factory method
‘entityManagerFactory’ threw exception; nested exception is
org.hibernate.HibernateException: Access to DialectResolutionInfo cannot
be null when ‘hibernate.dialect’ not set
at
org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
at
org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
… 61 more
Caused by: org.hibernate.HibernateException: Access to
DialectResolutionInfo cannot be null when ‘hibernate.dialect’ not set
at
org.hibernate.engine.jdbc.dialect.internal.DialectFactoryImpl.determineDialect(DialectFactoryImpl.java:104)
at
org.hibernate.engine.jdbc.dialect.internal.DialectFactoryImpl.buildDialect(DialectFactoryImpl.java:71)
at
org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:205)
at
org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:111)
at
org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:234)
at
org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:206)
at
org.hibernate.cfg.Configuration.buildTypeRegistrations(Configuration.java:1887)
at
org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1845)
at
org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:852)
at
org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:845)
at
org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.withTccl(ClassLoaderServiceImpl.java:398)
at
org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:844)
at
org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:60)
at
org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:343)
at
org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:318)
at
org.ohdsi.webapi.DataAccessConfig.entityManagerFactory(DataAccessConfig.java:93)
at
org.ohdsi.webapi.DataAccessConfig$$EnhancerBySpringCGLIB$$c94537c.CGLIB$entityManagerFactory$2()
at
org.ohdsi.webapi.DataAccessConfig$$EnhancerBySpringCGLIB$$c94537c$$FastClassBySpringCGLIB$$9af4fcb0.invoke()
at
org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
at
org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:309)
at
org.ohdsi.webapi.DataAccessConfig$$EnhancerBySpringCGLIB$$c94537c.entityManagerFactory()
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at
org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
… 62 more
27-Dec-2016 17:45:45.839 SEVERE [localhost-startStop-2]
org.apache.catalina.startup.HostConfig.deployWAR Error deploying web
application archive C:\Program Files\Apache Software Foundation\Tomcat
8.5\webapps\WebAPI.war
java.lang.IllegalStateException: ContainerBase.addChild: start:
org.apache.catalina.LifecycleException: Failed to start component
[StandardEngine[Catalina].StandardHost[localhost].StandardContext[/WebAPI]]
at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:756)
at
org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728)
at
org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
at
org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:952)
at
org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1823)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Can you please assist in resolving this issue?